Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cleanup dup_with_info to avoid leaking in some cases
[simgrid.git] / src / smpi / bindings / smpi_pmpi_comm.cpp
index 8916ec9..7291ed2 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "private.hpp"
 #include "smpi_comm.hpp"
+#include "smpi_info.hpp"
 #include "src/smpi/include/smpi_actor.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
@@ -49,6 +50,18 @@ int PMPI_Comm_get_name (MPI_Comm comm, char* name, int* len)
   }
 }
 
+int PMPI_Comm_set_name (MPI_Comm comm, const char* name)
+{
+  if (comm == MPI_COMM_NULL)  {
+    return MPI_ERR_COMM;
+  } else if (name == nullptr)  {
+    return MPI_ERR_ARG;
+  } else {
+    comm->set_name(name);
+    return MPI_SUCCESS;
+  }
+}
+
 int PMPI_Comm_group(MPI_Comm comm, MPI_Group * group)
 {
   if (comm == MPI_COMM_NULL) {
@@ -93,6 +106,18 @@ int PMPI_Comm_dup(MPI_Comm comm, MPI_Comm * newcomm)
   }
 }
 
+int PMPI_Comm_dup_with_info(MPI_Comm comm, MPI_Info info, MPI_Comm * newcomm)
+{
+  if (comm == MPI_COMM_NULL) {
+    return MPI_ERR_COMM;
+  } else if (newcomm == nullptr) {
+    return MPI_ERR_ARG;
+  } else {
+    comm->dup_with_info(info, newcomm);
+    return MPI_SUCCESS;
+  }
+}
+
 int PMPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm * newcomm)
 {
   if (comm == MPI_COMM_NULL) {
@@ -209,6 +234,26 @@ int PMPI_Comm_set_attr (MPI_Comm comm, int comm_keyval, void *attribute_val)
   return PMPI_Attr_put(comm, comm_keyval, attribute_val);
 }
 
+int PMPI_Comm_get_info(MPI_Comm comm, MPI_Info* info)
+{
+  if (comm == MPI_COMM_NULL)  {
+    return MPI_ERR_WIN;
+  } else {
+    *info = comm->info();
+    return MPI_SUCCESS;
+  }
+}
+
+int PMPI_Comm_set_info(MPI_Comm  comm, MPI_Info info)
+{
+  if (comm == MPI_COMM_NULL)  {
+    return MPI_ERR_TYPE;
+  } else {
+    comm->set_info(info);
+    return MPI_SUCCESS;
+  }
+}
+
 int PMPI_Comm_delete_attr (MPI_Comm comm, int comm_keyval)
 {
   return PMPI_Attr_delete(comm, comm_keyval);