Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
some forgotten consts
[simgrid.git] / src / smpi / bindings / smpi_pmpi_comm.cpp
index be80206..d8d4be3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -7,7 +7,7 @@
 
 #include "private.hpp"
 #include "smpi_comm.hpp"
-#include "smpi_process.hpp"
+#include "src/smpi/include/smpi_actor.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
 
@@ -49,6 +49,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) {
@@ -156,6 +168,24 @@ int PMPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* comm_out)
   return retval;
 }
 
+int PMPI_Comm_split_type(MPI_Comm comm, int split_type, int key, MPI_Info info, MPI_Comm *newcomm)
+{
+  int retval = 0;
+  smpi_bench_end();
+
+  if (newcomm == nullptr) {
+    retval = MPI_ERR_ARG;
+  } else if (comm == MPI_COMM_NULL) {
+    retval = MPI_ERR_COMM;
+  } else {
+    *newcomm = comm->split_type(split_type, key, info);
+    retval = MPI_SUCCESS;
+  }
+  smpi_bench_begin();
+
+  return retval;
+}
+
 int PMPI_Comm_create_group(MPI_Comm comm, MPI_Group group, int, MPI_Comm* comm_out)
 {
   int retval = 0;
@@ -191,6 +221,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);