X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/43f7ca1cac5ab1858e318fdd6239d0a0c3b3d893..b1f5b9489d84e72cc1c4a0b51fe3940526de890c:/src/smpi/bindings/smpi_pmpi_comm.cpp diff --git a/src/smpi/bindings/smpi_pmpi_comm.cpp b/src/smpi/bindings/smpi_pmpi_comm.cpp index f658bfe078..07a290470d 100644 --- a/src/smpi/bindings/smpi_pmpi_comm.cpp +++ b/src/smpi/bindings/smpi_pmpi_comm.cpp @@ -1,18 +1,17 @@ -/* Copyright (c) 2007-2017. 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. */ #include -#include "private.h" +#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); /* PMPI User level calls */ -extern "C" { // Obviously, the C MPI interface should use the C linkage int PMPI_Comm_rank(MPI_Comm comm, int *rank) { @@ -50,6 +49,18 @@ int PMPI_Comm_get_name (MPI_Comm comm, char* name, int* len) } } +int PMPI_Comm_set_name (MPI_Comm comm, 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) { @@ -102,7 +113,7 @@ int PMPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm * newcomm) return MPI_ERR_GROUP; } else if (newcomm == nullptr) { return MPI_ERR_ARG; - } else if(group->rank(smpi_process()->index())==MPI_UNDEFINED){ + } else if (group->rank(simgrid::s4u::this_actor::get_pid()) == MPI_UNDEFINED) { *newcomm= MPI_COMM_NULL; return MPI_SUCCESS; }else{ @@ -157,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; @@ -265,5 +294,3 @@ int PMPI_Attr_put(MPI_Comm comm, int keyval, void* attr_value) { else return comm->attr_put(keyval, attr_value); } - -}