1
1

Amend r19196 with a few extra bells and whistles:

* use "warn_on_fork" instead of "do_not_warn_on_fork" -- i.e.,
   use positive logic instead of negative logic
 * ensure that pthread_atfork() is only called once
 * amended the error message to include the hostname, PID, and
   MPI_COMM_WORLD rank of the offender
 * ensure that the warn_fork_cb() function is only defined if
   HAVE_PTHREAD_H so that we don't get a compiler warning if it isn't
   used

This commit was SVN r19204.

The following SVN revision numbers were found above:
  r19196 --> open-mpi/ompi@277e4ac292
Этот коммит содержится в:
Jeff Squyres 2008-08-06 17:29:41 +00:00
родитель 45beed78e9
Коммит 9cffbecdaf
4 изменённых файлов: 30 добавлений и 14 удалений

Просмотреть файл

@ -77,8 +77,18 @@ In order to operate in a heterogeneous environment, please reconfigure
Open MPI with --enable-heterogeneous.
#
[mpi_init:warn-fork]
The program has executed an operation involving a call to "fork". Open MPI
is currently operating in a condition that could result in memory corruption
issues in this situation - for example, use of the OpenIB BTL. Use of fork
is therefore not recommended in this situation.
An MPI process has executed an operation involving a call to the
"fork()" system call to create a child process. Open MPI is currently
operating in a condition that could result in memory corruption or
other system errors; your MPI job may hang, crash, or produce silent
data corruption. The use of fork() (or system() or other calls that
create child processes) is strongly discouraged.
The process that invoked fork was:
Local host: %s (PID %d)
MPI_COMM_WORLD rank: %d
If you are *absolutely sure* that your application will successfully
and correctly survive a call to fork(), you may disable this warning
by setting the mpi_warn_on_fork MCA parameter to 0.

Просмотреть файл

@ -61,7 +61,7 @@ OMPI_DECLSPEC extern struct opal_thread_t *ompi_mpi_main_thread;
OMPI_DECLSPEC extern bool ompi_mpi_maffinity_setup;
/** Do we want to be warned on fork or not? */
OMPI_DECLSPEC extern bool ompi_do_not_warn_on_fork;
OMPI_DECLSPEC extern bool ompi_warn_on_fork;
/** In ompi_mpi_init: a list of all memory associated with calling
MPI_REGISTER_DATAREP so that we can free it during

Просмотреть файл

@ -118,23 +118,29 @@ opal_thread_t *ompi_mpi_main_thread = NULL;
bool ompi_mpi_maffinity_setup = false;
bool ompi_do_not_warn_on_fork;
bool ompi_warn_on_fork;
static bool fork_warning_issued = false;
static bool atfork_called = false;
static void warn_fork(void)
#if HAVE_PTHREAD_H
static void warn_fork_cb(void)
{
if (ompi_mpi_initialized && !ompi_mpi_finalized && !fork_warning_issued) {
orte_show_help("help-mpi-runtime.txt", "mpi_init:warn-fork", true);
orte_show_help("help-mpi-runtime.txt", "mpi_init:warn-fork", true,
orte_process_info.nodename, getpid(),
ompi_mpi_comm_world.c_my_rank);
fork_warning_issued = true;
}
}
#endif
void ompi_warn_fork(void)
{
#if HAVE_PTHREAD_H
if (!ompi_do_not_warn_on_fork) {
pthread_atfork(warn_fork, NULL, NULL);
if (ompi_warn_on_fork && !atfork_called) {
pthread_atfork(warn_fork_cb, NULL, NULL);
atfork_called = true;
}
#endif
}

Просмотреть файл

@ -275,11 +275,11 @@ int ompi_mpi_register_params(void)
(int) ompi_mpi_paffinity_alone, &value);
ompi_mpi_paffinity_alone = OPAL_INT_TO_BOOL(value);
mca_base_param_reg_int_name("mpi", "do_not_warn_on_fork",
"If nonzero, do not warn if program forks under conditions that could cause memory corruption issues",
mca_base_param_reg_int_name("mpi", "warn_on_fork",
"If nonzero, issue a warning if program forks under conditions that could cause system errors",
false, false,
(int) false, &value);
ompi_do_not_warn_on_fork = OPAL_INT_TO_BOOL(value);
(int) true, &value);
ompi_warn_on_fork = OPAL_INT_TO_BOOL(value);
/* Sparse group storage support */