Skip to content

Commit a4250d9

Browse files
author
Roman Gruber
committed
search/replace on whole codebase: MPI_COMM_WORLD -> app()->mpi.comm
1 parent 6822bb3 commit a4250d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+341
-341
lines changed

src/bin/benchmark.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ int main(int argc, char *argv[]) {
102102
#else
103103
MPI_Init(&argc, &argv);
104104
#endif
105-
MPI_Comm_rank(MPI_COMM_WORLD, &g_proc_id);
105+
MPI_Comm_rank(app()->mpi.comm, &g_proc_id);
106106

107107
#else
108108
g_proc_id = 0;
@@ -234,7 +234,7 @@ int main(int argc, char *argv[]) {
234234
antioptaway = 0.0;
235235
/* compute approximately how many applications we need to do to get a reliable measurement */
236236
#ifdef TM_USE_MPI
237-
MPI_Barrier(MPI_COMM_WORLD);
237+
MPI_Barrier(app()->mpi.comm);
238238
#endif
239239
t1 = gettime();
240240
for (j = 0; j < j_max; j++) {
@@ -248,14 +248,14 @@ int main(int argc, char *argv[]) {
248248
// division by g_nproc because we will average over processes
249249
j = (int)(ceil(j_max * 31.0 / dt / g_nproc));
250250
#ifdef TM_USE_MPI
251-
MPI_Allreduce(&j, &j_max, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
251+
MPI_Allreduce(&j, &j_max, 1, MPI_INT, MPI_SUM, app()->mpi.comm);
252252
#else
253253
j_max = j;
254254
#endif
255255

256256
/* perform the actual benchmark */
257257
#ifdef TM_USE_MPI
258-
MPI_Barrier(MPI_COMM_WORLD);
258+
MPI_Barrier(app()->mpi.comm);
259259
#endif
260260
t1 = gettime();
261261
antioptaway = 0.0;
@@ -268,14 +268,14 @@ int main(int argc, char *argv[]) {
268268
}
269269
dt = gettime() - t1;
270270
#ifdef TM_USE_MPI
271-
MPI_Allreduce(&dt, &sdt, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
271+
MPI_Allreduce(&dt, &sdt, 1, MPI_DOUBLE, MPI_SUM, app()->mpi.comm);
272272
#else
273273
sdt = dt;
274274
#endif
275275

276276
qdt = dt * dt;
277277
#ifdef TM_USE_MPI
278-
MPI_Allreduce(&qdt, &sqdt, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
278+
MPI_Allreduce(&qdt, &sqdt, 1, MPI_DOUBLE, MPI_SUM, app()->mpi.comm);
279279
#else
280280
sqdt = qdt;
281281
#endif
@@ -321,9 +321,9 @@ int main(int argc, char *argv[]) {
321321
dt2 = t2 - t1;
322322
/* compute the bandwidth */
323323
dt = dts - dt2;
324-
MPI_Allreduce(&dt, &sdt, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
324+
MPI_Allreduce(&dt, &sdt, 1, MPI_DOUBLE, MPI_SUM, app()->mpi.comm);
325325
sdt = sdt / ((double)g_nproc);
326-
MPI_Allreduce(&dt2, &dt, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
326+
MPI_Allreduce(&dt2, &dt, 1, MPI_DOUBLE, MPI_SUM, app()->mpi.comm);
327327
dt = dt / ((double)g_nproc);
328328
dt = 1.0e6f * dt / ((double)(k_max * j_max * (VOLUME)));
329329
if (g_proc_id == 0) {
@@ -365,7 +365,7 @@ int main(int argc, char *argv[]) {
365365

366366
/* estimate a reasonable number of applications to get a reliable measurement */
367367
#ifdef TM_USE_MPI
368-
MPI_Barrier(MPI_COMM_WORLD);
368+
MPI_Barrier(app()->mpi.comm);
369369
#endif
370370
t1 = gettime();
371371
for (j = 0; j < j_max; j++) {
@@ -379,14 +379,14 @@ int main(int argc, char *argv[]) {
379379
// division by g_nproc because we will average over processes using MPI_SUM
380380
j = (int)(ceil(j_max * 31.0 / dt / g_nproc));
381381
#ifdef TM_USE_MPI
382-
MPI_Allreduce(&j, &j_max, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
382+
MPI_Allreduce(&j, &j_max, 1, MPI_INT, MPI_SUM, app()->mpi.comm);
383383
#else
384384
j_max = j;
385385
#endif
386386

387387
/* perform the actual measurement */
388388
#ifdef TM_USE_MPI
389-
MPI_Barrier(MPI_COMM_WORLD);
389+
MPI_Barrier(app()->mpi.comm);
390390
#endif
391391
t1 = gettime();
392392
for (j = 0; j < j_max; j++) {
@@ -398,13 +398,13 @@ int main(int argc, char *argv[]) {
398398
t2 = gettime();
399399
dt = t2 - t1;
400400
#ifdef TM_USE_MPI
401-
MPI_Allreduce(&dt, &sdt, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
401+
MPI_Allreduce(&dt, &sdt, 1, MPI_DOUBLE, MPI_SUM, app()->mpi.comm);
402402
#else
403403
sdt = dt;
404404
#endif
405405
qdt = dt * dt;
406406
#ifdef TM_USE_MPI
407-
MPI_Allreduce(&qdt, &sqdt, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
407+
MPI_Allreduce(&qdt, &sqdt, 1, MPI_DOUBLE, MPI_SUM, app()->mpi.comm);
408408
#else
409409
sqdt = qdt;
410410
#endif
@@ -451,7 +451,7 @@ int main(int argc, char *argv[]) {
451451
free_spinor_field();
452452
free_moment_field();
453453
#ifdef TM_USE_MPI
454-
MPI_Barrier(MPI_COMM_WORLD);
454+
MPI_Barrier(app()->mpi.comm);
455455
MPI_Finalize();
456456
#endif
457457
return (0);

src/bin/deriv_mg_tune.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ int main(int argc, char *argv[]) {
357357
_endQuda();
358358
#endif
359359
#ifdef TM_USE_MPI
360-
MPI_Barrier(MPI_COMM_WORLD);
360+
MPI_Barrier(app()->mpi.comm);
361361
MPI_Finalize();
362362
#endif
363363

src/bin/hmc_tm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ int main(int argc, char *argv[]) {
479479

480480
sleep(io_timeout);
481481
#ifdef TM_USE_MPI
482-
MPI_Barrier(MPI_COMM_WORLD);
482+
MPI_Barrier(app()->mpi.comm);
483483
#endif
484484
}
485485
/* Now move .conf.tmp into place */
@@ -528,7 +528,7 @@ int main(int argc, char *argv[]) {
528528
}
529529

530530
#ifdef TM_USE_MPI
531-
MPI_Barrier(MPI_COMM_WORLD);
531+
MPI_Barrier(app()->mpi.comm);
532532
#endif
533533
if (ix == 0 && g_proc_id == 0) {
534534
countfile = fopen("history_hmc_tm", "a");
@@ -581,7 +581,7 @@ int main(int argc, char *argv[]) {
581581
_endQuda();
582582
#endif
583583
#ifdef TM_USE_MPI
584-
MPI_Barrier(MPI_COMM_WORLD);
584+
MPI_Barrier(app()->mpi.comm);
585585
MPI_Finalize();
586586
#endif
587587

src/bin/invert.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ int main(int argc, char *argv[]) {
448448
_endQuda();
449449
#endif
450450
#ifdef TM_USE_MPI
451-
MPI_Barrier(MPI_COMM_WORLD);
451+
MPI_Barrier(app()->mpi.comm);
452452
MPI_Finalize();
453453
#endif
454454
return (0);

src/bin/offline_measurement.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ int main(int argc, char *argv[]) {
297297
free(input_filename);
298298

299299
#ifdef TM_USE_MPI
300-
MPI_Barrier(MPI_COMM_WORLD);
300+
MPI_Barrier(app()->mpi.comm);
301301
MPI_Finalize();
302302
#endif
303303
return (0);

src/bin/tests/hopping_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ int main(int argc, char *argv[]) {
318318
}
319319

320320
#ifdef TM_USE_MPI
321-
MPI_Barrier(MPI_COMM_WORLD);
321+
MPI_Barrier(app()->mpi.comm);
322322
MPI_Finalize();
323323
#endif
324324
}

src/bin/tests/qphix_test_Dslash.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ int main(int argc, char* argv[]) {
221221
source_location, 12345 /* seed */);
222222

223223
#ifdef TM_USE_MPI
224-
MPI_Barrier(MPI_COMM_WORLD);
224+
MPI_Barrier(app()->mpi.comm);
225225
#endif
226226

227227
tm_t1 = gettime();
@@ -231,7 +231,7 @@ int main(int argc, char* argv[]) {
231231
tm_t2 = gettime();
232232

233233
#ifdef TM_USE_MPI
234-
MPI_Barrier(MPI_COMM_WORLD);
234+
MPI_Barrier(app()->mpi.comm);
235235
#endif
236236
q_t1 = gettime();
237237
Mfull_qphix(qphix_out_cb_spinors[0], qphix_out_cb_spinors[1], op->sr0, op->sr1, op->type);
@@ -297,15 +297,15 @@ int main(int argc, char* argv[]) {
297297
free_spinor_field();
298298
free_moment_field();
299299
#ifdef TM_USE_MPI
300-
MPI_Barrier(MPI_COMM_WORLD);
300+
MPI_Barrier(app()->mpi.comm);
301301
MPI_Finalize();
302302
#endif
303303
return (failed);
304304
}
305305

306306
double compare_spinors(spinor* s1, spinor* s2) {
307307
#ifdef TM_USE_MPI
308-
MPI_Barrier(MPI_COMM_WORLD);
308+
MPI_Barrier(app()->mpi.comm);
309309
#endif
310310
int coords[4];
311311
int x, y, z, t, id = 0;
@@ -352,7 +352,7 @@ double compare_spinors(spinor* s1, spinor* s2) {
352352
}
353353
}
354354
#ifdef TM_USE_MPI
355-
MPI_Barrier(MPI_COMM_WORLD);
355+
MPI_Barrier(app()->mpi.comm);
356356
#endif
357357
} // z
358358
} // y
@@ -361,7 +361,7 @@ double compare_spinors(spinor* s1, spinor* s2) {
361361
} // if( SourceInfo.type == SRC_TYPE_POINT )
362362

363363
#ifdef TM_USE_MPI
364-
MPI_Barrier(MPI_COMM_WORLD);
364+
MPI_Barrier(app()->mpi.comm);
365365
#endif
366366
if (g_proc_id == 0) {
367367
printf("\n");
@@ -376,7 +376,7 @@ double compare_spinors(spinor* s1, spinor* s2) {
376376
double squarenorm = diff_and_square_norm(s1, s2, VOLUME);
377377

378378
#ifdef TM_USE_MPI
379-
MPI_Barrier(MPI_COMM_WORLD);
379+
MPI_Barrier(app()->mpi.comm);
380380
#endif
381381
id = 0;
382382
for (int t_global = 0; t_global < g_nproc_t * T; t_global++) {
@@ -408,7 +408,7 @@ double compare_spinors(spinor* s1, spinor* s2) {
408408
}
409409
}
410410
#ifdef TM_USE_MPI
411-
MPI_Barrier(MPI_COMM_WORLD);
411+
MPI_Barrier(app()->mpi.comm);
412412
#endif
413413
} // z
414414
} // y

src/bin/tests/test_eigenvalues.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,14 +390,14 @@ int main(int argc, char *argv[]) {
390390
}
391391
rlxd_get(rlxd_state);
392392
#ifdef TM_USE_MPI
393-
MPI_Send(&rlxd_state[0], 105, MPI_INT, 1, 99, MPI_COMM_WORLD);
394-
MPI_Recv(&rlxd_state[0], 105, MPI_INT, g_nproc - 1, 99, MPI_COMM_WORLD, &status);
393+
MPI_Send(&rlxd_state[0], 105, MPI_INT, 1, 99, app()->mpi.comm);
394+
MPI_Recv(&rlxd_state[0], 105, MPI_INT, g_nproc - 1, 99, app()->mpi.comm, &status);
395395
rlxd_reset(rlxd_state);
396396
#endif
397397
}
398398
#ifdef TM_USE_MPI
399399
else {
400-
MPI_Recv(&rlxd_state[0], 105, MPI_INT, g_proc_id - 1, 99, MPI_COMM_WORLD, &status);
400+
MPI_Recv(&rlxd_state[0], 105, MPI_INT, g_proc_id - 1, 99, app()->mpi.comm, &status);
401401
rlxd_reset(rlxd_state);
402402
/* hot */
403403
if (startoption == 1) {
@@ -408,7 +408,7 @@ int main(int argc, char *argv[]) {
408408
k = 0;
409409
}
410410
rlxd_get(rlxd_state);
411-
MPI_Send(&rlxd_state[0], 105, MPI_INT, k, 99, MPI_COMM_WORLD);
411+
MPI_Send(&rlxd_state[0], 105, MPI_INT, k, 99, app()->mpi.comm);
412412
}
413413
#endif
414414

src/lib/DDalphaAMG_interface.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ static int MG_pre_solve(su3 **gf) {
350350
MG_init();
351351
mg_initialized = 1;
352352
if (g_proc_id == 0) printf("TM_USE_DDalphaAMG initialized\n");
353-
MPI_Barrier(MPI_COMM_WORLD);
353+
MPI_Barrier(app()->mpi.comm);
354354
}
355355

356356
if (mg_update_gauge == 1) {
@@ -1243,7 +1243,7 @@ int MG_solver(spinor *const phi_new, spinor *const phi_old, const double precisi
12431243
if (g_proc_id == 0) printf("ERROR: solver didn't converge after two trials!! Aborting... \n");
12441244
// TODO: handle abort
12451245
DDalphaAMG_finalize();
1246-
MPI_Barrier(MPI_COMM_WORLD);
1246+
MPI_Barrier(app()->mpi.comm);
12471247
MPI_Finalize();
12481248
exit(1);
12491249
}
@@ -1319,7 +1319,7 @@ int MG_solver_nd(spinor *const up_new, spinor *const dn_new, spinor *const up_ol
13191319
if (g_proc_id == 0) printf("ERROR: solver didn't converge after two trials!! Aborting... \n");
13201320
// TODO: handle abort
13211321
DDalphaAMG_finalize();
1322-
MPI_Barrier(MPI_COMM_WORLD);
1322+
MPI_Barrier(app()->mpi.comm);
13231323
MPI_Finalize();
13241324
exit(1);
13251325
}
@@ -1393,7 +1393,7 @@ int MG_mms_solver_nd(spinor **const up_new, spinor **const dn_new, spinor *const
13931393
if (g_proc_id == 0) printf("ERROR: solver didn't converge after two trials!! Aborting... \n");
13941394
// TODO: handle abort
13951395
DDalphaAMG_finalize();
1396-
MPI_Barrier(MPI_COMM_WORLD);
1396+
MPI_Barrier(app()->mpi.comm);
13971397
MPI_Finalize();
13981398
exit(1);
13991399
}

src/lib/compare_derivative.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ void compare_derivative(monomial *mnl, su3adj **ext_lib, su3adj **native, const
6464

6565
int red_n_diff = 0;
6666
#ifdef TM_USE_MPI
67-
MPI_Barrier(MPI_COMM_WORLD);
68-
MPI_Reduce(&n_diff, &red_n_diff, 1, MPI_INT, MPI_MAX, 0, MPI_COMM_WORLD);
67+
MPI_Barrier(app()->mpi.comm);
68+
MPI_Reduce(&n_diff, &red_n_diff, 1, MPI_INT, MPI_MAX, 0, app()->mpi.comm);
6969
#else
7070
red_n_diff = n_diff;
7171
#endif

0 commit comments

Comments
 (0)