ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
BI_MpathBS.c
Go to the documentation of this file.
1 #include "Bdef.h"
2 
3 void BI_MpathBS(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send, int npaths)
4 {
5  int pathlen; /* the length of each path */
6  int dist; /* the distance to the node closest to src on each path */
7  int pdest; /* part of dest calculation -- saves unneeded ops */
8  int lastlong; /* number of paths with extra node */
9  int Np, Iam, msgid, Np_1, dir;
10 
11  Np = ctxt->scp->Np;
12  if (Np < 2) return;
13  Iam = ctxt->scp->Iam;
14  msgid = Mscopeid(ctxt);
15  Np_1 = Np - 1;
16  if (npaths == FULLCON) npaths = Np_1;
17 
18  if (npaths > 0) /* paths are increasing rings */
19  {
20  pdest = Iam;
21  dir = 1;
22  }
23  else /* paths are decreasing rings */
24  {
25  pdest = Np + Iam;
26  dir = -1;
27  npaths = -npaths;
28  }
29 /*
30  * Ensure npaths is correct
31  */
32  if (npaths > Np_1) npaths = Np_1;
33  pathlen = Np_1 / npaths;
34 
35 /*
36  * Loop over all long paths (paths with an extra node), if there are any
37  */
38  lastlong = (Np_1 % npaths) * (pathlen+1); /* last node in long ring */
39  for (dist=1; dist < lastlong; dist += pathlen+1)
40  send(ctxt, (pdest+dir*dist)%Np, msgid, bp);
41 
42 /*
43  * Loop over all normal length paths
44  */
45  while (dist < Np)
46  {
47  send(ctxt, (pdest+dir*dist)%Np, msgid, bp);
48  dist += pathlen;
49  }
50 }
BI_MpathBS
void BI_MpathBS(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send, int npaths)
Definition: BI_MpathBS.c:3
FULLCON
#define FULLCON
Definition: Bdef.h:100
bLaCbUfF
Definition: Bdef.h:54
bLaCsScOpE::Iam
int Iam
Definition: Bdef.h:17
Mscopeid
#define Mscopeid(ctxt)
Definition: Bdef.h:179
bLaCsCoNtExT
Definition: Bdef.h:23
SDRVPTR
void(* SDRVPTR)(BLACSCONTEXT *, int, int, BLACBUFF *)
Definition: Bdef.h:69
bLaCsCoNtExT::scp
BLACSSCOPE * scp
Definition: Bdef.h:26
Bdef.h
bLaCsScOpE::Np
int Np
Definition: Bdef.h:17