1
1
This commit was SVN r2746.
Этот коммит содержится в:
Edgar Gabriel 2004-09-17 16:30:40 +00:00
родитель 65e4b61ec2
Коммит 1d16996a48
2 изменённых файлов: 17 добавлений и 29 удалений

Просмотреть файл

@ -31,13 +31,11 @@ int MPI_Comm_disconnect(MPI_Comm *comm)
FUNC_NAME); FUNC_NAME);
} }
/* disconnect means, just decrease the refcount, without calling if (MPI_COMM_WORLD == *comm || MPI_COMM_SELF == *comm ) {
attribute delete fnct. etc. (to be verified.). return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME);
}
Question: do we need a flag verifying which communicators
we are allowed to disconnect from ? E.g. what happens, (*comm)->c_coll.coll_barrier(*comm);
if we disconnect from an MPI-1 communicator derived
from MPI_COMM_WORLD ? */
OBJ_RETAIN(*comm); OBJ_RETAIN(*comm);
*comm = MPI_COMM_NULL; *comm = MPI_COMM_NULL;

Просмотреть файл

@ -31,16 +31,16 @@ static int ompi_socket_recv (int fd, char *buf, int len );
int MPI_Comm_join(int fd, MPI_Comm *intercomm) int MPI_Comm_join(int fd, MPI_Comm *intercomm)
{ {
int rc, tag; int rc, tag=OMPI_COMM_JOIN_TAG;
size_t size; size_t size;
uint32_t len, rlen; uint32_t len, rlen, llen, lrlen;
int send_first; int send_first=1;
char *rname, *name; char *rname, *name;
ompi_proc_t **myproc=NULL; ompi_proc_t **myproc=NULL;
ompi_communicator_t *newcomp; ompi_communicator_t *newcomp;
ompi_ns_cmp_bitmask_t mask; ompi_ns_cmp_bitmask_t mask;
ompi_process_name_t *port_proc_name=NULL, *port_pname=NULL; ompi_process_name_t *port_proc_name=NULL;
if ( MPI_PARAM_CHECK ) { if ( MPI_PARAM_CHECK ) {
OMPI_ERR_INIT_FINALIZE(FUNC_NAME); OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
@ -56,13 +56,14 @@ int MPI_Comm_join(int fd, MPI_Comm *intercomm)
here. */ here. */
myproc = ompi_proc_self (&size); myproc = ompi_proc_self (&size);
name = ompi_name_server.get_proc_name_string (&(myproc[0]->proc_name)); name = ompi_name_server.get_proc_name_string (&(myproc[0]->proc_name));
len = htonl(strlen(name)); llen = strlen(name)+1;
len = htonl(llen);
ompi_socket_send( fd, (char *) &len, sizeof(uint32_t)); ompi_socket_send( fd, (char *) &len, sizeof(uint32_t));
ompi_socket_recv (fd, (char *) &rlen, sizeof(uint32_t)); ompi_socket_recv (fd, (char *) &rlen, sizeof(uint32_t));
rlen = ntohl(rlen); lrlen = ntohl(rlen);
rname = (char *) malloc (rlen); rname = (char *) malloc (lrlen);
if ( NULL == rname ) { if ( NULL == rname ) {
*intercomm = MPI_COMM_NULL; *intercomm = MPI_COMM_NULL;
return MPI_ERR_INTERN; return MPI_ERR_INTERN;
@ -71,28 +72,17 @@ int MPI_Comm_join(int fd, MPI_Comm *intercomm)
/* Assumption: socket_send should not block, even if the socket /* Assumption: socket_send should not block, even if the socket
is not configured to be non-blocking, because the message length are is not configured to be non-blocking, because the message length are
so short. */ so short. */
ompi_socket_send (fd, name, len); ompi_socket_send (fd, name, llen);
ompi_socket_recv (fd, rname, rlen); ompi_socket_recv (fd, rname, lrlen);
port_pname = ompi_name_server.convert_string_to_process_name(rname); port_proc_name = ompi_name_server.convert_string_to_process_name(rname);
mask = OMPI_NS_CMP_CELLID | OMPI_NS_CMP_JOBID | OMPI_NS_CMP_VPID;
rc = ompi_name_server.compare (mask, &myproc[0]->proc_name, port_proc_name );
if ( rc > 0 ) {
send_first = 0;
}
else {
send_first = 1;
port_proc_name = port_pname;
}
rc = ompi_comm_connect_accept (MPI_COMM_SELF, 0, port_proc_name, rc = ompi_comm_connect_accept (MPI_COMM_SELF, 0, port_proc_name,
send_first, &newcomp, tag); send_first, &newcomp, tag);
free ( name ); free ( name );
free ( rname); free ( rname);
free ( port_pname ); free ( port_proc_name );
free ( myproc ); free ( myproc );
*intercomm = newcomp; *intercomm = newcomp;