[ofa-general] Re: [PATCHv2] opensm/osm_mesh.c: Reorder switches for lash
Sasha Khapyorsky
sashak at voltaire.com
Wed Aug 5 09:22:36 PDT 2009
On 10:21 Wed 05 Aug , Hal Rosenstock wrote:
>
> Is this what you mean or am I missing your idea on how the p_lash->switches
> array is to be reordered ?
Thinking more about this I suppose that an original structure is good
enough for doing what you need without intermediate buffers. It could be
something like this:
qsort(index....);
for (i = 0; i < num_switches; i++)
lash->switches[index[i].index]->id = i;
for (i = 0; i < num_switches; i++) {
s = lash->switches[i];
for (j = 0; j < s->num_links; j++)
s->links[j]->switch_id =
lash->switches[s->links[j]->switch_id]->id;
}
for (i = 0; i < num_switches; i++) {
s = lash->switches[i];
while (s->id != i) {
s1 = lash->switches[s->id];
lash->switches[s->id] = s;
s = s1;
}
}
Would it work?
Sasha
More information about the general
mailing list