60 #define static2 static
61 #if defined(Add_) || defined(f77IsF2C)
62 #define fortran_mr2d pigemr2do_
63 #define fortran_mr2dnew pigemr2d_
65 #define fortran_mr2dnew PIGEMR2D
66 #define fortran_mr2d PIGEMR2DO
68 #define ilacpy_ ILACPY
70 #define fortran_mr2d pigemr2do
71 #define fortran_mr2dnew pigemr2d
73 #define ilacpy_ ilacpy
75 #define Clacpy Cigelacpy
88 #define BLOCK_CYCLIC_2D 1
93 #define SHIFT(row,sprow,nbrow) ((row)-(sprow)+ ((row) >= (sprow) ? 0 : (nbrow)))
94 #define max(A,B) ((A)>(B)?(A):(B))
95 #define min(A,B) ((A)>(B)?(B):(A))
96 #define DIVUP(a,b) ( ((a)-1) /(b)+1)
97 #define ROUNDUP(a,b) (DIVUP(a,b)*(b))
99 #define malloc mymalloc
101 #define realloc myrealloc
134 #define scanD0 igescanD0
135 #define dispmat igedispmat
136 #define setmemory igesetmemory
137 #define freememory igefreememory
138 #define scan_intervals igescan_intervals
171 for (i = 0; i < m * n; i++, pdata++) {
180 getparam(FILE * f,...)
195 static char buffer[200];
200 f = va_arg(ap, FILE *);
203 next = fgets(buffer, 200, f);
205 fprintf(stderr,
"bad configuration driver file:after line %d\n", nbline);
209 }
while (buffer[0] ==
'#');
211 var = va_arg(ap,
int *);
212 while (var != NULL) {
213 *var = strtol(ptr, &next, 10);
215 fprintf(stderr,
"bad configuration driver file:error line %d\n", nbline);
219 var = va_arg(ap,
int *);
233 fprintf(stderr,
"usage with PVM:xigemr nbproc\n\
234 \t where nbproc is the number of nodes to initialize\n");
237 nproc = atoi(argv[1]);
259 #define nbparameter 24
265 int ia, ja, ib, jb, m, n;
266 int gcontext, context0, context1;
267 int myprow1, myprow0, mypcol0, mypcol1;
270 int *ptrmyblock, *ptrsavemyblock, *ptrmyblockcopy, *ptrmyblockvide;
272 MPI_Init(&argc, &argv);
274 setvbuf(stdout, NULL, _IOLBF, 0);
275 setvbuf(stderr, NULL, _IOLBF, 0);
277 free(malloc(14000000));
287 if ((fp = fopen(
"GEMR2D.dat",
"r")) == NULL) {
288 fprintf(stderr,
"Can't open GEMR2D.dat\n");
291 printf(
"\n// IGEMR2D TESTER for INTEGER //\n");
292 getparam(fp, &nbre, NULL);
293 printf(
"////////// %d tests \n\n", nbre);
294 parameters[0] = nbre;
295 Cigebs2d(gcontext,
"All",
"H", 1, 1, parameters, 1);
297 Cigebr2d(gcontext,
"All",
"H", 1, 1, parameters, 1, 0, 0);
298 nbre = parameters[0];
301 printf(
"\n m n m0 n0 sr0 sc0 i0 j0 p0 q0 nbr0 nbc0 \
302 m1 n1 sr1 sc1 i1 j1 p1 q1 nbr1 nbc1\n\n");
308 fprintf(stderr,
"bonjour,je suis le noeud %d\n", mypnum);
310 while (nbre-- != 0) {
323 printf(
"\t\t************* TEST # %d **********\n",
325 printf(
" %3d %3d %3d %3d %3d %3d %3d %3d \
326 %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d",
333 if (p0 * q0 > nprocs || p1 * q1 > nprocs) {
334 fprintf(stderr,
"not enough nodes:%d processors required\n",
335 max(p0 * q0, p1 * q1));
340 parameters[2] = ma.
nbrow;
341 parameters[3] = ma.
nbcol;
344 parameters[6] = mb.
nbrow;
345 parameters[7] = mb.
nbcol;
346 parameters[8] = ma.
m;
347 parameters[9] = ma.
n;
348 parameters[10] = ma.
sprow;
349 parameters[11] = ma.
spcol;
350 parameters[12] = mb.
sprow;
351 parameters[13] = mb.
spcol;
358 parameters[20] = mb.
m;
359 parameters[21] = mb.
n;
365 ma.
nbrow = parameters[2];
366 ma.
nbcol = parameters[3];
369 mb.
nbrow = parameters[6];
370 mb.
nbcol = parameters[7];
371 ma.
m = parameters[8];
372 ma.
n = parameters[9];
373 ma.
sprow = parameters[10];
374 ma.
spcol = parameters[11];
375 mb.
sprow = parameters[12];
376 mb.
spcol = parameters[13];
383 mb.
m = parameters[20];
384 mb.
n = parameters[21];
393 if (myprow0 >= p0 || mypcol0 >= q0)
394 myprow0 = mypcol0 = -1;
396 if (myprow1 >= p1 || mypcol1 >= q1)
397 myprow1 = mypcol1 = -1;
398 assert((myprow0 < p0 && mypcol0 < q0) || (myprow0 == -1 && mypcol0 == -1));
399 assert((myprow1 < p1 && mypcol1 < q1) || (myprow1 == -1 && mypcol1 == -1));
407 if (myprow0 >= 0 && mypcol0 >= 0) {
413 memcpy((
char *) ptrmyblockcopy, (
char *) ptrmyblock,
414 blocksize0 *
sizeof(
int));
416 for (i = 0; i < blocksize0; i++)
417 ptrmyblockvide[i] = -1;
419 if (myprow1 >= 0 && mypcol1 >= 0) {
426 ptrmyblock, ia, ja, &ma,
427 ptrsavemyblock, ib, jb, &mb, gcontext);
431 ptrsavemyblock, ib, jb, &mb,
432 ptrmyblockvide, ia, ja, &ma, gcontext);
435 if (myprow0 >= 0 && mypcol0 >= 0) {
437 for (i = 0; i < blocksize0; i++) {
447 assert(gi < ma.
m && gj < ma.
n);
450 if (gi < 0 || gj < 0 || gi >= m || gj >= n)
453 ptrmyblockcopy[i] = -1;
455 if (ptrmyblockvide[i] != ptrmyblockcopy[i]) {
457 printf(
"Proc %d : Error element number %d, value = %d , initvalue =%d \n"
458 ,mypnum, i, ptrmyblockvide[i], ptrmyblockcopy[i]);
462 printf(
"Processor %d, has tested %d INTEGER elements,\
463 Number of redistribution errors = %d \n",
464 mypnum, blocksize0, nberrors);
468 Cigsum2d(gcontext,
"All",
"H", 1, 1, &nberrors, 1, 0, 0);
471 printf(
" => Total number of redistribution errors = %d \n",
474 printf(
"TEST PASSED OK\n");
476 if (myprow0 >= 0 && mypcol0 >= 0) {
482 if (myprow1 >= 0 && mypcol1 >= 0) {