Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Added one more missing MPI call.
authorPierre-Nicolas Clauss <pini@tuxfamily.org>
Thu, 31 Mar 2011 15:06:13 +0000 (17:06 +0200)
committerPierre-Nicolas Clauss <pini@tuxfamily.org>
Thu, 31 Mar 2011 15:06:13 +0000 (17:06 +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..4b5e72c 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,
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..c709e0a 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);
index d229642..0422b98 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;