Commit cf72e81e authored by Pavan Balaji's avatar Pavan Balaji
Browse files

[svn-r5695] Configure protect the asynchronous progress stuff. This will be

released formally in the mpich2-1.3 series after more testing.
parent 7e787b59
......@@ -366,6 +366,13 @@ if test $smpcoll = "yes" ; then
AC_DEFINE(USE_SMP_COLLECTIVES,1,[define to enable SMP/multi-core aware collectives])
fi
AC_ARG_ENABLE(async-progress,
[--enable-async-progress - Enable support for asynchronous communication progress],
async_progress=$enableval,async_progress=no)
if test "$async_progress" = "yes" ; then
AC_DEFINE(USE_ASYNC_PROGRESS,1,[define to enable asynchronous communication progress])
fi
dnl The environment variable MPICH_DEBUGLIBNAME may be used to override the
dnl default name of the library that the debugger will load to access the
dnl MPICH2 internal data structures.
......
......@@ -115,7 +115,6 @@ int MPI_Finalize( void )
{
static const char FCNAME[] = "MPI_Finalize";
int mpi_errno = MPI_SUCCESS;
int rc;
#if defined(HAVE_USLEEP) && defined(USE_COVERAGE)
int rank=0;
#endif
......@@ -131,12 +130,14 @@ int MPI_Finalize( void )
/* ... body of routine ... */
#if defined USE_ASYNC_PROGRESS
/* If the user requested for asynchronous progress, we need to
* shutdown the progress thread */
if (MPIR_async_thread_initialized) {
mpi_errno = MPIR_Finalize_async_thread();
if (mpi_errno) goto fn_fail;
}
#endif /* USE_ASYNC_PROGRESS */
#if defined(HAVE_USLEEP) && defined(USE_COVERAGE)
/* We need to get the rank before freeing MPI_COMM_WORLD */
......
......@@ -30,7 +30,9 @@
/* Any internal routines can go here. Make them static if possible */
#endif
#if defined USE_ASYNC_PROGRESS
int MPIR_async_thread_initialized = 0;
#endif /* USE_ASYNC_PROGRESS */
#undef FUNCNAME
#define FUNCNAME MPI_Init
......@@ -143,22 +145,26 @@ int MPI_Init( int *argc, char ***argv )
threadLevel = MPI_THREAD_SINGLE;
#endif
#if defined USE_ASYNC_PROGRESS
/* If the user requested for asynchronous progress, request for
* THREAD_MULTIPLE. */
rc = 0;
MPIU_GetEnvBool("MPICH_ASYNC_PROGRESS", &rc);
if (rc)
threadLevel = MPI_THREAD_MULTIPLE;
#endif /* USE_ASYNC_PROGRESS */
mpi_errno = MPIR_Init_thread( argc, argv, threadLevel, &provided );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (provided == MPI_THREAD_MULTIPLE) {
#if defined USE_ASYNC_PROGRESS
if (rc && provided == MPI_THREAD_MULTIPLE) {
mpi_errno = MPIR_Init_async_thread();
if (mpi_errno) goto fn_fail;
MPIR_async_thread_initialized = 1;
}
#endif /* USE_ASYNC_PROGRESS */
/* ... end of body of routine ... */
......
......@@ -554,22 +554,26 @@ int MPI_Init_thread( int *argc, char ***argv, int required, int *provided )
/* ... body of routine ... */
#if defined USE_ASYNC_PROGRESS
/* If the user requested for asynchronous progress, request for
* THREAD_MULTIPLE. */
rc = 0;
MPIU_GetEnvBool("MPICH_ASYNC_PROGRESS", &rc);
if (rc)
reqd = MPI_THREAD_MULTIPLE;
#endif /* USE_ASYNC_PROGRESS */
mpi_errno = MPIR_Init_thread( argc, argv, reqd, provided );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
#if defined USE_ASYNC_PROGRESS
if (rc && *provided == MPI_THREAD_MULTIPLE) {
mpi_errno = MPIR_Init_async_thread();
if (mpi_errno) goto fn_fail;
MPIR_async_thread_initialized = 1;
}
#endif /* USE_ASYNC_PROGRESS */
/* ... end of body of routine ... */
......
......@@ -9,4 +9,6 @@ int MPIR_Init_thread(int *, char ***, int, int *);
int MPIR_Init_async_thread(void);
int MPIR_Finalize_async_thread(void);
#if defined USE_ASYNC_PROGRESS
extern int MPIR_async_thread_initialized;
#endif /* USE_ASYNC_PROGRESS */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment