| @@ -40,6 +40,7 @@ void torusinit(int *pmyproc, const int pnprocs); · 39 unmodified lines |
| 40 | void ranktoxyz(int rank, int *x, int *y, int *z); | 40 | void ranktoxyz(int rank, int *x, int *y, int *z); |
| 41 | int xyztorank(int x, int y, int z); | 41 | int xyztorank(int x, int y, int z); |
| 42 | extern int x, y, z, xsize, ysize, zsize; | 42 | extern int x, y, z, xsize, ysize, zsize; |
| | 43 | u64int tbget(void); |
| 43 | | 44 | |
| 44 | void | 45 | void |
| 45 | buf_add(struct bufpacket *new) | 46 | buf_add(struct bufpacket *new) |
| @@ -282,7 +283,7 @@ int reduce_end ( void *buf, int num, MPI_Datatype datatype, int /*root*/, · 236 unmodified lines |
| 282 | torustag[TAGtag] = reducetag; | 283 | torustag[TAGtag] = reducetag; |
| 283 | torustag[TAGsource] = myproc; | 284 | torustag[TAGsource] = myproc; |
| 284 | | 285 | |
| 285 | if(rompidebug&4) print("%lld reduce_end: %d(%d, %d, %d)\n", nsec(), myproc, x, y, z); | 286 | if(rompidebug&4) print("%lld reduce_end: %d(%d, %d, %d)\n", tbget(), myproc, x, y, z); |
| 286 | if (myproc) { | 287 | if (myproc) { |
| 287 | /* who we get it from depends on who we are. */ | 288 | /* who we get it from depends on who we are. */ |
| 288 | /* this shows some bad design. We compute x,y,z, turn it into rank, | 289 | /* this shows some bad design. We compute x,y,z, turn it into rank, |
| @@ -298,9 +299,9 @@ int reduce_end ( void *buf, int num, MPI_Datatype datatype, int /*root*/, · 9 unmodified lines |
| 298 | else if (x) | 299 | else if (x) |
| 299 | fromz = fromy = fromx = 0; | 300 | fromz = fromy = fromx = 0; |
| 300 | fromrank = xyztorank(fromx, fromy, fromz); | 301 | fromrank = xyztorank(fromx, fromy, fromz); |
| 301 | if(rompidebug&4) print("%lld reduce_end: %d(%d,%d,%d): wait from (%d, %d, %d)\n", nsec(), myproc, x, y, z, fromx, fromy, fromz); | 302 | if(rompidebug&4) print("%lld reduce_end: %d(%d,%d,%d): wait from (%d, %d, %d)\n", tbget(), myproc, x, y, z, fromx, fromy, fromz); |
| 302 | MPI_Recv(buf, 1, MPI_INT, fromrank, reducetag, MPI_COMM_WORLD, status); | 303 | MPI_Recv(buf, 1, MPI_INT, fromrank, reducetag, MPI_COMM_WORLD, status); |
| 303 | if(rompidebug&4) print("%lld reduce_end: %d: Got from %d\n", nsec(), myproc, fromrank); | 304 | if(rompidebug&4) print("%lld reduce_end: %d: Got from %d\n", tbget(), myproc, fromrank); |
| 304 | } | 305 | } |
| 305 | | 306 | |
| 306 | /* OK, we got it, we just need to do one send to our "axis" (of evil?) */ | 307 | /* OK, we got it, we just need to do one send to our "axis" (of evil?) */ |
| @@ -311,24 +312,24 @@ int reduce_end ( void *buf, int num, MPI_Datatype datatype, int /*root*/, · 4 unmodified lines |
| 311 | */ | 312 | */ |
| 312 | if (z) { | 313 | if (z) { |
| 313 | } else if (y) { | 314 | } else if (y) { |
| 314 | if(rompidebug&4) print("%lld reduce_end %d(%d, %d, %d): send to (%d, %d, %d)\n", nsec(), myproc, x, y, z, x, y, zsize-1); | 315 | if(rompidebug&4) print("%lld reduce_end %d(%d, %d, %d): send to (%d, %d, %d)\n", tbget(), myproc, x, y, z, x, y, zsize-1); |
| 315 | torustag[TAGsource] = myproc; | 316 | torustag[TAGsource] = myproc; |
| 316 | torussend(buf, count, x, y, zsize-1, 1, torustag, sizeof(torustag)); | 317 | torussend(buf, count, x, y, zsize-1, 1, torustag, sizeof(torustag)); |
| 317 | } | 318 | } |
| 318 | else if (x) { | 319 | else if (x) { |
| 319 | /* send down BOTH our y and z axis */ | 320 | /* send down BOTH our y and z axis */ |
| 320 | torustag[TAGsource] = myproc; | 321 | torustag[TAGsource] = myproc; |
| 321 | if(rompidebug&4) print("%lld reduce_end %d(%d, %d, %d): send to (%d, %d, %d)\n", nsec(), myproc, x, y, z, x, ysize-1, 0); | 322 | if(rompidebug&4) print("%lld reduce_end %d(%d, %d, %d): send to (%d, %d, %d)\n", tbget(), myproc, x, y, z, x, ysize-1, 0); |
| 322 | torussend(buf, count, x, ysize-1, 0, 1, torustag, sizeof(torustag)); | 323 | torussend(buf, count, x, ysize-1, 0, 1, torustag, sizeof(torustag)); |
| 323 | if(rompidebug&4) print("%lld reduce_end %d(%d, %d, %d): send to (%d, %d, %d)\n", nsec(), myproc, x, y, z, x, y, zsize-1); | 324 | if(rompidebug&4) print("%lld reduce_end %d(%d, %d, %d): send to (%d, %d, %d)\n", tbget(), myproc, x, y, z, x, y, zsize-1); |
| 324 | torussend(buf, count, x, y, zsize-1, 1, torustag, sizeof(torustag)); | 325 | torussend(buf, count, x, y, zsize-1, 1, torustag, sizeof(torustag)); |
| 325 | } else { | 326 | } else { |
| 326 | /* send down x, y, z */ | 327 | /* send down x, y, z */ |
| 327 | if(rompidebug&4) print("%lld reduce_end %d(%d, %d, %d): send to (%d, %d, %d)\n", nsec(), myproc, x, y, z, xsize-1, 0, 0); | 328 | if(rompidebug&4) print("%lld reduce_end %d(%d, %d, %d): send to (%d, %d, %d)\n", tbget(), myproc, x, y, z, xsize-1, 0, 0); |
| 328 | torussend(buf, count, xsize-1, 0, 0, 1, torustag, sizeof(torustag)); | 329 | torussend(buf, count, xsize-1, 0, 0, 1, torustag, sizeof(torustag)); |
| 329 | if(rompidebug&4) print("%lld reduce_end %d(%d, %d, %d): send to (%d, %d, %d)\n", nsec(), myproc, x, y, z, x, ysize-1, 0); | 330 | if(rompidebug&4) print("%lld reduce_end %d(%d, %d, %d): send to (%d, %d, %d)\n", tbget(), myproc, x, y, z, x, ysize-1, 0); |
| 330 | torussend(buf, count, x, ysize-1, 0, 1, torustag, sizeof(torustag)); | 331 | torussend(buf, count, x, ysize-1, 0, 1, torustag, sizeof(torustag)); |
| 331 | if(rompidebug&4) print("%lld reduce_end %d(%d, %d, %d): send to (%d, %d, %d)\n", nsec(), myproc, x, y, z, x, y, zsize-1); | 332 | if(rompidebug&4) print("%lld reduce_end %d(%d, %d, %d): send to (%d, %d, %d)\n", tbget(), myproc, x, y, z, x, y, zsize-1); |
| 332 | torussend(buf, count, x, y, zsize-1, 1, torustag, sizeof(torustag)); | 333 | torussend(buf, count, x, y, zsize-1, 1, torustag, sizeof(torustag)); |
| 333 | } | 334 | } |
| 334 | | 335 | |
| @@ -344,7 +345,7 @@ opsum(void *dst, void *src, int) · 9 unmodified lines |
| 344 | int *is = src; | 345 | int *is = src; |
| 345 | int *id = dst; | 346 | int *id = dst; |
| 346 | int tmp = *is; | 347 | int tmp = *is; |
| 347 | if (rompidebug & 4) print("%lld %d(%d,%d,%d): SUM %d+%d=%d\n", nsec(), myproc, x,y,z,*id, *is, *id+tmp); | 348 | if (rompidebug & 4) print("%lld %d(%d,%d,%d): SUM %d+%d=%d\n", tbget(), myproc, x,y,z,*id, *is, *id+tmp); |
| 348 | *id += tmp; | 349 | *id += tmp; |
| 349 | return *id; | 350 | return *id; |
| 350 | } | 351 | } |
| @@ -397,7 +398,7 @@ int MPI_Reduce ( void *sendbuf, void *recvbuf, int count, · 46 unmodified lines |
| 397 | if (z) { | 398 | if (z) { |
| 398 | torank = xyztorank(x,y,0); | 399 | torank = xyztorank(x,y,0); |
| 399 | if (rompidebug&4) | 400 | if (rompidebug&4) |
| 400 | print("%lld %d:(%d,%d,%d) sends %d to %d\n", nsec(), myproc, x, y, z, myproc, torank); | 401 | print("%lld %d:(%d,%d,%d) sends %d to %d\n", tbget(), myproc, x, y, z, myproc, torank); |
| 401 | MPI_Send(tmp, 1, datatype, torank, 1, comm); | 402 | MPI_Send(tmp, 1, datatype, torank, 1, comm); |
| 402 | } else { | 403 | } else { |
| 403 | /* gather up all our z >0 data */ | 404 | /* gather up all our z >0 data */ |
| @@ -407,14 +408,14 @@ int MPI_Reduce ( void *sendbuf, void *recvbuf, int count, · 3 unmodified lines |
| 407 | op(tmp, recvbuf, count); | 408 | op(tmp, recvbuf, count); |
| 408 | } | 409 | } |
| 409 | if (rompidebug&4) | 410 | if (rompidebug&4) |
| 410 | print("%lld AFTER Z: %d(%d, %d, %d): %d\n", nsec(), myproc, x, y, z, sum[0]); | 411 | print("%lld AFTER Z: %d(%d, %d, %d): %d\n", tbget(), myproc, x, y, z, sum[0]); |
| 411 | | 412 | |
| 412 | /* y? y o y? */ | 413 | /* y? y o y? */ |
| 413 | if (y) { | 414 | if (y) { |
| 414 | torank = xyztorank(x,0,0); | 415 | torank = xyztorank(x,0,0); |
| 415 | /* send to our parent */ | 416 | /* send to our parent */ |
| 416 | if (rompidebug&4) | 417 | if (rompidebug&4) |
| 417 | print("%lld %d:(%d,%d,%d) sends %d to %d\n", nsec(), myproc, x, y, z, sum[0], torank); | 418 | print("%lld %d:(%d,%d,%d) sends %d to %d\n", tbget(), myproc, x, y, z, sum[0], torank); |
| 418 | MPI_Send(tmp, 1, datatype, torank, 1, comm); | 419 | MPI_Send(tmp, 1, datatype, torank, 1, comm); |
| 419 | } else { | 420 | } else { |
| 420 | /* This is the vector along the X axis. All myprocs, including (0,0,0), gather up along | 421 | /* This is the vector along the X axis. All myprocs, including (0,0,0), gather up along |
| @@ -429,11 +430,11 @@ int MPI_Reduce ( void *sendbuf, void *recvbuf, int count, · 8 unmodified lines |
| 429 | op(tmp, recvbuf, count); | 430 | op(tmp, recvbuf, count); |
| 430 | } | 431 | } |
| 431 | if (rompidebug&4) | 432 | if (rompidebug&4) |
| 432 | print("%lld %d:(%d,%d,%d) gets %d accum %d\n", nsec(), myproc, x, y, z, nsum[0], sum[0]); | 433 | print("%lld %d:(%d,%d,%d) gets %d accum %d\n", tbget(), myproc, x, y, z, nsum[0], sum[0]); |
| 433 | if (x) { | 434 | if (x) { |
| 434 | /* send to our parent */ | 435 | /* send to our parent */ |
| 435 | if (rompidebug&4) | 436 | if (rompidebug&4) |
| 436 | print("%lld %d:(%d,%d,%d) sends %d to %d\n", nsec(), myproc, x, y, z, sum[0], torank); | 437 | print("%lld %d:(%d,%d,%d) sends %d to %d\n", tbget(), myproc, x, y, z, sum[0], torank); |
| 437 | MPI_Send(tmp, 1, datatype, torank, 1, comm); | 438 | MPI_Send(tmp, 1, datatype, torank, 1, comm); |
| 438 | } else { | 439 | } else { |
| 439 | /* sum contains the sum from our y axis above */ | 440 | /* sum contains the sum from our y axis above */ |
| @@ -441,7 +442,7 @@ int MPI_Reduce ( void *sendbuf, void *recvbuf, int count, · 1 unmodified line |
| 441 | MPI_Recv(recvbuf, 1, datatype, i, 1, comm, &status); | 442 | MPI_Recv(recvbuf, 1, datatype, i, 1, comm, &status); |
| 442 | op(tmp, recvbuf, count); | 443 | op(tmp, recvbuf, count); |
| 443 | if (rompidebug&4) | 444 | if (rompidebug&4) |
| 444 | print("%lld %d:(%d,%d,%d) recv %d to %d\n", nsec(), myproc, x, y, z, sum[0], i); | 445 | print("%lld %d:(%d,%d,%d) recv %d to %d\n", tbget(), myproc, x, y, z, sum[0], i); |
| 445 | } | 446 | } |
| 446 | } | 447 | } |
| 447 | } | 448 | } |
| @@ -450,7 +451,7 @@ int MPI_Reduce ( void *sendbuf, void *recvbuf, int count, · 2 unmodified lines |
| 450 | if (! myproc){ | 451 | if (! myproc){ |
| 451 | memmove(recvbuf, tmp, nbytes); | 452 | memmove(recvbuf, tmp, nbytes); |
| 452 | if (rompidebug&4) | 453 | if (rompidebug&4) |
| 453 | print("%lld reduce: %d(%d,%d,%d): gather done, send SUM %d\n", nsec(), myproc, x, y, z, sum[0]); | 454 | print("%lld reduce: %d(%d,%d,%d): gather done, send SUM %d\n", tbget(), myproc, x, y, z, sum[0]); |
| 454 | } | 455 | } |
| 455 | | 456 | |
| 456 | return reduce_end (recvbuf, count, datatype, root, comm, &status); | 457 | return reduce_end (recvbuf, count, datatype, root, comm, &status); |