4{
7
12 Int Np, Iam, msgid, Np_1, dest;
13
18 Np_1 = Np - 1;
19 if (npaths ==
FULLCON) npaths = Np_1;
20
21 if (npaths > 0)
22 {
23 dest = (Iam+1) % Np;
24 mydist = (Np + Iam - src) % Np;
25 }
26 else
27 {
28 dest = (Np_1+Iam) % Np;
29 mydist = (Np + src - Iam) % Np;
30 npaths = -npaths;
31 }
32
33
34
35 if (npaths > Np_1) npaths = Np_1;
36
37 pathlen = Np_1 / npaths;
38 lastlong = (Np_1%npaths) * (pathlen+1);
39 if (lastlong)
40 {
41 if (mydist <= lastlong) faredge = ((mydist-1)/(pathlen+1)+1)*(pathlen+1);
42 else faredge = ((lastlong-1)/(pathlen+1)+1) * (pathlen+1)
43 + ((mydist-lastlong-1)/pathlen + 1) * pathlen;
44 }
45 else faredge = ((mydist-1)/pathlen + 1) * pathlen;
46
48 if (mydist < faredge) send(ctxt, dest, msgid, bp);
49}
void BI_Arecv(BLACSCONTEXT *ctxt, Int src, Int msgid, BLACBUFF *bp)
Int BI_BuffIsFree(BLACBUFF *bp, Int Wait)