int MPI_Info_get_nthkey( MPI_Info info, int n, char *key ) { int mpi_errno = MPI_SUCCESS; MPID_Info *info_ptr=0; MPID_MPI_STATE_DECL(MPID_STATE_MPI_INFO_GET_NTHKEY); MPIR_ERRTEST_INITIALIZED_ORDIE(); MPIU_THREAD_CS_ENTER(ALLFUNC,); MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INFO_GET_NTHKEY); /* Validate parameters, especially handles needing to be converted */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { MPIR_ERRTEST_INFO(info, mpi_errno); if (mpi_errno) goto fn_fail; } MPID_END_ERROR_CHECKS; } # endif /* HAVE_ERROR_CHECKING */ /* Convert MPI object handles to object pointers */ MPID_Info_get_ptr( info, info_ptr ); /* Validate parameters and objects (post conversion) */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { /* Validate info_ptr */ MPID_Info_valid_ptr( info_ptr, mpi_errno ); if (mpi_errno) goto fn_fail; MPIU_ERR_CHKANDJUMP((!key), mpi_errno, MPI_ERR_INFO_KEY, "**infokeynull"); } MPID_END_ERROR_CHECKS; } # endif /* HAVE_ERROR_CHECKING */ /* ... body of routine ... */ mpi_errno = MPIR_Info_get_nthkey_impl(info_ptr, n, key); if (mpi_errno) goto fn_fail; /* ... end of body of routine ... */ fn_exit: MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INFO_GET_NTHKEY); MPIU_THREAD_CS_EXIT(ALLFUNC,); return mpi_errno; fn_fail: /* --BEGIN ERROR HANDLING-- */ # ifdef HAVE_ERROR_CHECKING { mpi_errno = MPIR_Err_create_code( mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_info_get_nthkey", "**mpi_info_get_nthkey %I %d %p", info, n, key); } # endif mpi_errno = MPIR_Err_return_comm( NULL, FCNAME, mpi_errno ); goto fn_exit; /* --END ERROR HANDLING-- */ }
/*@ MPI_Comm_spawn_multiple - short description Input Parameters: + count - number of commands (positive integer, significant to MPI only at root . array_of_commands - programs to be executed (array of strings, significant only at root) . array_of_argv - arguments for commands (array of array of strings, significant only at root) . array_of_maxprocs - maximum number of processes to start for each command (array of integer, significant only at root) . array_of_info - info objects telling the runtime system where and how to start processes (array of handles, significant only at root) . root - rank of process in which previous arguments are examined (integer) - comm - intracommunicator containing group of spawning processes (handle) Output Parameters: + intercomm - intercommunicator between original group and newly spawned group (handle) - array_of_errcodes - one error code per process (array of integer) .N Fortran .N Errors .N MPI_SUCCESS .N MPI_ERR_COMM .N MPI_ERR_ARG .N MPI_ERR_INFO .N MPI_ERR_SPAWN @*/ int MPI_Comm_spawn_multiple(int count, char *array_of_commands[], char **array_of_argv[], const int array_of_maxprocs[], const MPI_Info array_of_info[], int root, MPI_Comm comm, MPI_Comm *intercomm, int array_of_errcodes[]) { static const char FCNAME[] = "MPI_Comm_spawn_multiple"; int mpi_errno = MPI_SUCCESS, i; MPID_Comm *comm_ptr = NULL; MPID_Comm *intercomm_ptr = NULL; MPID_Info **array_of_info_ptrs = NULL; MPIU_CHKLMEM_DECL(1); MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_SPAWN_MULTIPLE); MPIR_ERRTEST_INITIALIZED_ORDIE(); MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_SPAWN_MULTIPLE); /* Validate parameters, especially handles needing to be converted */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { MPIR_ERRTEST_COMM(comm, mpi_errno); } MPID_END_ERROR_CHECKS; } # endif /* Convert MPI object handles to object pointers */ MPID_Comm_get_ptr( comm, comm_ptr ); /* Validate parameters and objects (post conversion) */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { /* Validate comm_ptr */ MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE ); /* 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, MPI_ERR_COUNT); 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); } } } MPID_END_ERROR_CHECKS; } # endif /* HAVE_ERROR_CHECKING */ /* ... body of routine ... */ if (comm_ptr->rank == root) { MPIU_CHKLMEM_MALLOC(array_of_info_ptrs, MPID_Info **, count * sizeof(MPID_Info*), mpi_errno, "array of info pointers"); for (i=0; i<count; i++) { MPID_Info_get_ptr(array_of_info[i], array_of_info_ptrs[i]); } }
/*@ MPI_Unpublish_name - Unpublish a service name published with MPI_Publish_name Input Parameters: + service_name - a service name (string) . info - implementation-specific information (handle) - port_name - a port name (string) .N ThreadSafeNoUpdate .N Fortran .N Errors .N MPI_SUCCESS .N MPI_ERR_INFO .N MPI_ERR_ARG .N MPI_ERR_OTHER @*/ int MPI_Unpublish_name(const char *service_name, MPI_Info info, const char *port_name) { static const char FCNAME[] = "MPI_Unpublish_name"; int mpi_errno = MPI_SUCCESS; MPID_Info *info_ptr = NULL; MPID_MPI_STATE_DECL(MPID_STATE_MPI_UNPUBLISH_NAME); MPIR_ERRTEST_INITIALIZED_ORDIE(); MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_UNPUBLISH_NAME); /* Validate parameters, especially handles needing to be converted */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { MPIR_ERRTEST_INFO_OR_NULL(info, mpi_errno); } MPID_END_ERROR_CHECKS; } # endif /* Convert MPI object handles to object pointers */ MPID_Info_get_ptr( info, info_ptr ); /* Validate parameters and objects (post conversion) */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { /* Validate info_ptr (only if not null) */ if (info_ptr) MPID_Info_valid_ptr( info_ptr, mpi_errno ); MPIR_ERRTEST_ARGNULL( service_name, "service_name", mpi_errno ); MPIR_ERRTEST_ARGNULL( port_name, "port_name", mpi_errno ); } MPID_END_ERROR_CHECKS; } # endif /* HAVE_ERROR_CHECKING */ /* ... body of routine ... */ # ifdef HAVE_NAMEPUB_SERVICE { /* The standard leaves explicitly undefined what happens if the code attempts to unpublish a name that is not published. In this case, MPI_Unpublish_name could be called before a name service structure is allocated. */ if (!MPIR_Namepub) { mpi_errno = MPID_NS_Create( info_ptr, &MPIR_Namepub ); if (mpi_errno != MPI_SUCCESS) goto fn_fail; MPIR_Add_finalize( (int (*)(void*))MPID_NS_Free, &MPIR_Namepub, 9 ); } mpi_errno = MPID_NS_Unpublish( MPIR_Namepub, info_ptr, (const char *)service_name ); if (mpi_errno != MPI_SUCCESS) goto fn_fail; } # else { /* No name publishing service available */ MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**nonamepub"); } # endif /* ... end of body of routine ... */ fn_exit: MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_UNPUBLISH_NAME); MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); return mpi_errno; fn_fail: /* --BEGIN ERROR HANDLING-- */ # ifdef HAVE_ERROR_CHECKING { mpi_errno = MPIR_Err_create_code( mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_unpublish_name", "**mpi_unpublish_name %s %I %s", service_name, info, port_name); } # endif mpi_errno = MPIR_Err_return_comm( NULL, FCNAME, mpi_errno ); goto fn_exit; /* --END ERROR HANDLING-- */ }
/*@ MPI_Win_allocate_shared - Create an MPI Window object for one-sided communication and shared memory access, and allocate memory at each process. This is a collective call executed by all processes in the group of comm. On each process i, it allocates memory of at least size bytes that is shared among all processes in comm, and returns a pointer to the locally allocated segment in baseptr that can be used for load/store accesses on the calling process. The locally allocated memory can be the target of load/store accesses by remote processes; the base pointers for other processes can be queried using the function 'MPI_Win_shared_query'. The call also returns a window object that can be used by all processes in comm to perform RMA operations. The size argument may be different at each process and size = 0 is valid. It is the user''s responsibility to ensure that the communicator comm represents a group of processes that can create a shared memory segment that can be accessed by all processes in the group. The allocated memory is contiguous across process ranks unless the info key alloc_shared_noncontig is specified. Contiguous across process ranks means that the first address in the memory segment of process i is consecutive with the last address in the memory segment of process i − 1. This may enable the user to calculate remote address offsets with local information only. Input Parameters: . size - size of window in bytes (nonnegative integer) . disp_unit - local unit size for displacements, in bytes (positive integer) . info - info argument (handle) - comm - communicator (handle) Output Parameters: . baseptr - initial address of window (choice) - win - window object returned by the call (handle) .N ThreadSafe .N Fortran .N Errors .N MPI_SUCCESS .N MPI_ERR_ARG .N MPI_ERR_COMM .N MPI_ERR_INFO .N MPI_ERR_OTHER .N MPI_ERR_SIZE .seealso: MPI_Win_allocate MPI_Win_create MPI_Win_create_dynamic MPI_Win_free MPI_Win_shared_query @*/ int MPI_Win_allocate_shared(MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, void *baseptr, MPI_Win *win) { int mpi_errno = MPI_SUCCESS; MPID_Win *win_ptr = NULL; MPID_Comm *comm_ptr = NULL; MPID_Info *info_ptr = NULL; MPID_MPI_STATE_DECL(MPID_STATE_MPI_WIN_ALLOCATE_SHARED); MPIR_ERRTEST_INITIALIZED_ORDIE(); MPIU_THREAD_CS_ENTER(ALLFUNC,); MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_ALLOCATE_SHARED); /* Validate parameters, especially handles needing to be converted */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { MPIR_ERRTEST_COMM(comm, mpi_errno); MPIR_ERRTEST_INFO_OR_NULL(info, mpi_errno); MPIR_ERRTEST_ARGNULL(win, "win", mpi_errno); } MPID_END_ERROR_CHECKS; } # endif /* HAVE_ERROR_CHECKING */ /* 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 { MPID_BEGIN_ERROR_CHECKS; { /* Validate pointers */ MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE ); if (mpi_errno != MPI_SUCCESS) goto fn_fail; MPIU_ERR_CHKANDJUMP1(disp_unit <= 0, mpi_errno, MPI_ERR_ARG, "**arg", "**arg %s", "disp_unit must be positive"); MPIU_ERR_CHKANDJUMP1(size < 0, mpi_errno, MPI_ERR_SIZE, "**rmasize", "**rmasize %d", size); MPIU_ERR_CHKANDJUMP1(size > 0 && baseptr == NULL, mpi_errno, MPI_ERR_ARG, "**nullptr", "**nullptr %s", "NULL base pointer is invalid when size is nonzero"); if (mpi_errno != MPI_SUCCESS) goto fn_fail; } MPID_END_ERROR_CHECKS; } # endif /* HAVE_ERROR_CHECKING */ /* ... body of routine ... */ mpi_errno = MPID_Win_allocate_shared(size, disp_unit, info_ptr, comm_ptr, baseptr, &win_ptr); if (mpi_errno != MPI_SUCCESS) goto fn_fail; /* Initialize a few fields that have specific defaults */ win_ptr->name[0] = 0; win_ptr->errhandler = 0; /* return the handle of the window object to the user */ MPIU_OBJ_PUBLISH_HANDLE(*win, win_ptr->handle); /* ... end of body of routine ... */ fn_exit: MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_ALLOCATE_SHARED); MPIU_THREAD_CS_EXIT(ALLFUNC,); return mpi_errno; fn_fail: /* --BEGIN ERROR HANDLING-- */ # ifdef HAVE_ERROR_CHECKING { mpi_errno = MPIR_Err_create_code( mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_win_allocate_shared", "**mpi_win_allocate_shared %d %I %C %p %p", size, info, comm, baseptr, win); } # endif mpi_errno = MPIR_Err_return_comm( comm_ptr, FCNAME, mpi_errno ); goto fn_exit; /* --END ERROR HANDLING-- */ }
/*@ MPI_Comm_spawn - Spawn up to maxprocs instances of a single MPI application Input Parameters: + command - name of program to be spawned (string, significant only at root) . argv - arguments to command (array of strings, significant only at root) . maxprocs - maximum number of processes to start (integer, significant only at root) . info - a set of key-value pairs telling the runtime system where and how to start the processes (handle, significant only at root) . root - rank of process in which previous arguments are examined (integer) - comm - intracommunicator containing group of spawning processes (handle) Output Parameters: + intercomm - intercommunicator between original group and the newly spawned group (handle) - array_of_errcodes - one code per process (array of integer) .N ThreadSafe .N Fortran .N Errors .N MPI_SUCCESS .N MPI_ERR_COMM .N MPI_ERR_ARG .N MPI_ERR_INFO .N MPI_ERR_SPAWN @*/ int MPI_Comm_spawn(const char *command, char *argv[], int maxprocs, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *intercomm, int array_of_errcodes[]) { static const char FCNAME[] = "MPI_Comm_spawn"; int mpi_errno = MPI_SUCCESS; MPID_Comm *comm_ptr = NULL, *intercomm_ptr; MPID_Info *info_ptr=NULL; MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_SPAWN); MPIR_ERRTEST_INITIALIZED_ORDIE(); MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_SPAWN); /* Validate parameters, especially handles needing to be converted */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { MPIR_ERRTEST_COMM(comm, mpi_errno); } MPID_END_ERROR_CHECKS; } # endif /* Convert MPI object handles to object pointers */ MPID_Comm_get_ptr( comm, comm_ptr ); /* Validate parameters and objects (post conversion) */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { /* Validate comm_ptr */ MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE ); /* 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); } } 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 */ MPIDU_ERR_CHECK_MULTIPLE_THREADS_ENTER( comm_ptr ); mpi_errno = MPID_Comm_spawn_multiple(1, (char **) &command, &argv, &maxprocs, &info_ptr, root, comm_ptr, &intercomm_ptr, array_of_errcodes); if (mpi_errno != MPI_SUCCESS) goto fn_fail; MPID_OBJ_PUBLISH_HANDLE(*intercomm, intercomm_ptr->handle); /* ... end of body of routine ... */ fn_exit: MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_SPAWN); MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); return mpi_errno; fn_fail: /* --BEGIN ERROR HANDLING-- */ # ifdef HAVE_ERROR_CHECKING { mpi_errno = MPIR_Err_create_code( mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_comm_spawn", "**mpi_comm_spawn %s %p %d %I %d %C %p %p", command, argv, maxprocs, info, root, comm, intercomm, array_of_errcodes); } # endif mpi_errno = MPIR_Err_return_comm( comm_ptr, FCNAME, mpi_errno ); goto fn_exit; /* --END ERROR HANDLING-- */ }
/*@ MPI_Comm_set_info - Set new values for the hints of the communicator associated with comm. The call is collective on the group of comm. The info object may be different on each process, but any info entries that an implementation requires to be the same on all processes must appear with the same value in each process'' info object. Input Parameters: + comm - communicator object (handle) - info - info argument (handle) .N ThreadSafe .N Fortran .N Errors .N MPI_SUCCESS .N MPI_ERR_ARG .N MPI_ERR_INFO .N MPI_ERR_OTHER @*/ int MPI_Comm_set_info(MPI_Comm comm, MPI_Info info) { int mpi_errno = MPI_SUCCESS; MPID_Comm *comm_ptr = NULL; MPID_Info *info_ptr = NULL; MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_SET_INFO); MPIR_ERRTEST_INITIALIZED_ORDIE(); MPIU_THREAD_CS_ENTER(ALLFUNC,); MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_SET_INFO); /* Validate parameters, especially handles needing to be converted */ #ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { MPIR_ERRTEST_ARGNULL(info, "info", mpi_errno); } MPID_END_ERROR_CHECKS; } #endif /* HAVE_ERROR_CHECKING */ /* 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 { MPID_BEGIN_ERROR_CHECKS; { /* Validate pointers */ MPID_Comm_valid_ptr(comm_ptr, mpi_errno); if (mpi_errno) goto fn_fail; } MPID_END_ERROR_CHECKS; } #endif /* HAVE_ERROR_CHECKING */ /* ... body of routine ... */ mpi_errno = MPIR_Comm_set_info_impl(comm_ptr, info_ptr); if (mpi_errno != MPI_SUCCESS) goto fn_fail; /* ... end of body of routine ... */ fn_exit: MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_SET_INFO); MPIU_THREAD_CS_EXIT(ALLFUNC,); return mpi_errno; fn_fail: /* --BEGIN ERROR HANDLING-- */ #ifdef HAVE_ERROR_CHECKING { mpi_errno = MPIR_Err_create_code(mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_comm_set_info", "**mpi_comm_set_info %W %p", comm, info); } #endif mpi_errno = MPIR_Err_return_comm(comm_ptr, FCNAME, mpi_errno); goto fn_exit; /* --END ERROR HANDLING-- */ }
int MPI_Info_get_nkeys( MPI_Info info, int *nkeys ) { MPID_Info *info_ptr=0; int mpi_errno = MPI_SUCCESS; MPID_MPI_STATE_DECL(MPID_STATE_MPI_INFO_GET_NKEYS); MPIR_ERRTEST_INITIALIZED_ORDIE(); MPIU_THREAD_CS_ENTER(ALLFUNC,); MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INFO_GET_NKEYS); /* Validate parameters, especially handles needing to be converted */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { MPIR_ERRTEST_INFO(info, mpi_errno); if (mpi_errno) goto fn_fail; } MPID_END_ERROR_CHECKS; } # endif /* HAVE_ERROR_CHECKING */ /* Convert MPI object handles to object pointers */ MPID_Info_get_ptr( info, info_ptr ); /* Validate parameters and objects (post conversion) */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { /* Validate info_ptr */ MPID_Info_valid_ptr( info_ptr, mpi_errno ); MPIR_ERRTEST_ARGNULL(nkeys,"nkeys",mpi_errno); if (mpi_errno) goto fn_fail; } MPID_END_ERROR_CHECKS; } # endif /* HAVE_ERROR_CHECKING */ /* ... body of routine ... */ MPIR_Info_get_nkeys_impl(info_ptr, nkeys); /* ... end of body of routine ... */ #ifdef HAVE_ERROR_CHECKING fn_exit: #endif MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INFO_GET_NKEYS); MPIU_THREAD_CS_EXIT(ALLFUNC,); return mpi_errno; /* --BEGIN ERROR HANDLING-- */ # ifdef HAVE_ERROR_CHECKING fn_fail: { mpi_errno = MPIR_Err_create_code( mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_info_get_nkeys", "**mpi_info_get_nkeys %I %p", info, nkeys); } mpi_errno = MPIR_Err_return_comm( NULL, FCNAME, mpi_errno ); goto fn_exit; /* --END ERROR HANDLING-- */ # endif }
/*@ MPI_Info_dup - Returns a duplicate of the info object Input Parameters: . info - info object (handle) Output Parameters: . newinfo - duplicate of info object (handle) .N ThreadSafeInfoRead .N Fortran .N Errors .N MPI_SUCCESS .N MPI_ERR_OTHER @*/ int MPI_Info_dup( MPI_Info info, MPI_Info *newinfo ) { MPID_Info *info_ptr = 0, *new_info_ptr; int mpi_errno = MPI_SUCCESS; MPID_MPI_STATE_DECL(MPID_STATE_MPI_INFO_DUP); MPIR_ERRTEST_INITIALIZED_ORDIE(); MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INFO_DUP); /* Validate parameters, especially handles needing to be converted */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { MPIR_ERRTEST_INFO(info, mpi_errno); } MPID_END_ERROR_CHECKS; } # endif /* HAVE_ERROR_CHECKING */ /* Convert MPI object handles to object pointers */ MPID_Info_get_ptr( info, info_ptr ); /* Validate parameters and objects (post conversion) */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { /* Validate info_ptr */ MPID_Info_valid_ptr( info_ptr, mpi_errno ); MPIR_ERRTEST_ARGNULL(newinfo,"newinfo",mpi_errno); } MPID_END_ERROR_CHECKS; } # endif /* HAVE_ERROR_CHECKING */ /* ... body of routine ... */ mpi_errno = MPIR_Info_dup_impl(info_ptr, &new_info_ptr); if (mpi_errno != MPI_SUCCESS) goto fn_fail; *newinfo = new_info_ptr->handle; /* ... end of body of routine ... */ fn_exit: MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INFO_DUP); MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); return mpi_errno; fn_fail: /* --BEGIN ERROR HANDLING-- */ # ifdef HAVE_ERROR_CHECKING { mpi_errno = MPIR_Err_create_code( mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_info_dup", "**mpi_info_dup %I %p", info, newinfo); } # endif mpi_errno = MPIR_Err_return_comm( NULL, FCNAME, mpi_errno ); goto fn_exit; /* --END ERROR HANDLING-- */ }
/*@ MPI_Info_set - Adds a (key,value) pair to info Input Parameters: + info - info object (handle) . key - key (string) - value - value (string) .N NotThreadSafe .N Fortran .N Errors .N MPI_SUCCESS .N MPI_ERR_INFO_KEY .N MPI_ERR_INFO_VALUE .N MPI_ERR_EXHAUSTED @*/ int MPI_Info_set( MPI_Info info, const char *key, const char *value ) { static const char FCNAME[] = "MPI_Info_set"; int mpi_errno = MPI_SUCCESS; MPID_Info *info_ptr = NULL; MPID_MPI_STATE_DECL(MPID_STATE_MPI_INFO_SET); MPIR_ERRTEST_INITIALIZED_ORDIE(); MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INFO_SET); /* Validate parameters, especially handles needing to be converted */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { MPIR_ERRTEST_INFO(info, mpi_errno); } MPID_END_ERROR_CHECKS; } # endif /* HAVE_ERROR_CHECKING */ /* Convert MPI object handles to object pointers */ MPID_Info_get_ptr( info, info_ptr ); /* Validate parameters and objects (post conversion) */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { int keylen; /* Validate info_ptr */ MPID_Info_valid_ptr( info_ptr, mpi_errno ); if (mpi_errno) goto fn_fail; /* Check key */ MPIR_ERR_CHKANDJUMP((!key), mpi_errno, MPI_ERR_INFO_KEY, "**infokeynull"); keylen = (int)strlen(key); MPIR_ERR_CHKANDJUMP((keylen > MPI_MAX_INFO_KEY), mpi_errno, MPI_ERR_INFO_KEY, "**infokeylong"); MPIR_ERR_CHKANDJUMP((keylen == 0), mpi_errno, MPI_ERR_INFO_KEY, "**infokeyempty"); /* Check value arguments */ MPIR_ERR_CHKANDJUMP((!value), mpi_errno, MPI_ERR_INFO_VALUE, "**infovalnull"); MPIR_ERR_CHKANDJUMP((strlen(value) > MPI_MAX_INFO_VAL), mpi_errno, MPI_ERR_INFO_VALUE, "**infovallong"); } MPID_END_ERROR_CHECKS; } # endif /* HAVE_ERROR_CHECKING */ /* ... body of routine ... */ MPIR_Info_set_impl(info_ptr, key, value); /* ... end of body of routine ... */ fn_exit: MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INFO_SET); MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); return mpi_errno; fn_fail: /* --BEGIN ERROR HANDLING-- */ # ifdef HAVE_ERROR_CHECKING { mpi_errno = MPIR_Err_create_code( mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_info_set", "**mpi_info_set %I %s %s", info, key, value); } # endif mpi_errno = MPIR_Err_return_comm( NULL, FCNAME, mpi_errno ); goto fn_exit; /* --END ERROR HANDLING-- */ }
/*@ MPI_Comm_accept - Accept a request to form a new intercommunicator Input Parameters: + port_name - port name (string, used only on root) . info - implementation-dependent information (handle, used only on root) . root - rank in comm of root node (integer) - comm - intracommunicator over which call is collective (handle) Output Parameters: . newcomm - intercommunicator with client as remote group (handle) .N ThreadSafe .N Fortran .N Errors .N MPI_SUCCESS .N MPI_ERR_INFO .N MPI_ERR_COMM @*/ int MPI_Comm_accept(const char *port_name, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *newcomm) { int mpi_errno = MPI_SUCCESS; MPID_Comm *comm_ptr = NULL; MPID_Comm *newcomm_ptr = NULL; MPID_Info *info_ptr = NULL; MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_ACCEPT); MPIR_ERRTEST_INITIALIZED_ORDIE(); MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_ACCEPT); /* Validate parameters, especially handles needing to be converted */ # ifdef HAVE_ERROR_CHECKING { MPID_BEGIN_ERROR_CHECKS; { MPIR_ERRTEST_COMM(comm, mpi_errno); MPIR_ERRTEST_INFO_OR_NULL(info, mpi_errno); } MPID_END_ERROR_CHECKS; } # endif /* 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 { MPID_BEGIN_ERROR_CHECKS; { /* Validate comm_ptr */ MPID_Comm_valid_ptr( comm_ptr, mpi_errno, FALSE ); if (mpi_errno) goto fn_fail; } MPID_END_ERROR_CHECKS; } # endif /* HAVE_ERROR_CHECKING */ /* ... body of routine ... */ mpi_errno = MPIR_Comm_accept_impl(port_name, info_ptr, root, comm_ptr, &newcomm_ptr); if (mpi_errno) goto fn_fail; MPID_OBJ_PUBLISH_HANDLE(*newcomm, newcomm_ptr->handle); /* ... end of body of routine ... */ fn_exit: MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_ACCEPT); MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX); return mpi_errno; fn_fail: /* --BEGIN ERROR HANDLING-- */ # ifdef HAVE_ERROR_CHECKING { mpi_errno = MPIR_Err_create_code( mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_comm_accept", "**mpi_comm_accept %s %I %d %C %p", port_name, info, root, comm, newcomm); } # endif mpi_errno = MPIR_Err_return_comm( comm_ptr, FCNAME, mpi_errno ); goto fn_exit; /* --END ERROR HANDLING-- */ }