Commit cafc18e4 authored by Rajeev Thakur's avatar Rajeev Thakur
Browse files

[svn-r3451] added error checks to spawn and spawn_multiple. Fixes #266

parent 9aa45c95
......@@ -78,7 +78,6 @@ int MPI_Comm_spawn(char *command, char *argv[], int maxprocs, MPI_Info info,
MPID_BEGIN_ERROR_CHECKS;
{
MPIR_ERRTEST_COMM(comm, mpi_errno);
MPIR_ERRTEST_INFO_OR_NULL(info, mpi_errno);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
}
MPID_END_ERROR_CHECKS;
......@@ -87,7 +86,6 @@ int MPI_Comm_spawn(char *command, char *argv[], int maxprocs, MPI_Info info,
/* Convert MPI object handles to object pointers */
MPID_Comm_get_ptr( comm, comm_ptr );
MPID_Info_get_ptr( info, info_ptr );
/* Validate parameters and objects (post conversion) */
# ifdef HAVE_ERROR_CHECKING
......@@ -98,11 +96,26 @@ int MPI_Comm_spawn(char *command, char *argv[], int maxprocs, MPI_Info info,
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
/* If comm_ptr is not valid, it will be reset to null */
if (mpi_errno) goto fn_fail;
MPIR_ERRTEST_COMM_INTRA(comm_ptr, mpi_errno);
MPIR_ERRTEST_RANK(comm_ptr, root, mpi_errno);
if (comm_ptr->rank == root) {
MPIR_ERRTEST_INFO_OR_NULL(info, mpi_errno);
MPIR_ERRTEST_ARGNULL(command, "command", mpi_errno);
MPIR_ERRTEST_ARGNEG(maxprocs, "maxprocs", mpi_errno);
}
if (mpi_errno) goto fn_fail;
}
MPID_END_ERROR_CHECKS;
}
# endif /* HAVE_ERROR_CHECKING */
if (comm_ptr->rank == root) {
MPID_Info_get_ptr( info, info_ptr );
}
/* ... body of routine ... */
/* check if multiple threads are calling this collective function */
......
......@@ -102,10 +102,18 @@ int MPI_Comm_spawn_multiple(int count, char *array_of_commands[],
/* If comm_ptr is not valid, it will be reset to null */
if (mpi_errno) goto fn_fail;
MPIR_ERRTEST_COMM_INTRA(comm_ptr, mpi_errno);
MPIR_ERRTEST_RANK(comm_ptr, root, mpi_errno);
if (comm_ptr->rank == root) {
MPIR_ERRTEST_ARGNULL(array_of_commands, "array_of_commands", mpi_errno);
MPIR_ERRTEST_ARGNULL(array_of_maxprocs, "array_of_maxprocs", mpi_errno);
MPIR_ERRTEST_ARGNONPOS(count, "count", mpi_errno);
for (i = 0; i < count; i++)
{
MPIR_ERRTEST_INFO_OR_NULL(array_of_info[i], mpi_errno);
MPIR_ERRTEST_ARGNULL(array_of_commands[i], "array_of_commands[i]", mpi_errno);
MPIR_ERRTEST_ARGNEG(array_of_maxprocs[i], "array_of_maxprocs[i]", mpi_errno);
}
if (mpi_errno) goto fn_fail;
}
......
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