MAGMA  magma-1.4.0
Matrix Algebra on GPU and Multicore Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
magma_bulge.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

magma_int_t magma_ceildiv (magma_int_t a, magma_int_t b)
 
magma_int_t magma_bulge_get_nb (magma_int_t n)
 
void cmp_vals (int n, double *wr1, double *wr2, double *nrmI, double *nrm1, double *nrm2)
 
void magma_bulge_findVTAUpos (magma_int_t n, magma_int_t nb, magma_int_t Vblksiz, magma_int_t sweep, magma_int_t st, magma_int_t ldv, magma_int_t *Vpos, magma_int_t *TAUpos)
 
void magma_bulge_findVTpos (magma_int_t n, magma_int_t nb, magma_int_t Vblksiz, magma_int_t sweep, magma_int_t st, magma_int_t ldv, magma_int_t ldt, magma_int_t *Vpos, magma_int_t *Tpos)
 
void magma_bulge_findVTAUTpos (magma_int_t n, magma_int_t nb, magma_int_t Vblksiz, magma_int_t sweep, magma_int_t st, magma_int_t ldv, magma_int_t ldt, magma_int_t *Vpos, magma_int_t *TAUpos, magma_int_t *Tpos, magma_int_t *blkid)
 
void magma_bulge_findpos (magma_int_t n, magma_int_t nb, magma_int_t Vblksiz, magma_int_t sweep, magma_int_t st, magma_int_t *myblkid)
 
void magma_bulge_findpos113 (magma_int_t n, magma_int_t nb, magma_int_t Vblksiz, magma_int_t sweep, magma_int_t st, magma_int_t *myblkid)
 
magma_int_t magma_bulge_get_blkcnt (magma_int_t n, magma_int_t nb, magma_int_t Vblksiz)
 

Function Documentation

void cmp_vals ( int  n,
double *  wr1,
double *  wr2,
double *  nrmI,
double *  nrm1,
double *  nrm2 
)

Definition at line 62 of file bulge_auxiliary.cpp.

63  {
64  int i;
65  double curv, maxv, sumv;
66 
67  maxv = 0.0;
68  sumv = 0.0;
69  for (i = 0; i < n; ++i) {
70 
71  curv = fabs( wr1[i] - wr2[i]);
72  sumv += curv;
73  if (maxv < curv) maxv = curv;
74  }
75 
76  *nrmI = maxv;
77  *nrm1 = sumv;
78  *nrm2 = sqrt( sumv );
79  }
void magma_bulge_findpos ( magma_int_t  n,
magma_int_t  nb,
magma_int_t  Vblksiz,
magma_int_t  sweep,
magma_int_t  st,
magma_int_t myblkid 
)

Definition at line 128 of file bulge_auxiliary.cpp.

References magma_ceildiv().

129  {
130  magma_int_t locblknb, prevblkcnt, prevGblkid;
131  magma_int_t myblknb, nbprevGblk, mastersweep;
132 
133  locblknb = 0;
134  prevblkcnt = 0;
135  myblknb = 0;
136 
137  nbprevGblk = sweep/Vblksiz;
138  for (prevGblkid = 0; prevGblkid < nbprevGblk; prevGblkid++)
139  {
140  mastersweep = prevGblkid * Vblksiz;
141  locblknb = magma_ceildiv((n-(mastersweep+2)),nb);
142  prevblkcnt = prevblkcnt + locblknb;
143  }
144  myblknb = magma_ceildiv((st-sweep),nb);
145  *myblkid = prevblkcnt + myblknb -1;
146  }
int magma_int_t
Definition: magmablas.h:12
magma_int_t magma_ceildiv(magma_int_t a, magma_int_t b)
Definition: magma_bulge.h:16

Here is the call graph for this function:

Here is the caller graph for this function:

void magma_bulge_findpos113 ( magma_int_t  n,
magma_int_t  nb,
magma_int_t  Vblksiz,
magma_int_t  sweep,
magma_int_t  st,
magma_int_t myblkid 
)

Definition at line 81 of file bulge_auxiliary.cpp.

References magma_ceildiv().

