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
add get_name for batteries. update dag_from_json to support wfformat 1.4
[simgrid.git]
/
src
/
dag
/
loaders.cpp
diff --git
a/src/dag/loaders.cpp
b/src/dag/loaders.cpp
index
f0d1826
..
57ec032
100644
(file)
--- a/
src/dag/loaders.cpp
+++ b/
src/dag/loaders.cpp
@@
-21,6
+21,11
@@
#include "dax_dtd.c"
#if SIMGRID_HAVE_JSON
#include "dax_dtd.c"
#if SIMGRID_HAVE_JSON
+// Disable implicit conversions. See https://github.com/nlohmann/json#implicit-conversions
+#ifdef JSON_USE_IMPLICIT_CONVERSIONS
+#undef JSON_USE_IMPLICIT_CONVERSIONS
+#endif
+#define JSON_USE_IMPLICIT_CONVERSIONS 0
#include <nlohmann/json.hpp>
#include <sstream>
#endif
#include <nlohmann/json.hpp>
#include <sstream>
#endif
@@
-101,14
+106,19
@@
std::vector<ActivityPtr> create_DAG_from_json(const std::string& filename)
for (auto const& task: data["workflow"]["tasks"]) {
if (task["type"] == "compute") {
for (auto const& task: data["workflow"]["tasks"]) {
if (task["type"] == "compute") {
- current = Exec::init()->set_name(task["name"])->set_flops_amount(task["runtime"]);
+ current =
+ Exec::init()->set_name(task["name"].get<std::string>())->set_flops_amount(task["runtimeInSeconds"].get<double>());
if (task.contains("machine"))
if (task.contains("machine"))
- dynamic_cast<Exec*>(current.get())->set_host(simgrid::s4u::Engine::get_instance()->host_by_name(task["machine"]));
+ dynamic_cast<Exec*>(current.get())
+ ->set_host(simgrid::s4u::Engine::get_instance()->host_by_name(task["machine"].get<std::string>()));
}
else if (task["type"] == "transfer"){
}
else if (task["type"] == "transfer"){
- current = Comm::sendto_init()->set_name(task["name"])->set_payload_size(task["bytesWritten"]);
+ current = Comm::sendto_init()
+ ->set_name(task["name"].get<std::string>())
+ ->set_payload_size(task["writtenBytes"].get<double>());
if (task.contains("machine"))
if (task.contains("machine"))
- comms_destinations[current] = simgrid::s4u::Engine::get_instance()->host_by_name(task["machine"]);
+ comms_destinations[current] =
+ simgrid::s4u::Engine::get_instance()->host_by_name(task["machine"].get<std::string>());
if (task["parents"].size() == 1) {
ActivityPtr parent_activity;
for (auto const& activity: dag) {
if (task["parents"].size() == 1) {
ActivityPtr parent_activity;
for (auto const& activity: dag) {
@@
-130,7
+140,7
@@
std::vector<ActivityPtr> create_DAG_from_json(const std::string& filename)
dag.push_back(current);
for (auto const& parent : task["parents"])
dag.push_back(current);
for (auto const& parent : task["parents"])
- successors[parent].push_back(current);
+ successors[parent
.get<std::string>()
].push_back(current);
}
// Assign successors
for (auto const& [parent, successors_list] : successors)
}
// Assign successors
for (auto const& [parent, successors_list] : successors)
@@
-146,7
+156,7
@@
std::vector<ActivityPtr> create_DAG_from_json(const std::string& filename)
// Start only Activities with dependencies solved
for (auto const& activity: dag) {
// Start only Activities with dependencies solved
for (auto const& activity: dag) {
- if (dynamic_cast<Exec*>(activity.get()) != nullptr
and
activity->dependencies_solved())
+ if (dynamic_cast<Exec*>(activity.get()) != nullptr
&&
activity->dependencies_solved())
activity->start();
}
return dag;
activity->start();
}
return dag;