SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
BI_MpathBS.c
Go to the documentation of this file.
1#include "Bdef.h"
2
3void 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}
void BI_MpathBS(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send, Int npaths)
Definition BI_MpathBS.c:3
#define Int
Definition Bconfig.h:22
#define Mscopeid(ctxt)
Definition Bdef.h:179
#define FULLCON
Definition Bdef.h:100
void(* SDRVPTR)(BLACSCONTEXT *, Int, Int, BLACBUFF *)
Definition Bdef.h:69
BLACSSCOPE * scp
Definition Bdef.h:26
Int Np
Definition Bdef.h:17
Int Iam
Definition Bdef.h:17