int i, j, rank, nranks, peer, bufsize, errors;
double *win_buf, *src_buf, *dst_buf;
MPI_Win buf_win;
int i, j, rank, nranks, peer, bufsize, errors;
double *win_buf, *src_buf, *dst_buf;
MPI_Win buf_win;
- int idx_rem[SUB_YDIM];
- int blk_len[SUB_YDIM];
- MPI_Datatype src_type, dst_type;
-
- for (j = 0; j < SUB_YDIM; j++) {
- idx_rem[j] = j*XDIM;
- blk_len[j] = SUB_XDIM;
- }
-
- MPI_Type_indexed(SUB_YDIM, blk_len, idx_rem, MPI_DOUBLE, &src_type);
- MPI_Type_indexed(SUB_YDIM, blk_len, idx_rem, MPI_DOUBLE, &dst_type);
-
- MPI_Type_commit(&src_type);
- MPI_Type_commit(&dst_type);
-
- /* PUT */
- MPI_Win_lock(MPI_LOCK_EXCLUSIVE, peer, 0, buf_win);
- MPI_Get_accumulate(src_buf, 1, src_type, dst_buf, 1, src_type, peer, 0,
- 1, dst_type, MPI_REPLACE, buf_win);
- MPI_Win_unlock(peer, buf_win);
-
- /* GET */
- MPI_Win_lock(MPI_LOCK_EXCLUSIVE, peer, 0, buf_win);
- MPI_Get_accumulate(src_buf, 1, src_type, dst_buf, 1, src_type, peer, 0,
- 1, dst_type, MPI_NO_OP, buf_win);
- MPI_Win_unlock(peer, buf_win);
-
- MPI_Type_free(&src_type);
- MPI_Type_free(&dst_type);
+ int idx_rem[SUB_YDIM];
+ int blk_len[SUB_YDIM];
+ MPI_Datatype src_type, dst_type;
+
+ for (j = 0; j < SUB_YDIM; j++) {
+ idx_rem[j] = j * XDIM;
+ blk_len[j] = SUB_XDIM;
+ }
+
+ MPI_Type_indexed(SUB_YDIM, blk_len, idx_rem, MPI_DOUBLE, &src_type);
+ MPI_Type_indexed(SUB_YDIM, blk_len, idx_rem, MPI_DOUBLE, &dst_type);
+
+ MPI_Type_commit(&src_type);
+ MPI_Type_commit(&dst_type);
+
+ /* PUT */
+ MPI_Win_lock(MPI_LOCK_EXCLUSIVE, peer, 0, buf_win);
+ MPI_Get_accumulate(src_buf, 1, src_type, dst_buf, 1, src_type, peer, 0,
+ 1, dst_type, MPI_REPLACE, buf_win);
+ MPI_Win_unlock(peer, buf_win);
+
+ /* GET */
+ MPI_Win_lock(MPI_LOCK_EXCLUSIVE, peer, 0, buf_win);
+ MPI_Get_accumulate(src_buf, 1, src_type, dst_buf, 1, src_type, peer, 0,
+ 1, dst_type, MPI_NO_OP, buf_win);
+ MPI_Win_unlock(peer, buf_win);
+
+ MPI_Type_free(&src_type);
+ MPI_Type_free(&dst_type);
- for (j = 0; j < SUB_YDIM; j++) {
- const double actual = *(win_buf + i + j*XDIM);
- const double expected = (1.0 + ((rank+nranks-1)%nranks));
- if (fabs(actual - expected) > 1.0e-10) {
- SQUELCH( printf("%d: Data validation failed at [%d, %d] expected=%f actual=%f\n",
- rank, j, i, expected, actual); );
- errors++;
- fflush(stdout);
+ for (j = 0; j < SUB_YDIM; j++) {
+ const double actual = *(win_buf + i + j * XDIM);
+ const double expected = (1.0 + ((rank + nranks - 1) % nranks));
+ if (fabs(actual - expected) > 1.0e-10) {
+ SQUELCH(printf("%d: Data validation failed at [%d, %d] expected=%f actual=%f\n",
+ rank, j, i, expected, actual););
+ errors++;
+ fflush(stdout);
+ }
- for (j = 0; j < SUB_YDIM; j++) {
- const double actual = *(win_buf + i + j*XDIM);
- const double expected = -1.0;
- if (fabs(actual - expected) > 1.0e-10) {
- SQUELCH( printf("%d: Data validation failed at [%d, %d] expected=%f actual=%f\n",
- rank, j, i, expected, actual); );
- errors++;
- fflush(stdout);
+ for (j = 0; j < SUB_YDIM; j++) {
+ const double actual = *(win_buf + i + j * XDIM);
+ const double expected = -1.0;
+ if (fabs(actual - expected) > 1.0e-10) {
+ SQUELCH(printf("%d: Data validation failed at [%d, %d] expected=%f actual=%f\n",
+ rank, j, i, expected, actual););
+ errors++;
+ fflush(stdout);
+ }
- for (j = SUB_YDIM; j < YDIM; j++) {
- const double actual = *(win_buf + i + j*XDIM);
- const double expected = -1.0;
- if (fabs(actual - expected) > 1.0e-10) {
- SQUELCH( printf("%d: Data validation failed at [%d, %d] expected=%f actual=%f\n",
- rank, j, i, expected, actual); );
- errors++;
- fflush(stdout);
+ for (j = SUB_YDIM; j < YDIM; j++) {
+ const double actual = *(win_buf + i + j * XDIM);
+ const double expected = -1.0;
+ if (fabs(actual - expected) > 1.0e-10) {
+ SQUELCH(printf("%d: Data validation failed at [%d, %d] expected=%f actual=%f\n",
+ rank, j, i, expected, actual););
+ errors++;
+ fflush(stdout);
+ }