82  {
83  magma_int_t prevGblkid, mastersweep;
84  magma_int_t locblknb = 0;
85  magma_int_t prevblkcnt = 0;
86  magma_int_t myblknb = 0;
87  magma_int_t lstGblkid = magma_ceildiv((n-1),Vblksiz)-1;//nbGblk-1;
88  magma_int_t myGblkid = sweep/Vblksiz;
89 
90  // go forward and for each Gblk(a column of blocks) before my Gblk compute its number of blk.
91 
92  //===================================================
93  for (prevGblkid = lstGblkid; prevGblkid > myGblkid; prevGblkid--)
94  {
95  mastersweep = prevGblkid * Vblksiz;
96  if(prevGblkid==lstGblkid)
97  locblknb = magma_ceildiv((n-(mastersweep+1)),nb);
98  else
99  locblknb = magma_ceildiv((n-(mastersweep+2)),nb);
100  prevblkcnt = prevblkcnt + locblknb;
101  }
102  //===================================================
103  /*
104  // for best performance, the if condiiton inside the loop
105  // is only for prevblkid==lastblkid so I can unroll this
106  // out of the loop and so remove the if condition.
107  //===================================================
108  // for prevGblkid==lstGblkid
109  mastersweep = lstGblkid * Vblksiz;
110  locblknb = magma_ceildiv((n-(mastersweep+1)),nb);
111  prevblkcnt = prevblkcnt + locblknb;
112  // the remaining of the loop
113  for (prevGblkid = lstGblkid-1; prevGblkid > myGblkid; prevGblkid--)
114  {
115  mastersweep = prevGblkid * Vblksiz;
116  locblknb = magma_ceildiv((n-(mastersweep+2)),nb);
117  prevblkcnt = prevblkcnt + locblknb;
118  }
119  //===================================================
120  */
121  myblknb = magma_ceildiv((st-sweep),nb);
122  *myblkid = prevblkcnt + myblknb -1;
123  //printf("voici sweep %d lstGblkid %d myGblkid %d prevcnt %d myblknb %d myblkid %d\n", sweep, lstGblkid,myGblkid,prevblkcnt,myblknb,*myblkid );
124  }
int magma_int_t
Definition: magmablas.h:12
magma_int_t magma_ceildiv(magma_int_t a, magma_int_t b)
Definition: magma_bulge.h:16

Here is the call graph for this function:

Here is the caller graph for this function:

void magma_bulge_findVTAUpos ( magma_int_t  n,
magma_int_t  nb,
magma_int_t  Vblksiz,
magma_int_t  sweep,
magma_int_t  st,
magma_int_t  ldv,
magma_int_t Vpos,
magma_int_t TAUpos 
)

Definition at line 148 of file bulge_auxiliary.cpp.

References applyQver, magma_bulge_findpos(), and magma_bulge_findpos113().

150  {
151  magma_int_t myblkid;
152  magma_int_t locj = sweep%Vblksiz;
153 
154  if(applyQver==113)
155  magma_bulge_findpos113(n, nb, Vblksiz, sweep, st, &myblkid);
156  else
157  magma_bulge_findpos(n, nb, Vblksiz, sweep, st, &myblkid);
158 
159  *Vpos = myblkid*Vblksiz*ldv + locj*ldv + locj;
160  *TAUpos = myblkid*Vblksiz + locj;
161  }
void magma_bulge_findpos(magma_int_t n, magma_int_t nb, magma_int_t Vblksiz, magma_int_t sweep, magma_int_t st, magma_int_t *myblkid)
int magma_int_t
Definition: magmablas.h:12
#define applyQver
void magma_bulge_findpos113(magma_int_t n, magma_int_t nb, magma_int_t Vblksiz, magma_int_t sweep, magma_int_t st, magma_int_t *myblkid)

Here is the call graph for this function:

Here is the caller graph for this function:

void magma_bulge_findVTAUTpos ( magma_int_t  n,
magma_int_t  nb,
magma_int_t  Vblksiz,
magma_int_t  sweep,
magma_int_t  st,
magma_int_t  ldv,
magma_int_t  ldt,
magma_int_t Vpos,
magma_int_t TAUpos,
magma_int_t Tpos,
magma_int_t blkid 
)

Definition at line 179 of file bulge_auxiliary.cpp.

References applyQver, magma_bulge_findpos(), and magma_bulge_findpos113().

