void ETag_surfxml_link(){ simgrid::kernel::routing::LinkCreationArgs link; link.properties = current_property_set; current_property_set = nullptr; link.id = std::string(A_surfxml_link_id); link.bandwidth = surf_parse_get_bandwidth(A_surfxml_link_bandwidth, "bandwidth of link", link.id.c_str()); link.bandwidth_trace = A_surfxml_link_bandwidth___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_bandwidth___file) : nullptr; link.latency = surf_parse_get_time(A_surfxml_link_latency, "latency of link", link.id.c_str()); link.latency_trace = A_surfxml_link_latency___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_latency___file) : nullptr; link.state_trace = A_surfxml_link_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_state___file):nullptr; switch (A_surfxml_link_sharing___policy) { case A_surfxml_link_sharing___policy_SHARED: link.policy = simgrid::s4u::Link::SharingPolicy::SHARED; break; case A_surfxml_link_sharing___policy_FATPIPE: link.policy = simgrid::s4u::Link::SharingPolicy::FATPIPE; break; case A_surfxml_link_sharing___policy_FULLDUPLEX: XBT_WARN("FULLDUPLEX is now deprecated. Please update your platform file to use SPLITDUPLEX instead."); link.policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX; break; case A_surfxml_link_sharing___policy_SPLITDUPLEX: link.policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX; break; default: surf_parse_error(std::string("Invalid sharing policy in link ") + link.id); break; } sg_platf_new_link(&link); }
void ETag_surfxml_backbone(){ simgrid::kernel::routing::LinkCreationArgs link; link.properties = nullptr; link.id = std::string(A_surfxml_backbone_id); link.bandwidth = surf_parse_get_bandwidth(A_surfxml_backbone_bandwidth, "bandwidth of backbone", link.id.c_str()); link.latency = surf_parse_get_time(A_surfxml_backbone_latency, "latency of backbone", link.id.c_str()); link.policy = simgrid::s4u::Link::SharingPolicy::SHARED; sg_platf_new_link(&link); routing_cluster_add_backbone(simgrid::s4u::Link::by_name(std::string(A_surfxml_backbone_id))->get_impl()); }
void STag_surfxml_cabinet(){ simgrid::kernel::routing::CabinetCreationArgs cabinet; cabinet.id = A_surfxml_cabinet_id; cabinet.prefix = A_surfxml_cabinet_prefix; cabinet.suffix = A_surfxml_cabinet_suffix; cabinet.speed = surf_parse_get_speed(A_surfxml_cabinet_speed, "speed of cabinet", cabinet.id.c_str()); cabinet.bw = surf_parse_get_bandwidth(A_surfxml_cabinet_bw, "bw of cabinet", cabinet.id.c_str()); cabinet.lat = surf_parse_get_time(A_surfxml_cabinet_lat, "lat of cabinet", cabinet.id.c_str()); cabinet.radicals = explodesRadical(A_surfxml_cabinet_radical); sg_platf_new_cabinet(&cabinet); }
int console_add_backbone(lua_State *L) { s_sg_platf_link_cbarg_t link; memset(&link,0,sizeof(link)); int type; link.properties = nullptr; lua_ensure(lua_istable(L, -1),"Bad Arguments to create backbone in Lua. Should be a table with named arguments."); lua_pushstring(L, "id"); type = lua_gettable(L, -2); lua_ensure(type == LUA_TSTRING, "Attribute 'id' must be specified for backbone and must be a string."); link.id = lua_tostring(L, -1); lua_pop(L, 1); lua_pushstring(L, "bandwidth"); type = lua_gettable(L, -2); lua_ensure(type == LUA_TSTRING || type == LUA_TNUMBER, "Attribute 'bandwidth' must be specified for backbone and must either be a string (in the right format; see docs) or a number."); link.bandwidth = surf_parse_get_bandwidth(lua_tostring(L, -1),"bandwidth of backbone",link.id); lua_pop(L, 1); lua_pushstring(L, "lat"); type = lua_gettable(L, -2); lua_ensure(type == LUA_TSTRING || type == LUA_TNUMBER, "Attribute 'lat' must be specified for backbone and must either be a string (in the right format; see docs) or a number."); link.latency = surf_parse_get_time(lua_tostring(L, -1),"latency of backbone",link.id); lua_pop(L, 1); lua_pushstring(L, "sharing_policy"); type = lua_gettable(L, -2); const char* policy = lua_tostring(L, -1); if (policy && !strcmp(policy,"FULLDUPLEX")) { link.policy = SURF_LINK_FULLDUPLEX; } else if (policy && !strcmp(policy,"FATPIPE")) { link.policy = SURF_LINK_FATPIPE; } else { link.policy = SURF_LINK_SHARED; } sg_platf_new_link(&link); routing_cluster_add_backbone(sg_link_by_name(link.id)); return 0; }
int console_add_link(lua_State *L) { s_sg_platf_link_cbarg_t link; memset(&link,0,sizeof(link)); int type; const char* policy; lua_ensure(lua_istable(L, -1), "Bad Arguments to create link, Should be a table with named arguments"); // get Id Value lua_pushstring(L, "id"); type = lua_gettable(L, -2); lua_ensure(type == LUA_TSTRING || type == LUA_TNUMBER, "Attribute 'id' must be specified for any link and must be a string."); link.id = lua_tostring(L, -1); lua_pop(L, 1); // get bandwidth value lua_pushstring(L, "bandwidth"); type = lua_gettable(L, -2); lua_ensure(type == LUA_TSTRING || type == LUA_TNUMBER, "Attribute 'bandwidth' must be specified for any link and must either be either a string (in the right format; see docs) or a number."); if (type == LUA_TNUMBER) link.bandwidth = lua_tonumber(L, -1); else // LUA_TSTRING link.bandwidth = surf_parse_get_bandwidth(lua_tostring(L, -1),"bandwidth of link", link.id); lua_pop(L, 1); //get latency value lua_pushstring(L, "lat"); type = lua_gettable(L, -2); lua_ensure(type == LUA_TSTRING || type == LUA_TNUMBER, "Attribute 'lat' must be specified for any link and must either be a string (in the right format; see docs) or a number."); if (type == LUA_TNUMBER) link.latency = lua_tonumber(L, -1); else // LUA_TSTRING link.latency = surf_parse_get_time(lua_tostring(L, -1),"latency of link", link.id); lua_pop(L, 1); /*Optional Arguments */ //get bandwidth_trace value lua_pushstring(L, "bandwidth_file"); lua_gettable(L, -2); const char *filename = lua_tostring(L, -1); if (filename) link.bandwidth_trace = tmgr_trace_new_from_file(filename); lua_pop(L, 1); //get latency_trace value lua_pushstring(L, "latency_file"); lua_gettable(L, -2); filename = lua_tostring(L, -1); if (filename) link.latency_trace = tmgr_trace_new_from_file(filename); lua_pop(L, 1); //get state_trace value lua_pushstring(L, "state_file"); lua_gettable(L, -2); filename = lua_tostring(L, -1); if (filename) link.state_trace = tmgr_trace_new_from_file(filename); lua_pop(L, 1); //get policy value lua_pushstring(L, "sharing_policy"); lua_gettable(L, -2); policy = lua_tostring(L, -1); lua_pop(L, 1); if (policy && !strcmp(policy,"FULLDUPLEX")) { link.policy = SURF_LINK_FULLDUPLEX; } else if (policy && !strcmp(policy,"FATPIPE")) { link.policy = SURF_LINK_FATPIPE; } else { link.policy = SURF_LINK_SHARED; } sg_platf_new_link(&link); return 0; }
void ETag_surfxml_cluster(){ simgrid::kernel::routing::ClusterCreationArgs cluster; cluster.properties = current_property_set; current_property_set = nullptr; cluster.id = A_surfxml_cluster_id; cluster.prefix = A_surfxml_cluster_prefix; cluster.suffix = A_surfxml_cluster_suffix; cluster.radicals = explodesRadical(A_surfxml_cluster_radical); cluster.speeds = surf_parse_get_all_speeds(A_surfxml_cluster_speed, "speed of cluster", cluster.id); cluster.core_amount = surf_parse_get_int(A_surfxml_cluster_core); cluster.bw = surf_parse_get_bandwidth(A_surfxml_cluster_bw, "bw of cluster", cluster.id); cluster.lat = surf_parse_get_time(A_surfxml_cluster_lat, "lat of cluster", cluster.id); if(strcmp(A_surfxml_cluster_bb___bw,"")) cluster.bb_bw = surf_parse_get_bandwidth(A_surfxml_cluster_bb___bw, "bb_bw of cluster", cluster.id); if(strcmp(A_surfxml_cluster_bb___lat,"")) cluster.bb_lat = surf_parse_get_time(A_surfxml_cluster_bb___lat, "bb_lat of cluster", cluster.id); if(strcmp(A_surfxml_cluster_limiter___link,"")) cluster.limiter_link = surf_parse_get_bandwidth(A_surfxml_cluster_limiter___link, "limiter_link of cluster", cluster.id); if(strcmp(A_surfxml_cluster_loopback___bw,"")) cluster.loopback_bw = surf_parse_get_bandwidth(A_surfxml_cluster_loopback___bw, "loopback_bw of cluster", cluster.id); if(strcmp(A_surfxml_cluster_loopback___lat,"")) cluster.loopback_lat = surf_parse_get_time(A_surfxml_cluster_loopback___lat, "loopback_lat of cluster", cluster.id); switch(AX_surfxml_cluster_topology){ case A_surfxml_cluster_topology_FLAT: cluster.topology = simgrid::kernel::routing::ClusterTopology::FLAT; break; case A_surfxml_cluster_topology_TORUS: cluster.topology = simgrid::kernel::routing::ClusterTopology::TORUS; break; case A_surfxml_cluster_topology_FAT___TREE: cluster.topology = simgrid::kernel::routing::ClusterTopology::FAT_TREE; break; case A_surfxml_cluster_topology_DRAGONFLY: cluster.topology = simgrid::kernel::routing::ClusterTopology::DRAGONFLY; break; default: surf_parse_error(std::string("Invalid cluster topology for cluster ") + cluster.id); break; } cluster.topo_parameters = A_surfxml_cluster_topo___parameters; cluster.router_id = A_surfxml_cluster_router___id; switch (AX_surfxml_cluster_sharing___policy) { case A_surfxml_cluster_sharing___policy_SHARED: cluster.sharing_policy = simgrid::s4u::Link::SharingPolicy::SHARED; break; case A_surfxml_cluster_sharing___policy_FULLDUPLEX: XBT_WARN("FULLDUPLEX is now deprecated. Please update your platform file to use SPLITDUPLEX instead."); cluster.sharing_policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX; break; case A_surfxml_cluster_sharing___policy_SPLITDUPLEX: cluster.sharing_policy = simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX; break; case A_surfxml_cluster_sharing___policy_FATPIPE: cluster.sharing_policy = simgrid::s4u::Link::SharingPolicy::FATPIPE; break; default: surf_parse_error(std::string("Invalid cluster sharing policy for cluster ") + cluster.id); break; } switch (AX_surfxml_cluster_bb___sharing___policy) { case A_surfxml_cluster_bb___sharing___policy_FATPIPE: cluster.bb_sharing_policy = simgrid::s4u::Link::SharingPolicy::FATPIPE; break; case A_surfxml_cluster_bb___sharing___policy_SHARED: cluster.bb_sharing_policy = simgrid::s4u::Link::SharingPolicy::SHARED; break; default: surf_parse_error(std::string("Invalid bb sharing policy in cluster ") + cluster.id); break; } sg_platf_new_cluster(&cluster); }