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
Merge branch 'master' into jbod
[simgrid.git]
/
src
/
smpi
/
internals
/
instr_smpi.cpp
diff --git
a/src/smpi/internals/instr_smpi.cpp
b/src/smpi/internals/instr_smpi.cpp
index
49c6ca3
..
63e8f33
100644
(file)
--- a/
src/smpi/internals/instr_smpi.cpp
+++ b/
src/smpi/internals/instr_smpi.cpp
@@
-1,22
+1,20
@@
-/* Copyright (c) 2010-202
1
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2010-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. */
#include "private.hpp"
/* 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 "private.hpp"
-#include <boost/algorithm/string.hpp>
+#include "src/simgrid/sg_config.hpp"
+#include "src/smpi/include/smpi_actor.hpp"
+#include <simgrid/host.h>
#include <simgrid/s4u/Actor.hpp>
#include <simgrid/s4u/Actor.hpp>
-#include <cctype>
-#include <cstdarg>
-#include <cwchar>
-#include <deque>
-#include <simgrid/sg_config.hpp>
#include <simgrid/s4u/Host.hpp>
#include <simgrid/s4u/Host.hpp>
+
+#include <boost/algorithm/string.hpp>
+#include <deque>
#include <string>
#include <vector>
#include <string>
#include <vector>
-#include "src/smpi/include/smpi_actor.hpp"
-
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_smpi, instr, "Tracing SMPI");
static std::unordered_map<std::string, std::deque<std::string>> keys;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_smpi, instr, "Tracing SMPI");
static std::unordered_map<std::string, std::deque<std::string>> keys;
@@
-88,20
+86,20
@@
static const char* instr_find_color(const char* c_state)
if (smpi_colors.find(state) != smpi_colors.end()) { // Exact match in the map?
return smpi_colors.find(state)->second.c_str();
}
if (smpi_colors.find(state) != smpi_colors.end()) { // Exact match in the map?
return smpi_colors.find(state)->second.c_str();
}
- for (const auto&
pair
: smpi_colors) { // Is an entry of our map a substring of this state name?
- if (st
d::strstr(state.c_str(), pair.first.c_str()) != nullptr
)
- return
pair.second
.c_str();
+ for (const auto&
[smpi_state, color]
: smpi_colors) { // Is an entry of our map a substring of this state name?
+ if (st
ate.find(smpi_state) != std::string::npos
)
+ return
color
.c_str();
}
return "0.5 0.5 0.5"; // Just in case we find nothing in the map ...
}
}
return "0.5 0.5 0.5"; // Just in case we find nothing in the map ...
}
-XBT_PRIVATE simgrid::instr::Container* smpi_container(
int rank
)
+XBT_PRIVATE simgrid::instr::Container* smpi_container(
aid_t pid
)
{
{
- return simgrid::instr::Container::by_name(
std::string("rank-") + std::to_string(rank
));
+ return simgrid::instr::Container::by_name(
"rank-" + std::to_string(pid
));
}
}
-static std::string TRACE_smpi_put_key(
int src, in
t dst, int tag, int send)
+static std::string TRACE_smpi_put_key(
aid_t src, aid_
t dst, int tag, int send)
{
//generate the key
static unsigned long long counter = 0;
{
//generate the key
static unsigned long long counter = 0;
@@
-117,13
+115,12
@@
static std::string TRACE_smpi_put_key(int src, int dst, int tag, int send)
return key;
}
return key;
}
-static std::string TRACE_smpi_get_key(
int src, in
t dst, int tag, int send)
+static std::string TRACE_smpi_get_key(
aid_t src, aid_
t dst, int tag, int send)
{
std::string key;
std::string aux = std::to_string(src) + "#" + std::to_string(dst) + "#" + std::to_string(tag) + "#" +
std::to_string(send == 1 ? 0 : 1);
{
std::string key;
std::string aux = std::to_string(src) + "#" + std::to_string(dst) + "#" + std::to_string(tag) + "#" +
std::to_string(send == 1 ? 0 : 1);
- auto it = keys.find(aux);
- if (it == keys.end()) {
+ if (auto it = keys.find(aux); it == keys.end()) {
// first posted
key = TRACE_smpi_put_key(src, dst, tag, send);
} else {
// first posted
key = TRACE_smpi_put_key(src, dst, tag, send);
} else {
@@
-135,27
+132,27
@@
static std::string TRACE_smpi_get_key(int src, int dst, int tag, int send)
return key;
}
return key;
}
-void TRACE_smpi_setup_container(
int rank
, const_sg_host_t host)
+void TRACE_smpi_setup_container(
aid_t pid
, const_sg_host_t host)
{
{
- auto*
father
= simgrid::instr::Container::get_root();
+ auto*
parent
= simgrid::instr::Container::get_root();
if (TRACE_smpi_is_grouped()) {
if (TRACE_smpi_is_grouped()) {
-
father
= simgrid::instr::Container::by_name_or_null(host->get_name());
- xbt_assert(
father != nullptr, "Could not find a parent for mpi rank 'rank-%d' at function %s", rank
, __func__);
+
parent
= simgrid::instr::Container::by_name_or_null(host->get_name());
+ xbt_assert(
parent != nullptr, "Could not find a parent for mpi rank 'rank-%ld' at function %s", pid
, __func__);
}
}
-
father->create_child(std::string("rank-") + std::to_string(rank
), "MPI"); // This container is of type MPI
+
parent->create_child("rank-" + std::to_string(pid
), "MPI"); // This container is of type MPI
}
}
-void TRACE_smpi_init(
int rank
, const std::string& calling_func)
+void TRACE_smpi_init(
aid_t pid
, const std::string& calling_func)
{
if (not TRACE_smpi_is_enabled())
return;
{
if (not TRACE_smpi_is_enabled())
return;
-
auto
self = simgrid::s4u::Actor::self();
+
const auto*
self = simgrid::s4u::Actor::self();
- TRACE_smpi_setup_container(
rank
, sg_host_self());
+ TRACE_smpi_setup_container(
pid
, sg_host_self());
simgrid::s4u::this_actor::on_exit([self](bool) { smpi_container(self->get_pid())->remove_from_parent(); });
simgrid::s4u::this_actor::on_exit([self](bool) { smpi_container(self->get_pid())->remove_from_parent(); });
- simgrid::instr::StateType* state = smpi_container(
rank
)->get_state("MPI_STATE");
+ simgrid::instr::StateType* state = smpi_container(
pid
)->get_state("MPI_STATE");
state->add_entity_value(calling_func, instr_find_color(calling_func.c_str()));
state->push_event(calling_func, new simgrid::instr::NoOpTIData("init"));
state->add_entity_value(calling_func, instr_find_color(calling_func.c_str()));
state->push_event(calling_func, new simgrid::instr::NoOpTIData("init"));
@@
-166,69
+163,69
@@
void TRACE_smpi_init(int rank, const std::string& calling_func)
state->add_entity_value("sleeping", instr_find_color("sleeping"));
#if HAVE_PAPI
state->add_entity_value("sleeping", instr_find_color("sleeping"));
#if HAVE_PAPI
- const simgrid::instr::Container* container = smpi_container(
rank
);
+ const simgrid::instr::Container* container = smpi_container(
pid
);
papi_counter_t counters = smpi_process()->papi_counters();
papi_counter_t counters = smpi_process()->papi_counters();
- for (auto const&
it
: counters) {
+ for (auto const&
[counter, _]
: counters) {
/**
* Check whether this variable already exists or not. Otherwise, it will be created
* multiple times but only the last one would be used...
*/
/**
* Check whether this variable already exists or not. Otherwise, it will be created
* multiple times but only the last one would be used...
*/
- container->
type_->by_name_or_create(it.first
, "");
+ container->
get_type()->by_name_or_create(counter
, "");
}
#endif
}
}
#endif
}
-void TRACE_smpi_sleeping_in(
int rank
, double duration)
+void TRACE_smpi_sleeping_in(
aid_t pid
, double duration)
{
if (TRACE_smpi_is_enabled() && TRACE_smpi_is_sleeping())
{
if (TRACE_smpi_is_enabled() && TRACE_smpi_is_sleeping())
- smpi_container(
rank
)
+ smpi_container(
pid
)
->get_state("MPI_STATE")
->push_event("sleeping", new simgrid::instr::CpuTIData("sleep", duration));
}
->get_state("MPI_STATE")
->push_event("sleeping", new simgrid::instr::CpuTIData("sleep", duration));
}
-void TRACE_smpi_sleeping_out(
int rank
)
+void TRACE_smpi_sleeping_out(
aid_t pid
)
{
if (TRACE_smpi_is_enabled() && TRACE_smpi_is_sleeping())
{
if (TRACE_smpi_is_enabled() && TRACE_smpi_is_sleeping())
- smpi_container(
rank
)->get_state("MPI_STATE")->pop_event();
+ smpi_container(
pid
)->get_state("MPI_STATE")->pop_event();
}
}
-void TRACE_smpi_comm_in(
int rank
, const char* operation, simgrid::instr::TIData* extra)
+void TRACE_smpi_comm_in(
aid_t pid
, const char* operation, simgrid::instr::TIData* extra)
{
if (not TRACE_smpi_is_enabled()) {
delete extra;
return;
}
{
if (not TRACE_smpi_is_enabled()) {
delete extra;
return;
}
- simgrid::instr::StateType* state = smpi_container(
rank
)->get_state("MPI_STATE");
+ simgrid::instr::StateType* state = smpi_container(
pid
)->get_state("MPI_STATE");
state->add_entity_value(operation, instr_find_color(operation));
state->push_event(operation, extra);
}
state->add_entity_value(operation, instr_find_color(operation));
state->push_event(operation, extra);
}
-void TRACE_smpi_comm_out(
int rank
)
+void TRACE_smpi_comm_out(
aid_t pid
)
{
if (TRACE_smpi_is_enabled())
{
if (TRACE_smpi_is_enabled())
- smpi_container(
rank
)->get_state("MPI_STATE")->pop_event();
+ smpi_container(
pid
)->get_state("MPI_STATE")->pop_event();
}
}
-void TRACE_smpi_send(
int rank, int src, int dst, int tag, in
t size)
+void TRACE_smpi_send(
aid_t rank, aid_t src, aid_t dst, int tag, size_
t size)
{
if (not TRACE_smpi_is_enabled())
return;
std::string key = TRACE_smpi_get_key(src, dst, tag, 1);
{
if (not TRACE_smpi_is_enabled())
return;
std::string key = TRACE_smpi_get_key(src, dst, tag, 1);
- XBT_DEBUG("Send tracing from %
d to %
d, tag %d, with key %s", src, dst, tag, key.c_str());
+ XBT_DEBUG("Send tracing from %
ld to %l
d, tag %d, with key %s", src, dst, tag, key.c_str());
simgrid::instr::Container::get_root()->get_link("MPI_LINK")->start_event(smpi_container(rank), "PTP", key, size);
}
simgrid::instr::Container::get_root()->get_link("MPI_LINK")->start_event(smpi_container(rank), "PTP", key, size);
}
-void TRACE_smpi_recv(
int src, in
t dst, int tag)
+void TRACE_smpi_recv(
aid_t src, aid_
t dst, int tag)
{
if (not TRACE_smpi_is_enabled())
return;
std::string key = TRACE_smpi_get_key(src, dst, tag, 0);
{
if (not TRACE_smpi_is_enabled())
return;
std::string key = TRACE_smpi_get_key(src, dst, tag, 0);
- XBT_DEBUG("Recv tracing from %
d to %
d, tag %d, with key %s", src, dst, tag, key.c_str());
+ XBT_DEBUG("Recv tracing from %
ld to %l
d, tag %d, with key %s", src, dst, tag, key.c_str());
simgrid::instr::Container::get_root()->get_link("MPI_LINK")->end_event(smpi_container(dst), "PTP", key);
}
simgrid::instr::Container::get_root()->get_link("MPI_LINK")->end_event(smpi_container(dst), "PTP", key);
}