181  {
182  magma_int_t myblkid;
183  magma_int_t locj = sweep%Vblksiz;
184 
185  if(applyQver==113)
186  magma_bulge_findpos113(n, nb, Vblksiz, sweep, st, &myblkid);
187  else
188  magma_bulge_findpos(n, nb, Vblksiz, sweep, st, &myblkid);
189 
190 
191  *Vpos = myblkid*Vblksiz*ldv + locj*ldv + locj;
192  *TAUpos = myblkid*Vblksiz + locj;
193  *Tpos = myblkid*Vblksiz*ldt + locj*ldt + locj;
194  *blkid = myblkid;
195  }
void magma_bulge_findpos(magma_int_t n, magma_int_t nb, magma_int_t Vblksiz, magma_int_t sweep, magma_int_t st, magma_int_t *myblkid)
int magma_int_t
Definition: magmablas.h:12
#define applyQver
void magma_bulge_findpos113(magma_int_t n, magma_int_t nb, magma_int_t Vblksiz, magma_int_t sweep, magma_int_t st, magma_int_t *myblkid)

Here is the call graph for this function:

Here is the caller graph for this function:

void magma_bulge_findVTpos ( magma_int_t  n,
magma_int_t  nb,
magma_int_t  Vblksiz,
magma_int_t  sweep,
magma_int_t  st,
magma_int_t  ldv,
magma_int_t  ldt,
magma_int_t Vpos,
magma_int_t Tpos 
)

Definition at line 163 of file bulge_auxiliary.cpp.

References applyQver, magma_bulge_findpos(), and magma_bulge_findpos113().

165  {
166  magma_int_t myblkid;
167  magma_int_t locj = sweep%Vblksiz;
168 
169  if(applyQver==113)
170  magma_bulge_findpos113(n, nb, Vblksiz, sweep, st, &myblkid);
171  else
172  magma_bulge_findpos(n, nb, Vblksiz, sweep, st, &myblkid);
173 
174 
175  *Vpos = myblkid*Vblksiz*ldv + locj*ldv + locj;
176  *Tpos = myblkid*Vblksiz*ldt + locj*ldt + locj;
177  }
void magma_bulge_findpos(magma_int_t n, magma_int_t nb, magma_int_t Vblksiz, magma_int_t sweep, magma_int_t st, magma_int_t *myblkid)
int magma_int_t
Definition: magmablas.h:12
#define applyQver
void magma_bulge_findpos113(magma_int_t n, magma_int_t nb, magma_int_t Vblksiz, magma_int_t sweep, magma_int_t st, magma_int_t *myblkid)

Here is the call graph for this function:

Here is the caller graph for this function:

magma_int_t magma_bulge_get_blkcnt ( magma_int_t  n,
magma_int_t  nb,
magma_int_t  Vblksiz 
)

Definition at line 197 of file bulge_auxiliary.cpp.

References magma_ceildiv().

198  {
199  magma_int_t colblk, nbcolblk;
200  magma_int_t myblknb, mastersweep;
201 
202  magma_int_t blkcnt = 0;
203  nbcolblk = magma_ceildiv((n-1),Vblksiz);
204  for (colblk = 0; colblk<nbcolblk; colblk++)
205  {
206  mastersweep = colblk * Vblksiz;
207  if(colblk == (nbcolblk-1))
208  myblknb = magma_ceildiv((n-(mastersweep+1)),nb);
209  else
210  myblknb = magma_ceildiv((n-(mastersweep+2)),nb);
211  blkcnt = blkcnt + myblknb;
212  //printf("voici nbcolblk %d master sweep %d blkcnt %d \n",nbcolblk, mastersweep,*blkcnt);
213  }
214  return blkcnt;
215  }
int magma_int_t
Definition: magmablas.h:12
magma_int_t magma_ceildiv(magma_int_t a, magma_int_t b)
Definition: magma_bulge.h:16

Here is the call graph for this function:

Here is the caller graph for this function:

magma_int_t magma_bulge_get_nb ( magma_int_t  n)
magma_int_t magma_ceildiv ( magma_int_t  a,
magma_int_t  b 
)
inline

Definition at line 16 of file magma_bulge.h.

17  {
18  return (a+b-1)/b;
19  }