Don't use fork()

Create issue
Issue #914 new
Erik Schnetter created an issue

It seems that it is in many cases not safe to call fork() in MPI applications. This page http://www.open-mpi.de/faq/?category=openfabrics#ofa-fork has some information. The upshot seems to be: - In many (most) cases, one can call system() or popen() to execute external processes while waiting for them. - It is generally not safe to call fork() to execute a certain task in the background. However, it should be possible to use threads in this case.

Keyword:

Comments (5)

  1. Erik Schnetter reporter
    • removed comment

    This is not about a particular thorn. This is about all source code in Cactus thorns that may be running under MPI. We should review the code, and add a note to the documentation, and maybe even report compiler or run-time warnings when fork() is called.

  2. Frank Löffler

    A quick grep over the ET doesn't reveal any usage of fork, except in Formaline - but there it is disabled by default.

  3. Roland Haas
    • removed comment

    I believe fork() is ok. exec() can be a problem and so is doing anything with MPI in the forked() process (including and in particular calling MPI_Finalize).

  4. Log in to comment