#include <simgrid/s4u/forward.hpp>
namespace simgrid {
+namespace kernel {
+class EngineImpl;
+}
namespace s4u {
/** @brief Simulation engine
*
});
}
+ simgrid::kernel::EngineImpl* pimpl;
+
private:
static s4u::Engine *instance_;
};
SG_BEGIN_DECL()
+// FIXME: this header file should die
+
XBT_PUBLIC_DATA(int) SIMIX_STORAGE_LEVEL; //Simix storage level
XBT_PUBLIC_DATA(xbt_lib_t) as_router_lib;
--- /dev/null
+/* Copyright (c) 2016. 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 "src/kernel/EngineImpl.hpp"
+#include "src/kernel/routing/AsImpl.hpp"
+#include <simgrid/s4u/host.hpp>
+
+namespace simgrid {
+namespace kernel {
+
+EngineImpl::EngineImpl()
+{
+}
+EngineImpl::~EngineImpl()
+{
+ delete rootAs_;
+}
+}
+}
--- /dev/null
+/* Copyright (c) 2016. 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 <simgrid/s4u/forward.hpp>
+#include <xbt/dict.h>
+
+namespace simgrid {
+namespace kernel {
+namespace routing {
+class AsImpl;
+}
+
+class EngineImpl {
+public:
+ EngineImpl();
+ virtual ~EngineImpl();
+ kernel::routing::AsImpl* rootAs_ = nullptr;
+
+protected:
+ friend simgrid::s4u::Engine;
+};
+}
+}
#include "simgrid/s4u/engine.hpp"
#include "simgrid/s4u/Mailbox.hpp"
#include "simgrid/s4u/storage.hpp"
+#include "simgrid/simix.h"
+#include "src/kernel/EngineImpl.hpp"
#include "surf/surf.h" // routing_platf. FIXME:KILLME. SOON
#include "src/surf/surf_routing.hpp" // routing_platf. FIXME:KILLME. SOON
Engine::Engine(int *argc, char **argv) {
xbt_assert(s4u::Engine::instance_ == nullptr, "It is currently forbidden to create more than one instance of s4u::Engine");
s4u::Engine::instance_ = this;
+ pimpl = new kernel::EngineImpl();
TRACE_global_init(argc, argv);
SIMIX_global_init(argc, argv);
s4u::As *Engine::rootAs()
{
return routing_platf->root_; // FIXME: get the root into the Engine directly (and kill the platf)
+ // return pimpl->rootAs_;
}
static s4u::As *asByNameRecursive(s4u::As *current, const char *name)
break;
}
-
- if (current_routing == nullptr && routing_platf->root_ == nullptr) { /* it is the first one */
+ if (current_routing == nullptr) { /* it is the first one */
+ xbt_assert(routing_platf->root_ == nullptr, "All defined components must belong to a AS");
routing_platf->root_ = new_as;
- } else if (current_routing != nullptr && routing_platf->root_ != nullptr) {
+ } else {
/* set the father behavior */
if (current_routing->hierarchy_ == simgrid::kernel::routing::AsImpl::RoutingMode::unset)
current_routing->hierarchy_ = simgrid::kernel::routing::AsImpl::RoutingMode::recursive;
/* add to the sons dictionary */
xbt_dict_set(current_routing->children(), AS->id, (void *) new_as, nullptr);
-
- } else {
- THROWF(arg_error, 0, "All defined components must belong to a AS");
}
/* set the new current component of the tree */
int xbt_lib_add_level(xbt_lib_t lib, void_f_pvoid_t free_f)
{
XBT_DEBUG("xbt_lib_add_level");
- xbt_assert(xbt_dict_is_empty(lib->dict), "Lib is not empty, cannot add a level");
+ xbt_assert(xbt_dict_is_empty(lib->dict), "Lib is not empty (size: %u), cannot add a level", xbt_dict_size(lib->dict));
lib->free_f = xbt_realloc(lib->free_f, sizeof(void_f_pvoid_t) * (lib->levels + 1));
lib->free_f[lib->levels] = free_f;
return lib->levels++;
sg_host_t host1, host2;
for (unsigned int it_src = 0; it_src < totalHosts; it_src++) { // Routes from host
host1 = hosts[it_src];
- value1 = sg_host_by_name(host1->name().c_str())->pimpl_netcard;
+ value1 = host1->pimpl_netcard;
for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
host2 = hosts[it_dst];
std::vector<Link*> *route = new std::vector<Link*>();
value2 = host2->pimpl_netcard;
- routing_platf->getRouteAndLatency(value1, value2, route,nullptr);
+ simgrid::kernel::routing::AsImpl::getGlobalRoute(value1, value2, route, nullptr);
if (! route->empty()){
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->name().c_str(), host2->name().c_str());
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->cname(), host2->cname());
for (auto link: *route)
std::printf("<link_ctn id=\"%s\"/>",link->getName());
std::printf("\n </route>\n");
xbt_lib_foreach(as_router_lib, cursor_dst, dst, value2){ //to router
value2 = (sg_netcard_t)xbt_lib_get_or_null(as_router_lib,dst,ROUTING_ASR_LEVEL);
if(value2->isRouter()){
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->name().c_str(), dst);
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->cname(), dst);
std::vector<Link*> *route = new std::vector<Link*>();
- routing_platf->getRouteAndLatency((sg_netcard_t)value1,(sg_netcard_t)value2,route,nullptr);
+ simgrid::kernel::routing::AsImpl::getGlobalRoute(value1, value2, route, nullptr);
for (auto link : *route)
std::printf("<link_ctn id=\"%s\"/>",link->getName());
delete route;
if(value2->isRouter()){
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", src, dst);
std::vector<Link*> *route = new std::vector<Link*>();
- routing_platf->getRouteAndLatency((sg_netcard_t)value1,(sg_netcard_t)value2,route,nullptr);
+ simgrid::kernel::routing::AsImpl::getGlobalRoute(value1, value2, route, nullptr);
for(auto link :*route)
std::printf("<link_ctn id=\"%s\"/>",link->getName());
delete route;
}
for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
host2 = hosts[it_dst];
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ",src, host2->name().c_str());
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", src, host2->cname());
std::vector<Link*> *route = new std::vector<Link*>();
value2 = host2->pimpl_netcard;
- routing_platf->getRouteAndLatency((sg_netcard_t)value1,(sg_netcard_t)value2,route, nullptr);
+ simgrid::kernel::routing::AsImpl::getGlobalRoute(value1, value2, route, nullptr);
for(auto link : *route)
std::printf("<link_ctn id=\"%s\"/>",link->getName());
delete route;
static const char *string_action(simgrid::surf::Action::State state)
{
switch (state) {
- case (simgrid::surf::Action::State::ready):
- return "SURF_ACTION_READY";
- case (simgrid::surf::Action::State::running):
- return "SURF_ACTION_RUNNING";
- case (simgrid::surf::Action::State::failed):
- return "SURF_ACTION_FAILED";
- case (simgrid::surf::Action::State::done):
- return "SURF_ACTION_DONE";
- case (simgrid::surf::Action::State::not_in_the_system):
- return "SURF_ACTION_NOT_IN_THE_SYSTEM";
- default:
- return "INVALID STATE";
+ case simgrid::surf::Action::State::ready:
+ return "SURF_ACTION_READY";
+ case simgrid::surf::Action::State::running:
+ return "SURF_ACTION_RUNNING";
+ case simgrid::surf::Action::State::failed:
+ return "SURF_ACTION_FAILED";
+ case simgrid::surf::Action::State::done:
+ return "SURF_ACTION_DONE";
+ case simgrid::surf::Action::State::not_in_the_system:
+ return "SURF_ACTION_NOT_IN_THE_SYSTEM";
+ default:
+ return "INVALID STATE";
}
}
xbt_cfg_set_parse("cpu/model:Cas01");
xbt_cfg_set_parse("network/model:CM02");
- xbt_assert(argc >1, "Usage : %s platform.txt\n", argv[0]);
+ xbt_assert(argc > 1, "Usage: %s platform.xml\n", argv[0]);
parse_platform_file(argv[1]);
XBT_DEBUG("CPU model: %p", surf_cpu_model_pm);
simgrid::surf::Action *actionB = hostB->pimpl_cpu->execution_start(1000.0);
simgrid::surf::Action *actionC = surf_host_sleep(hostB, 7.32);
- /* Use whatever calling style you want... */
- simgrid::surf::Action::State stateActionA = actionA->getState(); /* When you know actionA model type */
- simgrid::surf::Action::State stateActionB = actionB->getState(); /* If you're unsure about it's model type */
- simgrid::surf::Action::State stateActionC = actionC->getState(); /* When you know actionA model type */
+ simgrid::surf::Action::State stateActionA = actionA->getState();
+ simgrid::surf::Action::State stateActionB = actionB->getState();
+ simgrid::surf::Action::State stateActionC = actionC->getState();
/* And just look at the state of these tasks */
XBT_INFO("actionA state: %s", string_action(stateActionA));
xbt_cfg_set_parse("network/model:CM02");
xbt_cfg_set_parse("cpu/model:Cas01");
- xbt_assert(argc >1, "Usage : %s platform.txt\n", argv[0]);
+ xbt_assert(argc > 1, "Usage: %s platform.xml\n", argv[0]);
parse_platform_file(argv[1]);
/*********************** HOST ***********************************/
XBT_INFO("Next Event : %g", now);
for (auto model: *all_existing_models) {
- if (surf_model_running_action_set_size((surf_model_t)model)) {
+ if (surf_model_running_action_set_size(model)) {
XBT_DEBUG("\t Running that model");
running = 1;
}
- action = surf_model_extract_failed_action_set(static_cast<surf_model_t>(model));
+ action = surf_model_extract_failed_action_set(model);
while (action != nullptr) {
XBT_INFO(" * Done Action");
XBT_DEBUG("\t * Failed Action: %p", action);
action->unref();
- action = surf_model_extract_failed_action_set(static_cast<surf_model_t>(model));
+ action = surf_model_extract_failed_action_set(model);
}
- action = surf_model_extract_done_action_set(static_cast<surf_model_t>(model));
+ action = surf_model_extract_done_action_set(model);
while (action != nullptr){
XBT_INFO(" * Done Action");
XBT_DEBUG("\t * Done Action: %p", action);
action->unref();
- action = surf_model_extract_done_action_set(static_cast<surf_model_t>(model));
+ action = surf_model_extract_done_action_set(model);
}
}
} while (running && surf_solve(-1.0) >= 0.0);
src/kernel/routing/AsFull.hpp
src/kernel/routing/AsRoutedGraph.hpp
src/kernel/routing/AsNone.hpp
- src/kernel/routing/AsVivaldi.hpp
+ src/kernel/routing/AsVivaldi.hpp
src/surf/storage_interface.hpp
src/surf/storage_n11.hpp
src/kernel/routing/AsRoutedGraph.cpp
src/kernel/routing/AsNone.cpp
src/kernel/routing/AsVivaldi.cpp
-
+
+ src/kernel/EngineImpl.cpp
+ src/kernel/EngineImpl.hpp
+
src/surf/cpu_cas01.cpp
src/surf/cpu_interface.cpp
src/surf/cpu_ti.cpp