}
sg_platf_new_link(&link);
- routing_cluster_add_backbone(simgrid::surf::LinkImpl::byName(link.id.c_str()));
+ routing_cluster_add_backbone(simgrid::surf::LinkImpl::byName(link.id));
return 0;
}
// Several names separated by , \t\r\n
for (auto name : names) {
if (name.length() > 0) {
- simgrid::surf::LinkImpl* link = simgrid::surf::LinkImpl::byName(name.c_str());
+ simgrid::surf::LinkImpl* link = simgrid::surf::LinkImpl::byName(name);
route.link_list->push_back(link);
}
}
// Several names separated by , \t\r\n
for (auto name : names) {
if (name.length() > 0) {
- simgrid::surf::LinkImpl* link = simgrid::surf::LinkImpl::byName(name.c_str());
+ simgrid::surf::LinkImpl* link = simgrid::surf::LinkImpl::byName(name);
ASroute.link_list->push_back(link);
}
}
surf::LinkImpl *linkUp;
surf::LinkImpl *linkDown;
if (link.policy == SURF_LINK_FULLDUPLEX) {
- char* tmp_link = bprintf("%s_UP", link_id);
+ std::string tmp_link = std::string(link_id) + "_UP";
linkUp = surf::LinkImpl::byName(tmp_link);
- xbt_free(tmp_link);
tmp_link = bprintf("%s_DOWN", link_id);
linkDown = surf::LinkImpl::byName(tmp_link);
- xbt_free(tmp_link);
} else {
linkUp = surf::LinkImpl::byName(link_id);
linkDown = linkUp;
std::string tmpID;
if (this->cluster_->sharing_policy == SURF_LINK_FULLDUPLEX) {
tmpID = linkTemplate.id + "_UP";
- link = surf::LinkImpl::byName(tmpID.c_str());
+ link = surf::LinkImpl::byName(tmpID);
*linkup = link; // check link?
tmpID = linkTemplate.id + "_DOWN";
- link = surf::LinkImpl::byName(tmpID.c_str());
+ link = surf::LinkImpl::byName(tmpID);
*linkdown = link; // check link ?
} else {
- link = surf::LinkImpl::byName(linkTemplate.id.c_str());
+ link = surf::LinkImpl::byName(linkTemplate.id);
*linkup = link;
*linkdown = link;
}
linkTemplate.policy = SURF_LINK_SHARED;
linkTemplate.id = "limiter_"+std::to_string(id);
sg_platf_new_link(&linkTemplate);
- this->limiterLink = surf::LinkImpl::byName(linkTemplate.id.c_str());
+ this->limiterLink = surf::LinkImpl::byName(linkTemplate.id);
}
if (cluster->loopback_bw || cluster->loopback_lat) {
linkTemplate.bandwidth = cluster->loopback_bw;
linkTemplate.policy = SURF_LINK_FATPIPE;
linkTemplate.id = "loopback_"+ std::to_string(id);
sg_platf_new_link(&linkTemplate);
- this->loopback = surf::LinkImpl::byName(linkTemplate.id.c_str());
+ this->loopback = surf::LinkImpl::byName(linkTemplate.id);
}
}
if (cluster->sharing_policy == SURF_LINK_FULLDUPLEX) {
std::string tmpID = std::string(linkTemplate.id) + "_UP";
- this->upLink = surf::LinkImpl::byName(tmpID.c_str()); // check link?
+ this->upLink = surf::LinkImpl::byName(tmpID); // check link?
tmpID = std::string(linkTemplate.id) + "_DOWN";
- this->downLink = surf::LinkImpl::byName(tmpID.c_str()); // check link ?
+ this->downLink = surf::LinkImpl::byName(tmpID); // check link ?
} else {
- this->upLink = surf::LinkImpl::byName(linkTemplate.id.c_str());
+ this->upLink = surf::LinkImpl::byName(linkTemplate.id);
this->downLink = this->upLink;
}
uniqueId++;
? rank - (current_dimension - 1) * dim_product
: rank + dim_product;
// name of neighbor is not right for non contiguous cluster radicals (as id != rank in this case)
- char* link_id = bprintf("%s_link_from_%i_to_%i", cluster->id, id, neighbor_rank_id);
+ std::string link_id =
+ std::string(cluster->id) + "_link_from_" + std::to_string(id) + "_to_" + std::to_string(neighbor_rank_id);
link.id = link_id;
link.bandwidth = cluster->bw;
link.latency = cluster->lat;
surf::LinkImpl* linkUp;
surf::LinkImpl* linkDown;
if (link.policy == SURF_LINK_FULLDUPLEX) {
- char* tmp_link = bprintf("%s_UP", link_id);
+ std::string tmp_link = link_id + "_UP";
linkUp = surf::LinkImpl::byName(tmp_link);
- free(tmp_link);
- tmp_link = bprintf("%s_DOWN", link_id);
+ tmp_link = link_id + "_DOWN";
linkDown = surf::LinkImpl::byName(tmp_link);
- free(tmp_link);
} else {
linkUp = surf::LinkImpl::byName(link_id);
linkDown = linkUp;
*/
privateLinks_.insert({position + j, {linkUp, linkDown}});
dim_product *= current_dimension;
- xbt_free(link_id);
}
rank++;
}
/* List of links */
std::unordered_map<std::string, LinkImpl*>* LinkImpl::links = new std::unordered_map<std::string, LinkImpl*>();
- LinkImpl* LinkImpl::byName(const char* name)
+ LinkImpl* LinkImpl::byName(std::string name)
{
auto link = links->find(name);
return link == links->end() ? nullptr : link->second;
static std::unordered_map<std::string, LinkImpl*>* links;
public:
- static LinkImpl* byName(const char* name);
+ static LinkImpl* byName(std::string name);
static int linksCount();
static LinkImpl** linksList();
static void linksExit();
link.latency = cluster->loopback_lat;
link.policy = SURF_LINK_FATPIPE;
sg_platf_new_link(&link);
- linkUp = simgrid::surf::LinkImpl::byName(tmp_link.c_str());
- linkDown = simgrid::surf::LinkImpl::byName(tmp_link.c_str());
+ linkUp = simgrid::surf::LinkImpl::byName(tmp_link);
+ linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
auto as_cluster = static_cast<ClusterZone*>(current_as);
as_cluster->privateLinks_.insert({rankId * as_cluster->linkCountPerNode_, {linkUp, linkDown}});
link.latency = 0;
link.policy = SURF_LINK_SHARED;
sg_platf_new_link(&link);
- linkDown = simgrid::surf::LinkImpl::byName(tmp_link.c_str());
+ linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
linkUp = linkDown;
current_as->privateLinks_.insert(
{rankId * current_as->linkCountPerNode_ + current_as->hasLoopback_, {linkUp, linkDown}});
XBT_DEBUG("<link\tid=\"%s\" bw=\"%f\" lat=\"%f\"/>", link.id.c_str(), cluster->bb_bw, cluster->bb_lat);
sg_platf_new_link(&link);
- routing_cluster_add_backbone(simgrid::surf::LinkImpl::byName(link.id.c_str()));
+ routing_cluster_add_backbone(simgrid::surf::LinkImpl::byName(link.id));
}
XBT_DEBUG("</AS>");