Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot//simgrid/simgrid
authorNavarrop <Pierre.Navarro@imag.fr>
Fri, 1 Apr 2011 11:50:27 +0000 (13:50 +0200)
committerNavarrop <Pierre.Navarro@imag.fr>
Fri, 1 Apr 2011 11:50:27 +0000 (13:50 +0200)
include/smpi/smpi.h
src/smpi/private.h
src/smpi/smpi_comm.c
src/smpi/smpi_mpi.c
src/smpi/smpi_pmpi.c

index aac82f0..68c9cf9 100644 (file)
@@ -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,
index 12bf309..d457c76 100644 (file)
@@ -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);
 
index 70267cd..c189c4d 100644 (file)
@@ -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;
index e8dfd05..d86fcd8 100644 (file)
@@ -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);
index d229642..ec3da34 100644 (file)
@@ -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;