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 "info/info.h"
|
|
|
|
#include "communicator/communicator.h"
|
2004-08-08 23:20:19 +04:00
|
|
|
#include "mca/ns/base/base.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_connect = PMPI_Comm_connect
|
|
|
|
#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-07-30 06:58:53 +04:00
|
|
|
static const char FUNC_NAME[] = "MPI_Comm_connect";
|
2004-06-23 00:21:35 +04:00
|
|
|
|
|
|
|
|
2004-01-21 03:05:46 +03:00
|
|
|
int MPI_Comm_connect(char *port_name, MPI_Info info, int root,
|
2004-06-16 05:41:01 +04:00
|
|
|
MPI_Comm comm, MPI_Comm *newcomm)
|
|
|
|
{
|
2004-08-05 20:32:13 +04:00
|
|
|
int rank, rc;
|
|
|
|
int send_first=1; /* yes, we are the active part in this game */
|
|
|
|
ompi_communicator_t *newcomp=MPI_COMM_NULL;
|
|
|
|
ompi_process_name_t *port_proc_name;
|
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-07-30 06:58:53 +04:00
|
|
|
if ( MPI_COMM_NULL == comm || ompi_comm_invalid (comm)) {
|
2004-06-16 05:41:01 +04:00
|
|
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
|
2004-06-23 00:21:35 +04:00
|
|
|
FUNC_NAME);
|
2004-07-30 06:58:53 +04:00
|
|
|
}
|
|
|
|
if ( OMPI_COMM_IS_INTER(comm)) {
|
2004-06-17 01:35:31 +04:00
|
|
|
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_COMM,
|
2004-06-23 00:21:35 +04:00
|
|
|
FUNC_NAME);
|
2004-07-30 06:58:53 +04:00
|
|
|
}
|
|
|
|
if ( 0 > root || ompi_comm_size(comm) < root ) {
|
2004-06-16 05:41:01 +04:00
|
|
|
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
|
2004-06-23 00:21:35 +04:00
|
|
|
FUNC_NAME);
|
2004-07-30 06:58:53 +04:00
|
|
|
}
|
|
|
|
if ( NULL == newcomm ) {
|
2004-06-16 05:41:01 +04:00
|
|
|
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
|
2004-06-23 00:21:35 +04:00
|
|
|
FUNC_NAME);
|
2004-07-30 06:58:53 +04:00
|
|
|
}
|
2004-06-16 05:41:01 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
rank = ompi_comm_rank ( comm );
|
|
|
|
if ( MPI_PARAM_CHECK ) {
|
|
|
|
if ( rank == root ) {
|
|
|
|
if ( NULL == port_name )
|
|
|
|
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
|
2004-06-23 00:21:35 +04:00
|
|
|
FUNC_NAME);
|
2004-06-16 05:41:01 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-05 20:32:13 +04:00
|
|
|
/* parse info object. No prefedined values for this function in MPI-2,
|
|
|
|
* so lets ignore it for the moment.
|
|
|
|
*
|
|
|
|
* if ( rank == root && MPI_INFO_NULL != info ) {
|
|
|
|
* }
|
|
|
|
*/
|
2004-06-17 01:35:31 +04:00
|
|
|
|
2004-08-05 20:32:13 +04:00
|
|
|
/*
|
|
|
|
* translate the port_name string into the according process_name_t
|
|
|
|
* structure. This functionality is currently missing from ns.
|
|
|
|
*/
|
2004-08-08 23:20:19 +04:00
|
|
|
port_proc_name = ompi_name_server.convert_string_to_process_name(port_name);
|
|
|
|
if ( NULL == port_proc_name ) {
|
|
|
|
*newcomm = MPI_COMM_NULL;
|
|
|
|
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_PORT, FUNC_NAME);
|
|
|
|
}
|
2004-08-05 20:32:13 +04:00
|
|
|
rc = ompi_comm_connect_accept (comm, root, port_proc_name, send_first,
|
|
|
|
&newcomp);
|
2004-06-17 01:35:31 +04:00
|
|
|
|
|
|
|
*newcomm = newcomp;
|
2004-08-05 20:32:13 +04:00
|
|
|
OMPI_ERRHANDLER_RETURN(rc, comm, rc, FUNC_NAME);
|
2004-01-21 03:05:46 +03:00
|
|
|
}
|