Commit 4cd7ec9d authored by Darius Buntinas's avatar Darius Buntinas
Browse files

[svn-r6870] Replacing NMPI_ with MPIR_..._impl. Reviewed by goodell@

parent 888ed817
......@@ -3472,7 +3472,16 @@ int MPIR_Cart_map_impl(const MPID_Comm *comm_ptr, int ndims, const int dims[],
const int periodic[], int *newrank);
int MPIR_Close_port_impl(char *port_name);
int MPIR_Open_port_impl(MPID_Info *info_ptr, char *port_name);
int MPIR_Comm_delete_attr_impl(MPID_Comm *comm_ptr, MPID_Keyval *keyval_ptr);
int MPIR_Comm_create_keyval_impl(MPI_Comm_copy_attr_function *comm_copy_attr_fn,
MPI_Comm_delete_attr_function *comm_delete_attr_fn,
int *comm_keyval, void *extra_state);
int MPIR_Comm_accept_impl(char * port_name, MPID_Info * info_ptr, int root,
MPID_Comm * comm_ptr, MPID_Comm ** newcomm_ptr);
int MPIR_Comm_connect_impl(char * port_name, MPID_Info * info_ptr, int root,
MPID_Comm * comm_ptr, MPID_Comm ** newcomm_ptr);
int MPIR_Comm_create_errhandler_impl(MPI_Comm_errhandler_function *function,
MPI_Errhandler *errhandler);
#endif /* MPIIMPL_INCLUDED */
......@@ -29,12 +29,8 @@
#define NMPI_Unpack MPI_Unpack
#define NMPI_Wait MPI_Wait
#define NMPI_Test MPI_Test
#define NMPI_Comm_get_attr MPI_Comm_get_attr
#define NMPI_Comm_set_attr MPI_Comm_set_attr
#define NMPI_Type_get_attr MPI_Type_get_attr
#define NMPI_Type_set_attr MPI_Type_set_attr
#define NMPI_Comm_delete_attr MPI_Comm_delete_attr
#define NMPI_Comm_create_keyval MPI_Comm_create_keyval
#define NMPI_Comm_free_keyval MPI_Comm_free_keyval
#define NMPI_Comm_group MPI_Comm_group
#define NMPI_Comm_remote_group MPI_Comm_remote_group
......@@ -75,10 +71,7 @@
#define NMPI_Comm_get_name MPI_Comm_get_name
#define NMPI_Comm_get_errhandler MPI_Comm_get_errhandler
#define NMPI_Comm_set_errhandler MPI_Comm_set_errhandler
#define NMPI_Comm_create_errhandler MPI_Comm_create_errhandler
#define NMPI_Comm_call_errhandler MPI_Comm_call_errhandler
#define NMPI_Comm_accept MPI_Comm_accept
#define NMPI_Comm_connect MPI_Comm_connect
#define NMPI_Grequest_start MPI_Grequest_start
#define NMPI_Grequest_complete MPI_Grequest_complete
#define NMPI_Test_cancelled MPI_Test_cancelled
......@@ -101,12 +94,8 @@
#define NMPI_Unpack PMPI_Unpack
#define NMPI_Wait PMPI_Wait
#define NMPI_Test PMPI_Test
#define NMPI_Comm_get_attr PMPI_Comm_get_attr
#define NMPI_Comm_set_attr PMPI_Comm_set_attr
#define NMPI_Type_get_attr PMPI_Type_get_attr
#define NMPI_Type_set_attr PMPI_Type_set_attr
#define NMPI_Comm_delete_attr PMPI_Comm_delete_attr
#define NMPI_Comm_create_keyval PMPI_Comm_create_keyval
#define NMPI_Comm_free_keyval PMPI_Comm_free_keyval
#define NMPI_Comm_group PMPI_Comm_group
#define NMPI_Comm_remote_group PMPI_Comm_remote_group
......@@ -147,10 +136,7 @@
#define NMPI_Comm_get_name PMPI_Comm_get_name
#define NMPI_Comm_get_errhandler PMPI_Comm_get_errhandler
#define NMPI_Comm_set_errhandler PMPI_Comm_set_errhandler
#define NMPI_Comm_create_errhandler PMPI_Comm_create_errhandler
#define NMPI_Comm_call_errhandler PMPI_Comm_call_errhandler
#define NMPI_Comm_accept PMPI_Comm_accept
#define NMPI_Comm_connect PMPI_Comm_connect
#define NMPI_Grequest_start PMPI_Grequest_start
#define NMPI_Grequest_complete PMPI_Grequest_complete
#define NMPI_Test_cancelled PMPI_Test_cancelled
......
......@@ -6,6 +6,7 @@
*/
#include "mpiimpl.h"
#include "attr.h"
/* -- Begin Profiling Symbol Block for routine MPI_Attr_delete */
#if defined(HAVE_PRAGMA_WEAK)
......@@ -54,7 +55,7 @@ int MPI_Attr_delete(MPI_Comm comm, int keyval)
static const char FCNAME[] = "MPI_Attr_delete";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_Keyval *keyval_ptr;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_ATTR_DELETE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -76,6 +77,7 @@ int MPI_Attr_delete(MPI_Comm comm, int keyval)
/* Convert MPI object handles to object pointers */
MPID_Comm_get_ptr( comm, comm_ptr );
MPID_Keyval_get_ptr( keyval, keyval_ptr );
/* Validate parameters and objects (post conversion) */
# ifdef HAVE_ERROR_CHECKING
......@@ -85,6 +87,8 @@ int MPI_Attr_delete(MPI_Comm comm, int keyval)
/* Validate comm_ptr */
MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
/* If comm_ptr is not valid, it will be reset to null */
/* Validate keyval_ptr */
MPID_Keyval_valid_ptr( keyval_ptr, mpi_errno );
if (mpi_errno) goto fn_fail;
}
MPID_END_ERROR_CHECKS;
......@@ -93,10 +97,7 @@ int MPI_Attr_delete(MPI_Comm comm, int keyval)
/* ... body of routine ... */
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
mpi_errno = NMPI_Comm_delete_attr( comm, keyval );
MPIR_Nest_decr();
mpi_errno = MPIR_Comm_delete_attr_impl( comm_ptr, keyval_ptr );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
/* ... end of body of routine ... */
......
......@@ -74,7 +74,6 @@ int MPI_Attr_get(MPI_Comm comm, int keyval, void *attr_value, int *flag)
static const char FCNAME[] = "MPI_Attr_get";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_ATTR_GET);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -125,10 +124,7 @@ int MPI_Attr_get(MPI_Comm comm, int keyval, void *attr_value, int *flag)
/* ... body of routine ... */
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
mpi_errno = NMPI_Comm_get_attr( comm, keyval, attr_value, flag );
MPIR_Nest_decr();
mpi_errno = MPIR_CommGetAttr( comm, keyval, attr_value, flag, MPIR_ATTR_PTR);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
/* ... end of body of routine ... */
......
......@@ -73,7 +73,6 @@ int MPI_Attr_put(MPI_Comm comm, int keyval, void *attr_value)
static const char FCNAME[] = "MPI_Attr_put";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_ATTR_PUT);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -112,10 +111,7 @@ int MPI_Attr_put(MPI_Comm comm, int keyval, void *attr_value)
/* ... body of routine ... */
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
mpi_errno = NMPI_Comm_set_attr( comm, keyval, attr_value );
MPIR_Nest_decr();
mpi_errno = MPIR_CommSetAttr( comm, keyval, attr_value, MPIR_ATTR_PTR );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
/* ... end of body of routine ... */
......
......@@ -24,11 +24,53 @@
#undef MPI_Comm_create_keyval
#define MPI_Comm_create_keyval PMPI_Comm_create_keyval
#undef FUNCNAME
#define FUNCNAME MPIR_Comm_create_keyval_impl
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
int MPIR_Comm_create_keyval_impl(MPI_Comm_copy_attr_function *comm_copy_attr_fn,
MPI_Comm_delete_attr_function *comm_delete_attr_fn,
int *comm_keyval, void *extra_state)
{
int mpi_errno = MPI_SUCCESS;
MPID_Keyval *keyval_ptr;
keyval_ptr = (MPID_Keyval *)MPIU_Handle_obj_alloc( &MPID_Keyval_mem );
MPIU_ERR_CHKANDJUMP(!keyval_ptr, mpi_errno, MPI_ERR_OTHER,"**nomem");
/* Initialize the attribute dup function */
if (!MPIR_Process.attr_dup) {
MPIR_Process.attr_dup = MPIR_Attr_dup_list;
MPIR_Process.attr_free = MPIR_Attr_delete_list;
}
/* The handle encodes the keyval kind. Modify it to have the correct
field */
keyval_ptr->handle = (keyval_ptr->handle & ~(0x03c00000)) |
(MPID_COMM << 22);
*comm_keyval = keyval_ptr->handle;
MPIU_Object_set_ref(keyval_ptr,1);
keyval_ptr->was_freed = 0;
keyval_ptr->kind = MPID_COMM;
keyval_ptr->extra_state = extra_state;
keyval_ptr->copyfn.user_function = comm_copy_attr_fn;
keyval_ptr->copyfn.proxy = MPIR_Attr_copy_c_proxy;
keyval_ptr->delfn.user_function = comm_delete_attr_fn;
keyval_ptr->delfn.proxy = MPIR_Attr_delete_c_proxy;
fn_exit:
return mpi_errno;
fn_fail:
goto fn_exit;
}
#endif
#undef FUNCNAME
#define FUNCNAME MPI_Comm_create_keyval
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
/*@
MPI_Comm_create_keyval - Create a new attribute key
......@@ -69,9 +111,7 @@ int MPI_Comm_create_keyval(MPI_Comm_copy_attr_function *comm_copy_attr_fn,
MPI_Comm_delete_attr_function *comm_delete_attr_fn,
int *comm_keyval, void *extra_state)
{
static const char FCNAME[] = "MPI_Comm_create_keyval";
int mpi_errno = MPI_SUCCESS;
MPID_Keyval *keyval_ptr;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_CREATE_KEYVAL);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -92,29 +132,9 @@ int MPI_Comm_create_keyval(MPI_Comm_copy_attr_function *comm_copy_attr_fn,
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
keyval_ptr = (MPID_Keyval *)MPIU_Handle_obj_alloc( &MPID_Keyval_mem );
MPIU_ERR_CHKANDJUMP(!keyval_ptr,mpi_errno,MPI_ERR_OTHER,"**nomem");
/* Initialize the attribute dup function */
if (!MPIR_Process.attr_dup) {
MPIR_Process.attr_dup = MPIR_Attr_dup_list;
MPIR_Process.attr_free = MPIR_Attr_delete_list;
}
/* The handle encodes the keyval kind. Modify it to have the correct
field */
keyval_ptr->handle = (keyval_ptr->handle & ~(0x03c00000)) |
(MPID_COMM << 22);
*comm_keyval = keyval_ptr->handle;
MPIU_Object_set_ref(keyval_ptr,1);
keyval_ptr->was_freed = 0;
keyval_ptr->kind = MPID_COMM;
keyval_ptr->extra_state = extra_state;
keyval_ptr->copyfn.user_function = comm_copy_attr_fn;
keyval_ptr->copyfn.proxy = MPIR_Attr_copy_c_proxy;
keyval_ptr->delfn.user_function = comm_delete_attr_fn;
keyval_ptr->delfn.proxy = MPIR_Attr_delete_c_proxy;
mpi_errno = MPIR_Comm_create_keyval_impl(comm_copy_attr_fn, comm_delete_attr_fn, comm_keyval, extra_state);
if (mpi_errno) goto fn_fail;
/* ... end of body of routine ... */
......
......@@ -24,11 +24,62 @@
#undef MPI_Comm_delete_attr
#define MPI_Comm_delete_attr PMPI_Comm_delete_attr
#undef FUNCNAME
#define FUNCNAME MPIR_Comm_delete_attr_impl
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
int MPIR_Comm_delete_attr_impl(MPID_Comm *comm_ptr, MPID_Keyval *keyval_ptr)
{
int mpi_errno = MPI_SUCCESS;
MPID_Attribute *p, **old_p;
/* Look for attribute. They are ordered by keyval handle */
old_p = &comm_ptr->attributes;
p = comm_ptr->attributes;
while (p) {
if (p->keyval->handle == keyval_ptr->handle) {
break;
}
old_p = &p->next;
p = p->next;
}
/* We can't unlock yet, because we must not free the attribute until
we know whether the delete function has returned with a 0 status
code */
if (p) {
int in_use;
/* Run the delete function, if any, and then free the attribute
storage */
mpi_errno = MPIR_Call_attr_delete( comm_ptr->handle, p );
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
/* We found the attribute. Remove it from the list */
*old_p = p->next;
/* Decrement the use of the keyval */
MPIR_Keyval_release_ref( p->keyval, &in_use);
if (!in_use) {
MPIU_Handle_obj_free( &MPID_Keyval_mem, p->keyval );
}
MPID_Attr_free(p);
}
fn_exit:
return mpi_errno;
fn_fail:
goto fn_exit;
}
#endif
#undef FUNCNAME
#define FUNCNAME MPI_Comm_delete_attr
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
/*@
MPI_Comm_delete_attr - Deletes an attribute value associated with a key on
a communicator
......@@ -50,10 +101,8 @@ Input Parameters:
@*/
int MPI_Comm_delete_attr(MPI_Comm comm, int comm_keyval)
{
static const char FCNAME[] = "MPI_Comm_delete_attr";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPID_Attribute *p, **old_p;
MPID_Keyval *keyval_ptr;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_DELETE_ATTR);
......@@ -97,45 +146,12 @@ int MPI_Comm_delete_attr(MPI_Comm comm, int comm_keyval)
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
/* Look for attribute. They are ordered by keyval handle */
old_p = &comm_ptr->attributes;
p = comm_ptr->attributes;
while (p) {
if (p->keyval->handle == keyval_ptr->handle) {
break;
}
old_p = &p->next;
p = p->next;
}
/* We can't unlock yet, because we must not free the attribute until
we know whether the delete function has returned with a 0 status
code */
if (p) {
/* Run the delete function, if any, and then free the attribute
storage */
mpi_errno = MPIR_Call_attr_delete( comm, p );
if (!mpi_errno) {
int in_use;
/* We found the attribute. Remove it from the list */
*old_p = p->next;
/* Decrement the use of the keyval */
MPIR_Keyval_release_ref( p->keyval, &in_use);
if (!in_use) {
MPIU_Handle_obj_free( &MPID_Keyval_mem, p->keyval );
}
MPID_Attr_free(p);
}
}
mpi_errno = MPIR_Comm_delete_attr_impl(comm_ptr, keyval_ptr);
if (mpi_errno) goto fn_fail;
/* ... end of body of routine ... */
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
fn_exit:
MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_DELETE_ATTR);
MPIU_THREAD_CS_EXIT(ALLFUNC,);
......
......@@ -69,7 +69,6 @@ int MPI_Keyval_create(MPI_Copy_function *copy_fn,
{
static const char FCNAME[] = "MPI_Keyval_create";
int mpi_errno = MPI_SUCCESS;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_KEYVAL_CREATE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -91,11 +90,7 @@ int MPI_Keyval_create(MPI_Copy_function *copy_fn,
/* ... body of routine ... */
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
mpi_errno = NMPI_Comm_create_keyval( copy_fn, delete_fn, keyval,
extra_state );
MPIR_Nest_decr();
mpi_errno = MPIR_Comm_create_keyval_impl( copy_fn, delete_fn, keyval, extra_state );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
/* ... end of body of routine ... */
......
......@@ -23,11 +23,38 @@
#undef MPI_Comm_create_errhandler
#define MPI_Comm_create_errhandler PMPI_Comm_create_errhandler
#undef FUNCNAME
#define FUNCNAME MPIR_Comm_create_errhandler_impl
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
int MPIR_Comm_create_errhandler_impl(MPI_Comm_errhandler_function *function,
MPI_Errhandler *errhandler)
{
int mpi_errno = MPI_SUCCESS;
MPID_Errhandler *errhan_ptr;
errhan_ptr = (MPID_Errhandler *)MPIU_Handle_obj_alloc( &MPID_Errhandler_mem );
MPIU_ERR_CHKANDJUMP(!errhan_ptr, mpi_errno, MPI_ERR_OTHER, "**nomem");
*errhandler = errhan_ptr->handle;
errhan_ptr->language = MPID_LANG_C;
errhan_ptr->kind = MPID_COMM;
MPIU_Object_set_ref(errhan_ptr,1);
errhan_ptr->errfn.C_Comm_Handler_function = function;
fn_exit:
return mpi_errno;
fn_fail:
goto fn_exit;
}
#endif
#undef FUNCNAME
#define FUNCNAME MPI_Comm_create_errhandler
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
/*@
MPI_Comm_create_errhandler - Create a communicator error handler
......@@ -49,9 +76,7 @@
int MPI_Comm_create_errhandler(MPI_Comm_errhandler_function *function,
MPI_Errhandler *errhandler)
{
static const char FCNAME[] = "MPI_Comm_create_errhandler";
int mpi_errno = MPI_SUCCESS;
MPID_Errhandler *errhan_ptr;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_CREATE_ERRHANDLER);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -74,15 +99,9 @@ int MPI_Comm_create_errhandler(MPI_Comm_errhandler_function *function,
/* ... body of routine ... */
errhan_ptr = (MPID_Errhandler *)MPIU_Handle_obj_alloc( &MPID_Errhandler_mem );
MPIU_ERR_CHKANDJUMP(!errhan_ptr,mpi_errno,MPI_ERR_OTHER,"**nomem");
*errhandler = errhan_ptr->handle;
errhan_ptr->language = MPID_LANG_C;
errhan_ptr->kind = MPID_COMM;
MPIU_Object_set_ref(errhan_ptr,1);
errhan_ptr->errfn.C_Comm_Handler_function = function;
mpi_errno = MPIR_Comm_create_errhandler_impl(function, errhandler);
if (mpi_errno) goto fn_fail;
/* ... end of body of routine ... */
fn_exit:
......
......@@ -63,7 +63,6 @@ int MPI_Errhandler_create(MPI_Handler_function *function,
{
static const char FCNAME[] = "MPI_Errhandler_create";
int mpi_errno = MPI_SUCCESS;
MPIU_THREADPRIV_DECL;
MPID_MPI_STATE_DECL(MPID_STATE_MPI_ERRHANDLER_CREATE);
MPIR_ERRTEST_INITIALIZED_ORDIE();
......@@ -85,11 +84,7 @@ int MPI_Errhandler_create(MPI_Handler_function *function,
# endif /* HAVE_ERROR_CHECKING */
/* ... body of routine ... */
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
mpi_errno = NMPI_Comm_create_errhandler( function, errhandler );
MPIR_Nest_decr();
mpi_errno = MPIR_Comm_create_errhandler_impl( function, errhandler );
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
/* ... end of body of routine ... */
......
......@@ -23,11 +23,23 @@
#undef MPI_Comm_accept
#define MPI_Comm_accept PMPI_Comm_accept
#undef FUNCNAME
#define FUNCNAME MPIR_Comm_accept_impl
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
int MPIR_Comm_accept_impl(char * port_name, MPID_Info * info_ptr, int root,
MPID_Comm * comm_ptr, MPID_Comm ** newcomm_ptr)
{
return MPID_Comm_accept(port_name, info_ptr, root, comm_ptr, newcomm_ptr);
}
#endif
#undef FUNCNAME
#define FUNCNAME MPI_Comm_accept
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
/*@
MPI_Comm_accept - Accept a request to form a new intercommunicator
......@@ -52,7 +64,6 @@
int MPI_Comm_accept(char *port_name, MPI_Info info, int root, MPI_Comm comm,
MPI_Comm *newcomm)
{
static const char FCNAME[] = "MPI_Comm_accept";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPID_Comm *newcomm_ptr = NULL;
......@@ -96,9 +107,8 @@ int MPI_Comm_accept(char *port_name, MPI_Info info, int root, MPI_Comm comm,
/* ... body of routine ... */
mpi_errno = MPID_Comm_accept(port_name, info_ptr, root, comm_ptr,
&newcomm_ptr);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
mpi_errno = MPIR_Comm_accept_impl(port_name, info_ptr, root, comm_ptr, &newcomm_ptr);
if (mpi_errno) goto fn_fail;
*newcomm = newcomm_ptr->handle;
......
......@@ -22,12 +22,22 @@
#undef MPI_Comm_connect
#define MPI_Comm_connect PMPI_Comm_connect
/* Any internal routines can go here. Make them static if possible */
#undef FUNCNAME
#define FUNCNAME MPIR_Comm_connect_impl
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
int MPIR_Comm_connect_impl(char * port_name, MPID_Info * info_ptr, int root,
MPID_Comm * comm_ptr, MPID_Comm ** newcomm_ptr)
{
return MPID_Comm_connect(port_name, info_ptr, root, comm_ptr, newcomm_ptr);
}
#endif
#undef FUNCNAME
#define FUNCNAME MPI_Comm_connect
#undef FCNAME
#define FCNAME MPIU_QUOTE(FUNCNAME)
/*@
MPI_Comm_connect - Make a request to form a new intercommunicator
......@@ -53,7 +63,6 @@
int MPI_Comm_connect(char *port_name, MPI_Info info, int root, MPI_Comm comm,
MPI_Comm *newcomm)
{
static const char FCNAME[] = "MPI_Comm_connect";
int mpi_errno = MPI_SUCCESS;
MPID_Comm *comm_ptr = NULL;
MPID_Comm *newcomm_ptr = NULL;
......@@ -98,9 +107,8 @@ int MPI_Comm_connect(char *port_name, MPI_Info info, int root, MPI_Comm comm,
/* ... body of routine ... */
mpi_errno = MPID_Comm_connect(port_name, info_ptr, root, comm_ptr,
&newcomm_ptr);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
mpi_errno = MPIR_Comm_connect_impl(port_name, info_ptr, root, comm_ptr, &newcomm_ptr);
if (mpi_errno) goto fn_fail;
*newcomm = newcomm_ptr->handle;
......
......@@ -132,7 +132,6 @@ int MPI_Comm_join(int fd, MPI_Comm *intercomm)
static const char FCNAME[] = "MPI_Comm_join";
int mpi_errno = MPI_SUCCESS, err;
char *local_port, *remote_port;
MPIU_THREADPRIV_DECL;
MPIU_CHKLMEM_DECL(2);
MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_JOIN);
......@@ -142,11 +141,6 @@ int MPI_Comm_join(int fd, MPI_Comm *intercomm)
MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_JOIN);
/* ... body of routine ... */
MPIU_THREADPRIV_GET;
/* Set the nest incr here so that we can jump to fn_fail and
call nest_decr without worry */
MPIR_Nest_incr();
MPIU_CHKLMEM_MALLOC(local_port, char *, MPI_MAX_PORT_NAME, mpi_errno, "local port name");
MPIU_CHKLMEM_MALLOC(remote_port, char *, MPI_MAX_PORT_NAME, mpi_errno, "remote port name");
......@@ -164,18 +158,21 @@ int MPI_Comm_join(int fd, MPI_Comm *intercomm)
"**join_portname %s %s", local_port, remote_port);
if (strcmp(local_port, remote_port) < 0) {
mpi_errno = NMPI_Comm_accept(local_port, MPI_INFO_NULL, 0,
MPI_COMM_SELF, intercomm);
}
else {
mpi_errno = NMPI_Comm_connect(remote_port, MPI_INFO_NULL, 0,
MPI_COMM_SELF, intercomm);
MPID_Comm *comm_self_ptr, *intercomm_ptr;
MPID_Comm_get_ptr( MPI_COMM_SELF, comm_self_ptr );
mpi_errno = MPIR_Comm_accept_impl(local_port, NULL, 0, comm_self_ptr, &intercomm_ptr);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
*intercomm = intercomm_ptr->handle;
} else {
MPID_Comm *comm_self_ptr, *intercomm_ptr;
MPID_Comm_get_ptr( MPI_COMM_SELF, comm_self_ptr );
mpi_errno = MPIR_Comm_connect_impl(remote_port, NULL, 0, comm_self_ptr, &intercomm_ptr);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
*intercomm = intercomm_ptr->handle;
}
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
MPIR_Nest_decr();
mpi_errno = MPIR_Close_port_impl(local_port);
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
/* ... end of body of routine ... */
......@@ -186,7 +183,6 @@ int MPI_Comm_join(int fd, MPI_Comm *intercomm)
return mpi_errno;
fn_fail:
MPIR_Nest_decr();