A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
MPI_UNIVERSE_SIZE now initialized to the total amount of hosts in the platform
[simgrid.git]
/
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 85dd53aa74154a1058dd80c7c349f5a44cee02cf..c30dfda3e97bf0beba081f94727af55aa42c7002 100644
(file)
--- a/
src/smpi/bindings/smpi_pmpi_comm.cpp
+++ b/
src/smpi/bindings/smpi_pmpi_comm.cpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2007-202
0
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-202
3
. 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. */
/* 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. */
@@
-6,9
+6,10
@@
#include <climits>
#include "private.hpp"
#include <climits>
#include "private.hpp"
+#include "simgrid/s4u/Engine.hpp"
#include "smpi_comm.hpp"
#include "smpi_comm.hpp"
-#include "smpi_info.hpp"
#include "smpi_errhandler.hpp"
#include "smpi_errhandler.hpp"
+#include "smpi_info.hpp"
#include "src/smpi/include/smpi_actor.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
#include "src/smpi/include/smpi_actor.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
@@
-108,6
+109,7
@@
int PMPI_Comm_free(MPI_Comm * comm)
{
CHECK_NULL(1, MPI_ERR_ARG, comm)
CHECK_COMM2(1, *comm)
{
CHECK_NULL(1, MPI_ERR_ARG, comm)
CHECK_COMM2(1, *comm)
+ CHECK_MPI_NULL(1, MPI_COMM_WORLD, MPI_ERR_COMM, *comm)
simgrid::smpi::Comm::destroy(*comm);
*comm = MPI_COMM_NULL;
return MPI_SUCCESS;
simgrid::smpi::Comm::destroy(*comm);
*comm = MPI_COMM_NULL;
return MPI_SUCCESS;
@@
-127,9
+129,11
@@
int PMPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* comm_out)
{
CHECK_NULL(4, MPI_ERR_ARG, comm_out)
CHECK_COMM2(1, comm)
{
CHECK_NULL(4, MPI_ERR_ARG, comm_out)
CHECK_COMM2(1, comm)
- smpi_bench_end();
+ CHECK_COLLECTIVE(comm, __func__)
+ if( color != MPI_UNDEFINED)//we use a negative value for MPI_UNDEFINED
+ CHECK_NEGATIVE(3, MPI_ERR_ARG, color)
+ const SmpiBenchGuard suspend_bench;
*comm_out = comm->split(color, key);
*comm_out = comm->split(color, key);
- smpi_bench_begin();
return MPI_SUCCESS;
}
return MPI_SUCCESS;
}
@@
-137,9
+141,9
@@
int PMPI_Comm_split_type(MPI_Comm comm, int split_type, int key, MPI_Info info,
{
CHECK_COMM(1)
CHECK_NULL(5, MPI_ERR_ARG, newcomm)
{
CHECK_COMM(1)
CHECK_NULL(5, MPI_ERR_ARG, newcomm)
- smpi_bench_end();
+ CHECK_COLLECTIVE(comm, __func__)
+ const SmpiBenchGuard suspend_bench;
*newcomm = comm->split_type(split_type, key, info);
*newcomm = comm->split_type(split_type, key, info);
- smpi_bench_begin();
return MPI_SUCCESS;
}
return MPI_SUCCESS;
}
@@
-148,16
+152,15
@@
int PMPI_Comm_create_group(MPI_Comm comm, MPI_Group group, int, MPI_Comm* comm_o
CHECK_COMM(1)
CHECK_GROUP(2, group)
CHECK_NULL(5, MPI_ERR_ARG, comm_out)
CHECK_COMM(1)
CHECK_GROUP(2, group)
CHECK_NULL(5, MPI_ERR_ARG, comm_out)
-
smpi_bench_end()
;
+
const SmpiBenchGuard suspend_bench
;
int retval = MPI_Comm_create(comm, group, comm_out);
int retval = MPI_Comm_create(comm, group, comm_out);
- smpi_bench_begin();
return retval;
}
MPI_Comm PMPI_Comm_f2c(MPI_Fint comm){
if(comm==-1)
return MPI_COMM_NULL;
return retval;
}
MPI_Comm PMPI_Comm_f2c(MPI_Fint comm){
if(comm==-1)
return MPI_COMM_NULL;
- return s
tatic_cast<MPI_Comm>(simgrid::smpi::Comm::f2c(comm)
);
+ return s
imgrid::smpi::Comm::f2c(comm
);
}
MPI_Fint PMPI_Comm_c2f(MPI_Comm comm){
}
MPI_Fint PMPI_Comm_c2f(MPI_Comm comm){
@@
-180,7
+183,7
@@
int PMPI_Comm_get_info(MPI_Comm comm, MPI_Info* info)
{
CHECK_COMM(1)
CHECK_NULL(2, MPI_ERR_ARG, info)
{
CHECK_COMM(1)
CHECK_NULL(2, MPI_ERR_ARG, info)
- *info =
comm->info(
);
+ *info =
new simgrid::smpi::Info(comm->info()
);
return MPI_SUCCESS;
}
return MPI_SUCCESS;
}
@@
-206,8
+209,18
@@
int PMPI_Comm_free_keyval(int* keyval) {
return PMPI_Keyval_free(keyval);
}
return PMPI_Keyval_free(keyval);
}
+int PMPI_Comm_test_inter(MPI_Comm comm, int* flag){
+ CHECK_COMM(1)
+
+ if(flag == nullptr)
+ return MPI_ERR_ARG;
+ *flag=false;
+ return MPI_SUCCESS;
+}
+
int PMPI_Attr_delete(MPI_Comm comm, int keyval) {
CHECK_COMM(1)
int PMPI_Attr_delete(MPI_Comm comm, int keyval) {
CHECK_COMM(1)
+ CHECK_VAL(2, MPI_KEYVAL_INVALID, MPI_ERR_KEYVAL, keyval)
if(keyval == MPI_TAG_UB||keyval == MPI_HOST||keyval == MPI_IO ||keyval == MPI_WTIME_IS_GLOBAL||keyval == MPI_APPNUM
||keyval == MPI_UNIVERSE_SIZE||keyval == MPI_LASTUSEDCODE)
return MPI_ERR_ARG;
if(keyval == MPI_TAG_UB||keyval == MPI_HOST||keyval == MPI_IO ||keyval == MPI_WTIME_IS_GLOBAL||keyval == MPI_APPNUM
||keyval == MPI_UNIVERSE_SIZE||keyval == MPI_LASTUSEDCODE)
return MPI_ERR_ARG;
@@
-225,6
+238,7
@@
int PMPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) {
CHECK_NULL(4, MPI_ERR_ARG, flag)
*flag = 0;
CHECK_COMM(1)
CHECK_NULL(4, MPI_ERR_ARG, flag)
*flag = 0;
CHECK_COMM(1)
+ CHECK_VAL(2, MPI_KEYVAL_INVALID, MPI_ERR_KEYVAL, keyval)
switch (keyval) {
case MPI_HOST:
switch (keyval) {
case MPI_HOST:
@@
-235,7
+249,7
@@
int PMPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) {
return MPI_SUCCESS;
case MPI_UNIVERSE_SIZE:
*flag = 1;
return MPI_SUCCESS;
case MPI_UNIVERSE_SIZE:
*flag = 1;
- universe_size = s
mpi_get_universe_size
();
+ universe_size = s
imgrid::s4u::Engine::get_instance()->get_host_count
();
*static_cast<int**>(attr_value) = &universe_size;
return MPI_SUCCESS;
case MPI_LASTUSEDCODE:
*static_cast<int**>(attr_value) = &universe_size;
return MPI_SUCCESS;
case MPI_LASTUSEDCODE:
@@
-257,6
+271,7
@@
int PMPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) {
int PMPI_Attr_put(MPI_Comm comm, int keyval, void* attr_value) {
CHECK_COMM(1)
int PMPI_Attr_put(MPI_Comm comm, int keyval, void* attr_value) {
CHECK_COMM(1)
+ CHECK_VAL(2, MPI_KEYVAL_INVALID, MPI_ERR_KEYVAL, keyval)
if(keyval == MPI_TAG_UB||keyval == MPI_HOST||keyval == MPI_IO ||keyval == MPI_WTIME_IS_GLOBAL||keyval == MPI_APPNUM
||keyval == MPI_UNIVERSE_SIZE||keyval == MPI_LASTUSEDCODE)
return MPI_ERR_ARG;
if(keyval == MPI_TAG_UB||keyval == MPI_HOST||keyval == MPI_IO ||keyval == MPI_WTIME_IS_GLOBAL||keyval == MPI_APPNUM
||keyval == MPI_UNIVERSE_SIZE||keyval == MPI_LASTUSEDCODE)
return MPI_ERR_ARG;
@@
-266,13
+281,16
@@
int PMPI_Attr_put(MPI_Comm comm, int keyval, void* attr_value) {
int PMPI_Errhandler_free(MPI_Errhandler* errhandler){
CHECK_NULL(1, MPI_ERR_ARG, errhandler)
int PMPI_Errhandler_free(MPI_Errhandler* errhandler){
CHECK_NULL(1, MPI_ERR_ARG, errhandler)
+ CHECK_MPI_NULL(1, MPI_ERRHANDLER_NULL, MPI_ERR_ARG, *errhandler)
simgrid::smpi::Errhandler::unref(*errhandler);
simgrid::smpi::Errhandler::unref(*errhandler);
+ *errhandler = MPI_ERRHANDLER_NULL;
return MPI_SUCCESS;
}
int PMPI_Errhandler_create(MPI_Handler_function* function, MPI_Errhandler* errhandler){
CHECK_NULL(2, MPI_ERR_ARG, errhandler)
*errhandler=new simgrid::smpi::Errhandler(function);
return MPI_SUCCESS;
}
int PMPI_Errhandler_create(MPI_Handler_function* function, MPI_Errhandler* errhandler){
CHECK_NULL(2, MPI_ERR_ARG, errhandler)
*errhandler=new simgrid::smpi::Errhandler(function);
+ (*errhandler)->add_f();
return MPI_SUCCESS;
}
return MPI_SUCCESS;
}
@@
-298,6
+316,18
@@
int PMPI_Comm_call_errhandler(MPI_Comm comm,int errorcode){
return MPI_SUCCESS;
}
return MPI_SUCCESS;
}
+MPI_Errhandler PMPI_Errhandler_f2c(MPI_Fint errhan){
+ if(errhan==-1)
+ return MPI_ERRHANDLER_NULL;
+ return simgrid::smpi::Errhandler::f2c(errhan);
+}
+
+MPI_Fint PMPI_Errhandler_c2f(MPI_Errhandler errhan){
+ if(errhan==MPI_ERRHANDLER_NULL)
+ return -1;
+ return errhan->c2f();
+}
+
int PMPI_Comm_create_errhandler( MPI_Comm_errhandler_fn *function, MPI_Errhandler *errhandler){
return MPI_Errhandler_create(function, errhandler);
}
int PMPI_Comm_create_errhandler( MPI_Comm_errhandler_fn *function, MPI_Errhandler *errhandler){
return MPI_Errhandler_create(function, errhandler);
}