#include "src/surf/AsCluster.hpp"
#include "src/surf/AsClusterTorus.hpp"
#include "src/surf/AsClusterFatTree.hpp"
#include "src/surf/AsCluster.hpp"
#include "src/surf/AsClusterTorus.hpp"
#include "src/surf/AsClusterFatTree.hpp"
#include "src/surf/AsDijkstra.hpp"
#include "src/surf/AsFloyd.hpp"
#include "src/surf/AsFull.hpp"
#include "src/surf/AsDijkstra.hpp"
#include "src/surf/AsFloyd.hpp"
#include "src/surf/AsFull.hpp"
- xbt_assert(! sg_host_by_name(host->id), "Refusing to create a second host named '%s'.", host->id);
+ xbt_assert(sg_host_by_name(host->id) == nullptr, "Refusing to create a second host named '%s'.", host->id);
simgrid::surf::AsImpl* current_routing = routing_get_current();
if (current_routing->hierarchy_ == simgrid::surf::AsImpl::RoutingMode::unset)
simgrid::surf::AsImpl* current_routing = routing_get_current();
if (current_routing->hierarchy_ == simgrid::surf::AsImpl::RoutingMode::unset)
xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void *) mount_list);
xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void *) mount_list);
xbt_dynar_t ctn_str = xbt_str_split_str(host->coord, " ");
xbt_assert(xbt_dynar_length(ctn_str)==3,"Coordinates of %s must have 3 dimensions", host->id);
xbt_dynar_t ctn_str = xbt_str_split_str(host->coord, " ");
xbt_assert(xbt_dynar_length(ctn_str)==3,"Coordinates of %s must have 3 dimensions", host->id);
xbt_dynar_foreach(ctn_str,cursor, str) {
double val = xbt_str_parse_double(str, "Invalid coordinate: %s");
xbt_dynar_push(ctn,&val);
xbt_dynar_foreach(ctn_str,cursor, str) {
double val = xbt_str_parse_double(str, "Invalid coordinate: %s");
xbt_dynar_push(ctn,&val);
char *key,*data;
xbt_dict_foreach(host->properties,cursor,key,data)
h->setProperty(key,data);
char *key,*data;
xbt_dict_foreach(host->properties,cursor,key,data)
h->setProperty(key,data);
xbt_assert(nullptr == xbt_lib_get_or_null(as_router_lib, router->id, ROUTING_ASR_LEVEL),
"Refusing to create a router named '%s': this name already describes a node.", router->id);
xbt_assert(nullptr == xbt_lib_get_or_null(as_router_lib, router->id, ROUTING_ASR_LEVEL),
"Refusing to create a router named '%s': this name already describes a node.", router->id);
- xbt_lib_set(as_router_lib, router->id, ROUTING_ASR_LEVEL, (void *) netcard);
- XBT_DEBUG("Having set name '%s' id '%d'", router->id, netcard->id());
+ xbt_lib_set(as_router_lib, router->id, ROUTING_ASR_LEVEL, netcard);
+ XBT_DEBUG("Router '%s' has the id %d", router->id, netcard->id());
/* Pre-parse the host coordinates */
xbt_dynar_t ctn_str = xbt_str_split_str(router->coord, " ");
xbt_assert(xbt_dynar_length(ctn_str)==3,"Coordinates of %s must have 3 dimensions", router->id);
/* Pre-parse the host coordinates */
xbt_dynar_t ctn_str = xbt_str_split_str(router->coord, " ");
xbt_assert(xbt_dynar_length(ctn_str)==3,"Coordinates of %s must have 3 dimensions", router->id);
xbt_dynar_foreach(ctn_str,cursor, str) {
double val = xbt_str_parse_double(str, "Invalid coordinate: %s");
xbt_dynar_push(ctn,&val);
xbt_dynar_foreach(ctn_str,cursor, str) {
double val = xbt_str_parse_double(str, "Invalid coordinate: %s");
xbt_dynar_push(ctn,&val);
current_as->parse_specific_arguments(cluster);
if(cluster->loopback_bw!=0 || cluster->loopback_lat!=0){
current_as->parse_specific_arguments(cluster);
if(cluster->loopback_bw!=0 || cluster->loopback_lat!=0){
s_sg_platf_host_cbarg_t host;
memset(&host, 0, sizeof(host));
host.id = host_id;
s_sg_platf_host_cbarg_t host;
memset(&host, 0, sizeof(host));
host.id = host_id;
- if ((cluster->properties != NULL) && (!xbt_dict_is_empty(cluster->properties))) {
- xbt_dict_cursor_t cursor=NULL;
+ if ((cluster->properties != nullptr) && (!xbt_dict_is_empty(cluster->properties))) {
+ xbt_dict_cursor_t cursor=nullptr;
xbt_dynar_push(host.speed_per_pstate,&cluster->speed);
host.pstate = 0;
host.core_amount = cluster->core_amount;
xbt_dynar_push(host.speed_per_pstate,&cluster->speed);
host.pstate = 0;
host.core_amount = cluster->core_amount;
s_surf_parsing_link_up_down_t info_lim, info_loop;
// All links are saved in a matrix;
s_surf_parsing_link_up_down_t info_lim, info_loop;
// All links are saved in a matrix;
// the first column may store a link from x to x if p_has_loopback is set
// the second column may store a limiter link if p_has_limiter is set
// other columns are to store one or more link for the node
// the first column may store a link from x to x if p_has_loopback is set
// the second column may store a limiter link if p_has_limiter is set
// other columns are to store one or more link for the node
link.latency = cluster->loopback_lat;
link.policy = SURF_LINK_FATPIPE;
sg_platf_new_link(&link);
link.latency = cluster->loopback_lat;
link.policy = SURF_LINK_FATPIPE;
sg_platf_new_link(&link);
- xbt_dynar_set(current_as->privateLinks_, rankId * current_as->nb_links_per_node_ + current_as->has_loopback_ , &info_lim);
+ xbt_dynar_set(current_as->privateLinks_, rankId * current_as->linkCountPerNode_ + current_as->hasLoopback_ , &info_lim);
}
else {
current_as->create_links_for_node(cluster, i, rankId,
}
else {
current_as->create_links_for_node(cluster, i, rankId,
// and it's very useful to connect clusters together
XBT_DEBUG(" ");
XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id);
// and it's very useful to connect clusters together
XBT_DEBUG(" ");
XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id);
s_sg_platf_router_cbarg_t router;
memset(&router, 0, sizeof(router));
router.id = cluster->router_id;
s_sg_platf_router_cbarg_t router;
memset(&router, 0, sizeof(router));
router.id = cluster->router_id;
xbt_dynar_push(host.speed_per_pstate,&cabinet->speed);
sg_platf_new_host(&host);
xbt_dynar_free(&host.speed_per_pstate);
xbt_dynar_push(host.speed_per_pstate,&cabinet->speed);
sg_platf_new_host(&host);
xbt_dynar_free(&host.speed_per_pstate);
double kill_time = process->kill_time;
int auto_restart = process->on_failure == SURF_PROCESS_ON_FAILURE_DIE ? 0 : 1;
double kill_time = process->kill_time;
int auto_restart = process->on_failure == SURF_PROCESS_ON_FAILURE_DIE ? 0 : 1;
- smx_process_arg_t arg = NULL;
- smx_process_t process_created = NULL;
+ std::function<void()> code = simgrid::xbt::wrapMain(parse_code, process->argc, process->argv);
+
+ smx_process_arg_t arg = nullptr;
+ smx_process_t process_created = nullptr;
arg->kill_time = kill_time;
arg->properties = current_property_set;
if (!sg_host_simix(host)->boot_processes)
arg->kill_time = kill_time;
arg->properties = current_property_set;
if (!sg_host_simix(host)->boot_processes)
xbt_dynar_push_as(sg_host_simix(host)->boot_processes,smx_process_arg_t,arg);
if (start_time > SIMIX_get_clock()) {
xbt_dynar_push_as(sg_host_simix(host)->boot_processes,smx_process_arg_t,arg);
if (start_time > SIMIX_get_clock()) {
arg->kill_time = kill_time;
arg->properties = current_property_set;
XBT_DEBUG("Process %s(%s) will be started at time %f",
arg->name.c_str(), arg->hostname, start_time);
arg->kill_time = kill_time;
arg->properties = current_property_set;
XBT_DEBUG("Process %s(%s) will be started at time %f",
arg->name.c_str(), arg->hostname, start_time);
} else { // start_time <= SIMIX_get_clock()
XBT_DEBUG("Starting Process %s(%s) right now",
arg->name.c_str(), sg_host_get_name(host));
if (simix_global->create_process_function)
process_created = simix_global->create_process_function(
} else { // start_time <= SIMIX_get_clock()
XBT_DEBUG("Starting Process %s(%s) right now",
arg->name.c_str(), sg_host_get_name(host));
if (simix_global->create_process_function)
process_created = simix_global->create_process_function(
- arg->name.c_str(),
- parse_code,
- NULL,
- sg_host_get_name(host),
- kill_time,
- arg->args.argc(), arg->args.to_argv(),
- current_property_set,
- auto_restart, NULL);
+ arg->name.c_str(), std::move(code), nullptr,
+ sg_host_get_name(host), kill_time,
+ current_property_set, auto_restart, nullptr);
- arg->name.c_str(), parse_code, NULL, sg_host_get_name(host), kill_time,
- arg->args.argc(), arg->args.to_argv(), current_property_set,auto_restart);
+ arg->name.c_str(), std::move(code), nullptr, sg_host_get_name(host), kill_time,
+ current_property_set,auto_restart);
xbt_dynar_push(host.speed_per_pstate,&peer->speed);
host.pstate = 0;
host.speed_trace = peer->availability_trace;
xbt_dynar_push(host.speed_per_pstate,&peer->speed);
host.pstate = 0;
host.speed_trace = peer->availability_trace;
switch(AS->routing){
case A_surfxml_AS_routing_Cluster: new_as = new simgrid::surf::AsCluster(AS->id); break;
case A_surfxml_AS_routing_ClusterTorus: new_as = new simgrid::surf::AsClusterTorus(AS->id); break;
switch(AS->routing){
case A_surfxml_AS_routing_Cluster: new_as = new simgrid::surf::AsCluster(AS->id); break;
case A_surfxml_AS_routing_ClusterTorus: new_as = new simgrid::surf::AsClusterTorus(AS->id); break;
case A_surfxml_AS_routing_ClusterFatTree: new_as = new simgrid::surf::AsClusterFatTree(AS->id); break;
case A_surfxml_AS_routing_Dijkstra: new_as = new simgrid::surf::AsDijkstra(AS->id, 0); break;
case A_surfxml_AS_routing_DijkstraCache: new_as = new simgrid::surf::AsDijkstra(AS->id, 1); break;
case A_surfxml_AS_routing_ClusterFatTree: new_as = new simgrid::surf::AsClusterFatTree(AS->id); break;
case A_surfxml_AS_routing_Dijkstra: new_as = new simgrid::surf::AsDijkstra(AS->id, 0); break;
case A_surfxml_AS_routing_DijkstraCache: new_as = new simgrid::surf::AsDijkstra(AS->id, 1); break;
/* make a new routing component */
simgrid::surf::NetCard *netcard = new simgrid::surf::NetCardImpl(new_as->name(), simgrid::surf::NetCard::Type::As, current_routing);
/* make a new routing component */
simgrid::surf::NetCard *netcard = new simgrid::surf::NetCardImpl(new_as->name(), simgrid::surf::NetCard::Type::As, current_routing);
xbt_assert(!xbt_dict_get_or_null(current_routing->children(), AS->id),
"The AS \"%s\" already exists", AS->id);
xbt_assert(!xbt_dict_get_or_null(current_routing->children(), AS->id),
"The AS \"%s\" already exists", AS->id);
if (current_routing->hierarchy_ == simgrid::surf::AsImpl::RoutingMode::unset)
current_routing->hierarchy_ = simgrid::surf::AsImpl::RoutingMode::recursive;
/* add to the sons dictionary */
if (current_routing->hierarchy_ == simgrid::surf::AsImpl::RoutingMode::unset)
current_routing->hierarchy_ = simgrid::surf::AsImpl::RoutingMode::recursive;
/* add to the sons dictionary */
- xbt_dict_set(current_routing->children(), AS->id, (void *) new_as, NULL);
+ xbt_dict_set(current_routing->children(), AS->id, (void *) new_as, nullptr);
"Only hosts from Cluster and Vivaldi ASes can get an host_link.");
s_surf_parsing_link_up_down_t link_up_down;
"Only hosts from Cluster and Vivaldi ASes can get an host_link.");
s_surf_parsing_link_up_down_t link_up_down;
- link_up_down.link_up = Link::byName(hostlink->link_up);
- link_up_down.link_down = Link::byName(hostlink->link_down);
+ link_up_down.linkUp = Link::byName(hostlink->link_up);
+ link_up_down.linkDown = Link::byName(hostlink->link_down);
- xbt_assert(link_up_down.link_up, "Link '%s' not found!",hostlink->link_up);
- xbt_assert(link_up_down.link_down, "Link '%s' not found!",hostlink->link_down);
+ xbt_assert(link_up_down.linkUp, "Link '%s' not found!",hostlink->link_up);
+ xbt_assert(link_up_down.linkDown, "Link '%s' not found!",hostlink->link_down);
// If dynar is is greater than netcard id and if the host_link is already defined
auto as_cluster = static_cast<simgrid::surf::AsCluster*>(current_routing);
// If dynar is is greater than netcard id and if the host_link is already defined
auto as_cluster = static_cast<simgrid::surf::AsCluster*>(current_routing);