PLASMA: /home/mathieu/svn/plasma/trunk/tools/plasma_2.5.0/control/bulge.h Source File

PLASMA 2.4.6

- Main Page
- Modules
- Data Types List

All Data Structures Functions Groups
bulge.h
1
15 /***************************************************************************/
18 #ifndef _PLASMA_BULGE_H_
19 #define _PLASMA_BULGE_H_
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 /***************************************************************************/
28 inline static void findVTpos(int N, int NB, int Vblksiz, int sweep, int st, int *Vpos, int *TAUpos, int *Tpos, int *myblkid);
29 inline static void findVTsiz(int N, int NB, int Vblksiz, int *blkcnt, int *LDV);
30 inline static int plasma_ceildiv(int a, int b);
31
33 inline static int plasma_ceildiv(int a, int b)
34 {
35 double r = (double)a/(double)b;
36 r = (r-(int)r)==0? (int)r:(int)r+1;
37 return (int) r;
38 }
40
42 inline static void findVTpos(int N, int NB, int Vblksiz, int sweep, int st, int *Vpos, int *TAUpos, int *Tpos, int *myblkid)
43 {
44 int prevcolblknb, prevblkcnt, prevcolblkid;
45 int curcolblknb, nbprevcolblk, mastersweep;
46 int blkid, locj, LDV;
47
48 prevcolblknb = 0;
49 prevblkcnt = 0;
50 curcolblknb = 0;
51
52 nbprevcolblk = sweep/Vblksiz;
53 for (prevcolblkid = 0; prevcolblkid < nbprevcolblk; prevcolblkid++)
54 {
55 mastersweep = prevcolblkid * Vblksiz;
56 prevcolblknb = plasma_ceildiv((N-(mastersweep+2)),NB);
57 prevblkcnt = prevblkcnt + prevcolblknb;
58 }
59 curcolblknb = plasma_ceildiv((st-sweep),NB);
60 blkid = prevblkcnt + curcolblknb -1;
61 locj = sweep%Vblksiz;
62 LDV = NB + Vblksiz -1;
63
64 *myblkid= blkid;
65 *Vpos = blkid*Vblksiz*LDV + locj*LDV + locj;
66 *TAUpos = blkid*Vblksiz + locj;
67 *Tpos = blkid*Vblksiz*Vblksiz + locj*Vblksiz + locj;
68 }
70
72 inline static void findVTsiz(int N, int NB, int Vblksiz, int *blkcnt, int *LDV)
73 {
74 int colblk, nbcolblk;
75 int curcolblknb, mastersweep;
76
77 *blkcnt = 0;
78 nbcolblk = plasma_ceildiv((N-1),Vblksiz);
79 for (colblk = 0; colblk<nbcolblk; colblk++)
80 {
81 mastersweep = colblk * Vblksiz;
82 curcolblknb = plasma_ceildiv((N-(mastersweep+2)),NB);
83 *blkcnt = *blkcnt + curcolblknb;
84 }
85 *blkcnt = *blkcnt +1;
86 *LDV= NB+Vblksiz-1;
87 }
89
90 #ifdef __cplusplus
91 }
92 #endif
93
94 #endif