- MPI_Buffer_attach( buf+align, BUFSIZE);
-
- for (j=0; j<10; j++) {
- for (i=0; i<10; i++) {
- a[i] = (rank + 10 * j) * size + i;
- }
- MPI_Bsend( a, 10, MPI_INT, 0, 27+j, MPI_COMM_WORLD );
- }
- if (rank == 0) {
-
- for (i=0; i<size; i++) {
- for (j=0; j<10; j++) {
- int k;
- status.MPI_TAG = -10;
- status.MPI_SOURCE = -20;
- MPI_Recv( b, 10, MPI_INT, i, 27+j, MPI_COMM_WORLD, &status );
-
- if (status.MPI_TAG != 27+j) {
- errs ++;
- printf( "Wrong tag = %d\n", status.MPI_TAG );
- }
- if (status.MPI_SOURCE != i) {
- errs++;
- printf( "Wrong source = %d\n", status.MPI_SOURCE );
- }
- for (k=0; k<10; k++) {
- if (b[k] != (i + 10 * j) * size + k) {
- errs++;
- printf( "(Align=%d) received b[%d] = %d (expected %d) from %d tag %d\n",
- align, k, b[k], (i+10*j), i, 27+j );
- }
- }
- }
- }
- }
- MPI_Buffer_detach( &bptr, &bl );
- if (bptr != buf+align) {
- errs++;
- printf( "Did not recieve the same buffer on detach that was provided on init (%p vs %p)\n", bptr, buf );
- }
+ MPI_Buffer_attach(buf + align, BUFSIZE);
+
+ for (j = 0; j < 10; j++) {
+ for (i = 0; i < 10; i++) {
+ a[i] = (rank + 10 * j) * size + i;
+ }
+ MPI_Bsend(a, 10, MPI_INT, 0, 27 + j, MPI_COMM_WORLD);
+ }
+ if (rank == 0) {
+
+ for (i = 0; i < size; i++) {
+ for (j = 0; j < 10; j++) {
+ int k;
+ status.MPI_TAG = -10;
+ status.MPI_SOURCE = -20;
+ MPI_Recv(b, 10, MPI_INT, i, 27 + j, MPI_COMM_WORLD, &status);
+
+ if (status.MPI_TAG != 27 + j) {
+ errs++;
+ printf("Wrong tag = %d\n", status.MPI_TAG);
+ }
+ if (status.MPI_SOURCE != i) {
+ errs++;
+ printf("Wrong source = %d\n", status.MPI_SOURCE);
+ }
+ for (k = 0; k < 10; k++) {
+ if (b[k] != (i + 10 * j) * size + k) {
+ errs++;
+ printf("(Align=%d) received b[%d] = %d (expected %d) from %d tag %d\n",
+ align, k, b[k], (i + 10 * j), i, 27 + j);
+ }
+ }
+ }
+ }
+ }
+ MPI_Buffer_detach(&bptr, &bl);
+ if (bptr != buf + align) {
+ errs++;
+ printf
+ ("Did not recieve the same buffer on detach that was provided on init (%p vs %p)\n",
+ bptr, buf);
+ }