2004-01-21 03:05:46 +03:00
|
|
|
/*
|
|
|
|
* $HEADERS$
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-01-21 03:05:46 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "mpi.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "mpi/c/bindings.h"
|
2004-06-16 05:41:01 +04:00
|
|
|
#include "runtime/runtime.h"
|
|
|
|
#include "communicator/communicator.h"
|
2004-01-21 03:05:46 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
2004-01-21 03:05:46 +03:00
|
|
|
#pragma weak MPI_Comm_join = PMPI_Comm_join
|
|
|
|
#endif
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#if OMPI_PROFILING_DEFINES
|
2004-04-20 22:50:43 +04:00
|
|
|
#include "mpi/c/profile/defines.h"
|
|
|
|
#endif
|
|
|
|
|
2004-06-23 00:21:35 +04:00
|
|
|
static char FUNC_NAME[] = "MPI_Comm_join";
|
|
|
|
|
|
|
|
|
2004-06-16 05:41:01 +04:00
|
|
|
int MPI_Comm_join(int fd, MPI_Comm *intercomm)
|
|
|
|
{
|
2004-06-17 02:44:56 +04:00
|
|
|
int rc;
|
|
|
|
ompi_proc_t rproc;
|
|
|
|
uint32_t lleader=0; /* OOB contact information of our root */
|
2004-06-17 01:35:31 +04:00
|
|
|
ompi_communicator_t *comp, *newcomp;
|
|
|
|
|
|
|
|
comp = (ompi_communicator_t *)MPI_COMM_SELF;
|
|
|
|
|
2004-06-16 05:41:01 +04:00
|
|
|
if ( MPI_PARAM_CHECK ) {
|
2004-06-23 00:21:35 +04:00
|
|
|
OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
|
2004-06-18 23:02:52 +04:00
|
|
|
|
2004-06-16 05:41:01 +04:00
|
|
|
if ( NULL == intercomm )
|
|
|
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
|
2004-06-23 00:21:35 +04:00
|
|
|
FUNC_NAME);
|
2004-06-16 05:41:01 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* sendrecv OOB-name (port-name) through the socket connection.
|
|
|
|
Need to determine somehow how to avoid a potential deadlock
|
|
|
|
here. *o/
|
|
|
|
/* if proc unknown, set up the proc-structure */
|
2004-06-17 01:35:31 +04:00
|
|
|
|
2004-06-16 05:41:01 +04:00
|
|
|
/* setup the intercomm-structure using ompi_comm_set (); */
|
2004-06-17 01:35:31 +04:00
|
|
|
newcomp = ompi_comm_set ( comp, /* old comm */
|
|
|
|
comp->c_local_group->grp_proc_count, /* local_size */
|
|
|
|
comp->c_local_group->grp_proc_pointers, /* local_procs*/
|
|
|
|
1, /* remote_size */
|
2004-06-17 02:44:56 +04:00
|
|
|
&rproc, /* remote_procs */
|
2004-06-17 01:35:31 +04:00
|
|
|
NULL, /* attrs */
|
|
|
|
comp->error_handler, /* error handler */
|
|
|
|
NULL, /* coll module */
|
|
|
|
NULL /* topo module */
|
|
|
|
);
|
|
|
|
|
2004-06-17 02:44:56 +04:00
|
|
|
/* setup comm_cid */
|
|
|
|
rc = ompi_comm_nextcid ( newcomp, /* new comm */
|
|
|
|
comp, /* old comm */
|
|
|
|
NULL, /* bridge comm */
|
|
|
|
&lleader, /* local leader */
|
|
|
|
&rproc, /* remote_leader */
|
|
|
|
OMPI_COMM_CID_INTRA_OOB); /* mode */
|
|
|
|
if ( OMPI_SUCCESS != rc ) {
|
2004-06-23 00:21:35 +04:00
|
|
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_SELF, rc, FUNC_NAME);
|
2004-06-17 02:44:56 +04:00
|
|
|
}
|
2004-06-17 01:35:31 +04:00
|
|
|
|
|
|
|
|
2004-06-16 05:41:01 +04:00
|
|
|
/* PROBLEM: do we have to re-start some low level stuff
|
|
|
|
to enable the usage of fast communication devices
|
|
|
|
between the two worlds ? */
|
|
|
|
|
2004-06-17 01:35:31 +04:00
|
|
|
*intercomm = newcomp;
|
2004-01-21 03:05:46 +03:00
|
|
|
return MPI_SUCCESS;
|
|
|
|
}
|