Per MPI-2:3.1, MPI_GET_VERSION can be called before MPI_INIT, so
remove the MPI_ERR_INIT_FINALIZE() macro. Also check to see how we invoke the errhandler if an error occurs (i.e., the action depends on whether we're between MPI_INIT and MPI_FINALIZE or not). This commit was SVN r5891.
Этот коммит содержится в:
родитель
9c2554d8ce
Коммит
497580441d
@ -34,17 +34,36 @@ static const char FUNC_NAME[] = "MPI_Get_version";
|
|||||||
|
|
||||||
int MPI_Get_version(int *version, int *subversion)
|
int MPI_Get_version(int *version, int *subversion)
|
||||||
{
|
{
|
||||||
if (MPI_PARAM_CHECK) {
|
MPI_Comm null = NULL;
|
||||||
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
|
||||||
if (NULL == version || NULL == subversion) {
|
if (MPI_PARAM_CHECK) {
|
||||||
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG, FUNC_NAME);
|
/* Per MPI-2:3.1, this function can be invoked before
|
||||||
|
MPI_INIT, so we don't invoke the normal
|
||||||
|
MPI_ERR_INIT_FINALIZE() macro here */
|
||||||
|
|
||||||
|
if (NULL == version || NULL == subversion) {
|
||||||
|
/* Note that we have to check and see if we have
|
||||||
|
previously called MPI_INIT or not. If so, use the
|
||||||
|
normal OMPI_ERRHANDLER_INVOKE, because the user may
|
||||||
|
have changed the default errhandler on MPI_COMM_WORLD.
|
||||||
|
If we have not invoked MPI_INIT, then just abort
|
||||||
|
(i.e., use a NULL communicator, which will end up at the
|
||||||
|
default errhandler, which is abort). */
|
||||||
|
|
||||||
|
if (ompi_mpi_initialized && !ompi_mpi_finalized) {
|
||||||
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
|
||||||
|
FUNC_NAME);
|
||||||
|
} else {
|
||||||
|
return OMPI_ERRHANDLER_INVOKE(null, MPI_ERR_ARG,
|
||||||
|
FUNC_NAME);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* According to the MPI-2 specification */
|
/* According to the MPI-2 specification */
|
||||||
|
|
||||||
*version = 2;
|
*version = 2;
|
||||||
*subversion = 0;
|
*subversion = 0;
|
||||||
|
|
||||||
return MPI_SUCCESS;
|
return MPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user