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
sanitize the OOP of kernel::profile
[simgrid.git]
/
src
/
smpi
/
colls
/
smpi_coll.cpp
diff --git
a/src/smpi/colls/smpi_coll.cpp
b/src/smpi/colls/smpi_coll.cpp
index
b67212c
..
6e2a9d9
100644
(file)
--- a/
src/smpi/colls/smpi_coll.cpp
+++ b/
src/smpi/colls/smpi_coll.cpp
@@
-1,6
+1,6
@@
/* smpi_coll.c -- various optimized routing for collectives */
/* smpi_coll.c -- various optimized routing for collectives */
-/* Copyright (c) 2009-201
8
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2009-201
9
. 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. */
@@
-98,7
+98,7
@@
void Colls::set_collectives(){
if (selector_name.empty())
selector_name = "default";
if (selector_name.empty())
selector_name = "default";
- std::
map<std::string, std::function<void(std::string)>> setter_callbacks
= {
+ std::
pair<std::string, std::function<void(std::string)>> setter_callbacks[]
= {
{"gather", &Colls::set_gather}, {"allgather", &Colls::set_allgather},
{"allgatherv", &Colls::set_allgatherv}, {"allreduce", &Colls::set_allreduce},
{"alltoall", &Colls::set_alltoall}, {"alltoallv", &Colls::set_alltoallv},
{"gather", &Colls::set_gather}, {"allgather", &Colls::set_allgather},
{"allgatherv", &Colls::set_allgatherv}, {"allreduce", &Colls::set_allreduce},
{"alltoall", &Colls::set_alltoall}, {"alltoallv", &Colls::set_alltoallv},
@@
-106,26
+106,13
@@
void Colls::set_collectives(){
{"scatter", &Colls::set_scatter}, {"bcast", &Colls::set_bcast},
{"barrier", &Colls::set_barrier}};
{"scatter", &Colls::set_scatter}, {"bcast", &Colls::set_bcast},
{"barrier", &Colls::set_barrier}};
- // This only prevents code duplication
- std::function<void(std::string)> setup = [selector_name, &setter_callbacks](std::string coll) {
- std::string name = simgrid::config::get_value<std::string>(("smpi/" + coll).c_str());
+ for (auto& elem : setter_callbacks) {
+ std::string name = simgrid::config::get_value<std::string>(("smpi/" + elem.first).c_str());
if (name.empty())
name = selector_name;
if (name.empty())
name = selector_name;
- setter_callbacks[coll](name);
- };
-
- setup("gather");
- setup("allgather");
- setup("allgatherv");
- setup("allreduce");
- setup("alltoall");
- setup("alltoallv");
- setup("reduce");
- setup("reduce_scatter");
- setup("scatter");
- setup("bcast");
- setup("barrier");
+ (elem.second)(name);
+ }
}
}