[ofa-general] Re: [PATCHv2] opensm/osm_mesh.c: Reorder switches for lash
Hal Rosenstock
hal.rosenstock at gmail.com
Wed Aug 5 11:49:56 PDT 2009
On Wed, Aug 5, 2009 at 1:50 PM, Sasha Khapyorsky <sashak at voltaire.com>wrote:
> On 13:03 Wed 05 Aug , Hal Rosenstock wrote:
> > >
> > > 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?
> >
> >
> > Even if something like this works (haven't played with it yet), is it
> worth
> > iterating over lash->switches array to save a memory allocation ?
>
> It is single pass finally - just put everything in the places. I don't
> think that this introduces more calculations than the original code did.
I'll work on in it the background (and note this in the updated patch
description).
>
> > Also, couldn't this be a subsequent
> > step in the evolution of this code ?
>
> Yes, I think it could.
Good; I'll resubmit a slightly updated version shortly.
-- Hal
>
>
> Sasha
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20090805/5ffa295b/attachment.html>
More information about the general
mailing list