void AsClusterTorus::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) {
char *link_id;
unsigned int j = 0;
void AsClusterTorus::create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position) {
char *link_id;
unsigned int j = 0;
*/
int neighbour_rank_id = 0; // The other node the link connects
int current_dimension = 0, // which dimension are we currently in?
*/
int neighbour_rank_id = 0; // The other node the link connects
int current_dimension = 0, // which dimension are we currently in?
s_surf_parsing_link_up_down_t info;
if (link.policy == SURF_LINK_FULLDUPLEX) {
char *tmp_link = bprintf("%s_UP", link_id);
s_surf_parsing_link_up_down_t info;
if (link.policy == SURF_LINK_FULLDUPLEX) {
char *tmp_link = bprintf("%s_UP", link_id);
* Add the link to its appropriate position;
* note that position rankId*(xbt_dynar_length(dimensions)+has_loopack?+has_limiter?)
* holds the link "rankId->rankId"
* Add the link to its appropriate position;
* note that position rankId*(xbt_dynar_length(dimensions)+has_loopack?+has_limiter?)
* holds the link "rankId->rankId"
if (!xbt_dynar_is_empty(dimensions)) {
dimensions_ = xbt_dynar_new(sizeof(int), NULL);
if (!xbt_dynar_is_empty(dimensions)) {
dimensions_ = xbt_dynar_new(sizeof(int), NULL);
* Parse attribute dimensions="dim1,dim2,dim3,...,dimN"
* and safe it in a dynarray.
* Additionally, we need to know how many ranks we have in total
* Parse attribute dimensions="dim1,dim2,dim3,...,dimN"
* and safe it in a dynarray.
* Additionally, we need to know how many ranks we have in total
xbt_dynar_set_as(dimensions_, iter, int, tmp);
}
xbt_dynar_set_as(dimensions_, iter, int, tmp);
}
- if ((src->id() == dst->id()) && has_loopback_) {
- s_surf_parsing_link_up_down_t info = xbt_dynar_get_as(privateLinks_, src->id() * nb_links_per_node_, s_surf_parsing_link_up_down_t);
+ if ((src->id() == dst->id()) && hasLoopback_) {
+ s_surf_parsing_link_up_down_t info = xbt_dynar_get_as(privateLinks_, src->id() * linkCountPerNode_, s_surf_parsing_link_up_down_t);
* Dimension based routing routes through each dimension consecutively
* TODO Change to dynamic assignment
*/
unsigned int j, cur_dim, dim_product = 1;
int current_node = src->id();
int unsigned next_node = 0;
* Dimension based routing routes through each dimension consecutively
* TODO Change to dynamic assignment
*/
unsigned int j, cur_dim, dim_product = 1;
int current_node = src->id();
int unsigned next_node = 0;
* Arrays that hold the coordinates of the current node and
* the target; comparing the values at the i-th position of
* both arrays, we can easily assess whether we need to route
* Arrays that hold the coordinates of the current node and
* the target; comparing the values at the i-th position of
* both arrays, we can easily assess whether we need to route
unsigned int *myCoords, *targetCoords;
myCoords = rankId_to_coords(src->id(), dimensions_);
targetCoords = rankId_to_coords(dst->id(), dimensions_);
unsigned int *myCoords, *targetCoords;
myCoords = rankId_to_coords(src->id(), dimensions_);
targetCoords = rankId_to_coords(dst->id(), dimensions_);
* linkOffset describes the offset where the link
* we want to use is stored
* (+1 is added because each node has a link from itself to itself,
* linkOffset describes the offset where the link
* we want to use is stored
* (+1 is added because each node has a link from itself to itself,
next_node = (current_node + dim_product);
// HERE: We use *CURRENT* node for calculation (as opposed to next_node)
next_node = (current_node + dim_product);
// HERE: We use *CURRENT* node for calculation (as opposed to next_node)
- nodeOffset = current_node * (nb_links_per_node_);
- linkOffset = nodeOffset + has_loopback_ + has_limiter_ + j;
+ nodeOffset = current_node * (linkCountPerNode_);
+ linkOffset = nodeOffset + (hasLoopback_?1:0) + (hasLimiter_?1:0) + j;
next_node = (current_node - dim_product);
// HERE: We use *next* node for calculation (as opposed to current_node!)
next_node = (current_node - dim_product);
// HERE: We use *next* node for calculation (as opposed to current_node!)
- nodeOffset = next_node * (nb_links_per_node_);
- linkOffset = nodeOffset + j + has_loopback_ + has_limiter_;
+ nodeOffset = next_node * (linkCountPerNode_);
+ linkOffset = nodeOffset + j + (hasLoopback_?1:0) + (hasLimiter_?1:0) ;
- if (has_limiter_) { // limiter for sender
- info = xbt_dynar_get_as(privateLinks_, nodeOffset + has_loopback_, s_surf_parsing_link_up_down_t);
- route->link_list->push_back(info.link_up);
+ if (hasLimiter_) { // limiter for sender
+ info = xbt_dynar_get_as(privateLinks_, nodeOffset + hasLoopback_, s_surf_parsing_link_up_down_t);
+ route->link_list->push_back(info.linkUp);
}
info = xbt_dynar_get_as(privateLinks_, linkOffset, s_surf_parsing_link_up_down_t);
if (use_lnk_up == false) {
}
info = xbt_dynar_get_as(privateLinks_, linkOffset, s_surf_parsing_link_up_down_t);
if (use_lnk_up == false) {