From: Navarrop Date: Fri, 1 Apr 2011 11:50:27 +0000 (+0200) Subject: Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot//simgrid/simgrid X-Git-Tag: v3.6_beta2~72 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/494eca1a42ac767979d8f8ea8762040008bea41a?hp=a9f76cf5eb575de48bb6bbbd010e56d55748c83f Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot//simgrid/simgrid --- diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index aac82f0384..68c9cf996a 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -23,6 +23,7 @@ SG_BEGIN_DECL() #define MPI_THREAD_MULTIPLE 3 //FIXME: check values #define MPI_MAX_PROCESSOR_NAME 100 +#define MPI_MAX_NAME_STRING 100 #define MPI_MAX_ERROR_STRING 100 #define MPI_MAX_DATAREP_STRIN 100 #define MPI_MAX_INFO_KEY 100 @@ -208,6 +209,7 @@ MPI_CALL(XBT_PUBLIC(int), MPI_Group_range_excl, MPI_CALL(XBT_PUBLIC(int), MPI_Comm_rank, (MPI_Comm comm, int *rank)); MPI_CALL(XBT_PUBLIC(int), MPI_Comm_size, (MPI_Comm comm, int *size)); +MPI_CALL(XBT_PUBLIC(int), MPI_Comm_get_name, (MPI_Comm comm, char* name, int* len)); MPI_CALL(XBT_PUBLIC(int), MPI_Get_processor_name, (char *name, int *resultlen)); MPI_CALL(XBT_PUBLIC(int), MPI_Get_count, (MPI_Status * status, MPI_Datatype datatype, @@ -220,6 +222,7 @@ MPI_CALL(XBT_PUBLIC(int), MPI_Comm_dup, (MPI_Comm comm, MPI_Comm * newcomm)); MPI_CALL(XBT_PUBLIC(int), MPI_Comm_create, (MPI_Comm comm, MPI_Group group, MPI_Comm * newcomm)); MPI_CALL(XBT_PUBLIC(int), MPI_Comm_free, (MPI_Comm * comm)); +MPI_CALL(XBT_PUBLIC(int), MPI_Comm_disconnect, (MPI_Comm * comm)); MPI_CALL(XBT_PUBLIC(int), MPI_Comm_split, (MPI_Comm comm, int color, int key, MPI_Comm* comm_out)); MPI_CALL(XBT_PUBLIC(int), MPI_Send_init, diff --git a/src/smpi/private.h b/src/smpi/private.h index 12bf309a46..d457c767b4 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -83,6 +83,7 @@ MPI_Comm smpi_comm_new(MPI_Group group); void smpi_comm_destroy(MPI_Comm comm); MPI_Group smpi_comm_group(MPI_Comm comm); int smpi_comm_size(MPI_Comm comm); +void smpi_comm_get_name(MPI_Comm comm, char* name, int* len); int smpi_comm_rank(MPI_Comm comm); MPI_Comm smpi_comm_split(MPI_Comm comm, int color, int key); diff --git a/src/smpi/smpi_comm.c b/src/smpi/smpi_comm.c index 70267cd79e..c189c4d569 100644 --- a/src/smpi/smpi_comm.c +++ b/src/smpi/smpi_comm.c @@ -67,6 +67,16 @@ int smpi_comm_rank(MPI_Comm comm) return smpi_group_rank(smpi_comm_group(comm), smpi_process_index()); } +void smpi_comm_get_name (MPI_Comm comm, char* name, int* len) +{ + if(comm == MPI_COMM_WORLD) { + strcpy(name, "WORLD"); + *len = 5; + } else { + *len = snprintf(name, MPI_MAX_NAME_STRING, "%p", comm); + } +} + MPI_Comm smpi_comm_split(MPI_Comm comm, int color, int key) { int system_tag = 666; diff --git a/src/smpi/smpi_mpi.c b/src/smpi/smpi_mpi.c index e8dfd05570..d86fcd8c18 100644 --- a/src/smpi/smpi_mpi.c +++ b/src/smpi/smpi_mpi.c @@ -164,6 +164,11 @@ int MPI_Comm_size(MPI_Comm comm, int *size) return PMPI_Comm_size(comm, size); } +int MPI_Comm_get_name (MPI_Comm comm, char* name, int* len) +{ + return PMPI_Comm_get_name(comm, name, len); +} + int MPI_Comm_group(MPI_Comm comm, MPI_Group * group) { return PMPI_Comm_group(comm, group); @@ -189,6 +194,11 @@ int MPI_Comm_free(MPI_Comm * comm) return PMPI_Comm_free(comm); } +int MPI_Comm_disconnect(MPI_Comm * comm) +{ + return PMPI_Comm_disconnect(comm); +} + int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* comm_out) { return PMPI_Comm_split(comm, color, key, comm_out); diff --git a/src/smpi/smpi_pmpi.c b/src/smpi/smpi_pmpi.c index d229642b43..ec3da34945 100644 --- a/src/smpi/smpi_pmpi.c +++ b/src/smpi/smpi_pmpi.c @@ -649,6 +649,23 @@ int PMPI_Comm_size(MPI_Comm comm, int *size) return retval; } +int PMPI_Comm_get_name (MPI_Comm comm, char* name, int* len) +{ + int retval; + + smpi_bench_end(); + if (comm == MPI_COMM_NULL) { + retval = MPI_ERR_COMM; + } else if (name == NULL || len == NULL) { + retval = MPI_ERR_ARG; + } else { + smpi_comm_get_name(comm, name, len); + retval = MPI_SUCCESS; + } + smpi_bench_begin(); + return retval; +} + int PMPI_Comm_group(MPI_Comm comm, MPI_Group * group) { int retval; @@ -746,6 +763,25 @@ int PMPI_Comm_free(MPI_Comm * comm) return retval; } +int PMPI_Comm_disconnect(MPI_Comm * comm) +{ + /* TODO: wait until all communication in comm are done */ + int retval; + + smpi_bench_end(); + if (comm == NULL) { + retval = MPI_ERR_ARG; + } else if (*comm == MPI_COMM_NULL) { + retval = MPI_ERR_COMM; + } else { + smpi_comm_destroy(*comm); + *comm = MPI_COMM_NULL; + retval = MPI_SUCCESS; + } + smpi_bench_begin(); + return retval; +} + int PMPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* comm_out) { int retval;