Skip to content

Commit 671a92f

Browse files
committed
test with a stronger file consistency for UnifyFS
1 parent 88438f0 commit 671a92f

File tree

12 files changed

+156
-0
lines changed

12 files changed

+156
-0
lines changed

test/F90/f90tst_parallel2.f90

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ program f90tst_parallel
109109
! With classic model netCDF-4 file, enddef must be called.
110110
call handle_err(nf90mpi_enddef(ncid))
111111

112+
! UnifyFS requires a stronger file consistency
113+
call handle_err(nf90mpi_sync(ncid))
114+
call MPI_Barrier(MPI_COMM_WORLD, ierr)
115+
call handle_err(nf90mpi_sync(ncid))
116+
112117
! Determine what part of the variable will be written for this
113118
! processor. It's a checkerboard decomposition.
114119
count = (/ NX / 4, NY / 4 /)

test/F90/f90tst_parallel3.f90

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ program f90tst_parallel3
113113
! This will be the last collective operation.
114114
call check(nf90mpi_enddef(ncid))
115115

116+
! UnifyFS requires a stronger file consistency
117+
call check(nf90mpi_sync(ncid))
118+
call MPI_Barrier(MPI_COMM_WORLD, ierr)
119+
call check(nf90mpi_sync(ncid))
120+
116121
! Determine what part of the variable will be written/read for this
117122
! processor. It's a checkerboard decomposition.
118123
count = (/ HALF_NX, HALF_NY /)

test/largefile/high_dim_var.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ int main(int argc, char** argv) {
7878
err = ncmpi_enddef(ncid); CHECK_ERR
7979
if (err != NC_NOERR) goto fn_exit;
8080

81+
#ifdef STRONGER_CONSISTENCY
82+
ncmpi_sync(ncid);
83+
MPI_Barrier(MPI_COMM_WORLD);
84+
ncmpi_sync(ncid);
85+
#endif
86+
8187
nelms = (NRECS > DIMLEN) ? NRECS : DIMLEN;
8288
for (i=1; i<NDIMS; i++) nelms *= DIMLEN;
8389
buffer = (short*) malloc(nelms * sizeof(short));
@@ -96,6 +102,12 @@ int main(int argc, char** argv) {
96102
}
97103
}
98104

105+
#ifdef STRONGER_CONSISTENCY
106+
ncmpi_sync(ncid);
107+
MPI_Barrier(MPI_COMM_WORLD);
108+
ncmpi_sync(ncid);
109+
#endif
110+
99111
for (i=0; i<nelms; i++) buffer[i] = i % 32768;
100112

101113
for (i=0; i<NDIMS; i++) {
@@ -115,6 +127,12 @@ int main(int argc, char** argv) {
115127
buffer); CHECK_ERR
116128
}
117129

130+
#ifdef STRONGER_CONSISTENCY
131+
ncmpi_sync(ncid);
132+
MPI_Barrier(MPI_COMM_WORLD);
133+
ncmpi_sync(ncid);
134+
#endif
135+
118136
/* all processes read and verify */
119137
if (rank > 0) for (i=0; i<NDIMS; i++) count[i] = 2;
120138
for (nelms=1,i=0; i<NDIMS; i++) nelms *= count[i];

test/nonblocking/i_varn_indef.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,24 @@ int main(int argc, char** argv)
339339

340340
err = ncmpi_enddef(ncid); CHECK_ERR
341341

342+
#ifdef STRONGER_CONSISTENCY
343+
ncmpi_sync(ncid);
344+
MPI_Barrier(MPI_COMM_WORLD);
345+
ncmpi_sync(ncid);
346+
#endif
347+
342348
/* clear the file contents using a blocking API, before commit the
343349
* nonblocking requests posted in define mode */
344350
if (!bb_enabled) {
345351
nerrs += clear_file_contents(ncid, varid);
346352
}
347353

354+
#ifdef STRONGER_CONSISTENCY
355+
ncmpi_sync(ncid);
356+
MPI_Barrier(MPI_COMM_WORLD);
357+
ncmpi_sync(ncid);
358+
#endif
359+
348360
nerrs += check_num_pending_reqs(ncid, nreqs, __LINE__);
349361
err = ncmpi_wait_all(ncid, nreqs, reqs, sts);
350362
CHECK_ERR
@@ -393,12 +405,24 @@ int main(int argc, char** argv)
393405
}
394406
err = ncmpi_enddef(ncid); CHECK_ERR
395407

408+
#ifdef STRONGER_CONSISTENCY
409+
ncmpi_sync(ncid);
410+
MPI_Barrier(MPI_COMM_WORLD);
411+
ncmpi_sync(ncid);
412+
#endif
413+
396414
/* clear the file contents using a blocking API, before commit the
397415
* nonblocking requests posted in define mode */
398416
if (!bb_enabled) {
399417
nerrs += clear_file_contents(ncid, varid);
400418
}
401419

420+
#ifdef STRONGER_CONSISTENCY
421+
ncmpi_sync(ncid);
422+
MPI_Barrier(MPI_COMM_WORLD);
423+
ncmpi_sync(ncid);
424+
#endif
425+
402426
nerrs += check_num_pending_reqs(ncid, nreqs, __LINE__);
403427
err = ncmpi_wait_all(ncid, nreqs, reqs, sts);
404428
CHECK_ERR
@@ -457,12 +481,24 @@ int main(int argc, char** argv)
457481

458482
err = ncmpi_enddef(ncid); CHECK_ERR
459483

484+
#ifdef STRONGER_CONSISTENCY
485+
ncmpi_sync(ncid);
486+
MPI_Barrier(MPI_COMM_WORLD);
487+
ncmpi_sync(ncid);
488+
#endif
489+
460490
/* clear the file contents using a blocking API, before commit the
461491
* nonblocking requests posted in define mode */
462492
if (!bb_enabled) {
463493
nerrs += clear_file_contents(ncid, varid);
464494
}
465495

496+
#ifdef STRONGER_CONSISTENCY
497+
ncmpi_sync(ncid);
498+
MPI_Barrier(MPI_COMM_WORLD);
499+
ncmpi_sync(ncid);
500+
#endif
501+
466502
nerrs += check_num_pending_reqs(ncid, nreqs*2, __LINE__);
467503
err = ncmpi_wait_all(ncid, nreqs, reqs, sts);
468504
CHECK_ERR
@@ -555,12 +591,24 @@ int main(int argc, char** argv)
555591

556592
err = ncmpi_enddef(ncid); CHECK_ERR
557593

594+
#ifdef STRONGER_CONSISTENCY
595+
ncmpi_sync(ncid);
596+
MPI_Barrier(MPI_COMM_WORLD);
597+
ncmpi_sync(ncid);
598+
#endif
599+
558600
/* clear the file contents using a blocking API, before commit the
559601
* nonblocking requests posted in define mode */
560602
if (!bb_enabled) {
561603
nerrs += clear_file_contents(ncid, varid);
562604
}
563605

606+
#ifdef STRONGER_CONSISTENCY
607+
ncmpi_sync(ncid);
608+
MPI_Barrier(MPI_COMM_WORLD);
609+
ncmpi_sync(ncid);
610+
#endif
611+
564612
nerrs += check_num_pending_reqs(ncid, nreqs*3, __LINE__);
565613

566614
/* flush nonblocking write requests */

test/nonblocking/mcoll_perf.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,12 @@ int main(int argc, char **argv)
512512
err = ncmpi_enddef(ncid);
513513
CHECK_ERR
514514

515+
#ifdef STRONGER_CONSISTENCY
516+
ncmpi_sync(ncid);
517+
MPI_Barrier(MPI_COMM_WORLD);
518+
ncmpi_sync(ncid);
519+
#endif
520+
515521
if (k == 0) {
516522
if (rank == 0 && verbose)
517523
printf("*** Testing to write 2 non-record variables and 2 record variables by using ncmpi_put_vara_all() ...");
@@ -522,6 +528,12 @@ int main(int argc, char **argv)
522528
CHECK_ERR
523529
}
524530
}
531+
#ifdef STRONGER_CONSISTENCY
532+
ncmpi_sync(ncid);
533+
MPI_Barrier(MPI_COMM_WORLD);
534+
ncmpi_sync(ncid);
535+
#endif
536+
525537
for (i=0; i<nvars; i++){
526538
err = ncmpi_put_vara_all(ncid, varid[i], starts[i], counts[i], buf[i], bufcounts[i], MPI_INT);
527539
CHECK_ERR

test/testcases/flexible.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ int main(int argc, char **argv) {
8888
err = ncmpi_set_fill(ncid, NC_FILL, NULL); CHECK_ERR /* enable fill mode */
8989
err = ncmpi_enddef(ncid); CHECK_ERR
9090

91+
#ifdef STRONGER_CONSISTENCY
92+
ncmpi_sync(ncid);
93+
MPI_Barrier(MPI_COMM_WORLD);
94+
ncmpi_sync(ncid);
95+
#endif
96+
9197
/* fill 2 records with default fill values */
9298
err = ncmpi_fill_var_rec(ncid, varid1, 0); CHECK_ERR
9399
err = ncmpi_fill_var_rec(ncid, varid1, 1); CHECK_ERR
@@ -96,6 +102,12 @@ int main(int argc, char **argv) {
96102
err = ncmpi_fill_var_rec(ncid, varid3, 0); CHECK_ERR
97103
err = ncmpi_fill_var_rec(ncid, varid3, 1); CHECK_ERR
98104

105+
#ifdef STRONGER_CONSISTENCY
106+
ncmpi_sync(ncid);
107+
MPI_Barrier(MPI_COMM_WORLD);
108+
ncmpi_sync(ncid);
109+
#endif
110+
99111
/* initialize the contents of the array */
100112
for (j=0; j<NY; j++) for (i=0; i<NX; i++) buf[j][i] = j+10;
101113

test/testcases/ivarn.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ int main(int argc, char** argv)
208208
}
209209
err = ncmpi_enddef(ncid); CHECK_ERR
210210

211+
#ifdef STRONGER_CONSISTENCY
212+
ncmpi_sync(ncid);
213+
MPI_Barrier(MPI_COMM_WORLD);
214+
ncmpi_sync(ncid);
215+
#endif
216+
211217
if (nprocs < 4) { /* need 4 processes to fill the variables */
212218
err = ncmpi_fill_var_rec(ncid, vari0001, 0); CHECK_ERR
213219
err = ncmpi_fill_var_rec(ncid, varr0001, 0); CHECK_ERR
@@ -217,6 +223,12 @@ int main(int argc, char** argv)
217223
err = ncmpi_fill_var_rec(ncid, vard0002, 0); CHECK_ERR
218224
}
219225

226+
#ifdef STRONGER_CONSISTENCY
227+
ncmpi_sync(ncid);
228+
MPI_Barrier(MPI_COMM_WORLD);
229+
ncmpi_sync(ncid);
230+
#endif
231+
220232
starts = (MPI_Offset**) malloc(2 * sizeof(MPI_Offset*));
221233
counts = (MPI_Offset**) malloc(2 * sizeof(MPI_Offset*));
222234
starts[0] = (MPI_Offset*) calloc(2 * 2, sizeof(MPI_Offset));

test/testcases/mix_collectives.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ int main(int argc, char **argv)
6969
err = ncmpi_set_fill(ncid, NC_FILL, NULL); CHECK_ERR
7070
err = ncmpi_enddef(ncid); CHECK_ERR
7171

72+
#ifdef STRONGER_CONSISTENCY
73+
ncmpi_sync(ncid);
74+
MPI_Barrier(MPI_COMM_WORLD);
75+
ncmpi_sync(ncid);
76+
#endif
77+
7278
for (j=0; j<6; j++) for (i=0; i<4; i++) buf[j][i] = j*4+i + rank*100;
7379

7480
/* now, each of 4 processes makes a call to different kinds of put APIs */

test/testcases/test_vardf.F

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,12 @@ program main
308308
err = nfmpi_enddef(ncid)
309309
call check(err, 'In nfmpi_enddef: ')
310310

311+
#ifdef STRONGER_CONSISTENCY
312+
err = nfmpi_sync(ncid)
313+
call MPI_Barrier(MPI_COMM_WORLD, ierr)
314+
err = nfmpi_sync(ncid)
315+
#endif
316+
311317
! now we are in data mode
312318

313319
! fill 2 records with default fill values
@@ -324,6 +330,12 @@ program main
324330
err = nfmpi_fill_var_rec(ncid, varid2, recno)
325331
call check(err, 'In nfmpi_fill_var_rec: varid2, 2 ')
326332

333+
#ifdef STRONGER_CONSISTENCY
334+
err = nfmpi_sync(ncid)
335+
call MPI_Barrier(MPI_COMM_WORLD, ierr)
336+
err = nfmpi_sync(ncid)
337+
#endif
338+
327339
! create a file type for the record variable */
328340
err = nfmpi_inq_recsize(ncid, recsize)
329341
call check(err, 'In nfmpi_inq_recsize: ')

test/testcases/test_vardf90.f90

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,11 @@ program main
290290
err = nf90mpi_enddef(ncid)
291291
call check(err, 'In nf90mpi_enddef: ')
292292

293+
! UnifyFS requires a stronger file consistency
294+
call err = nf90mpi_sync(ncid)
295+
call MPI_Barrier(MPI_COMM_WORLD, err)
296+
call err = nf90mpi_sync(ncid)
297+
293298
! now we are in data mode
294299

295300
! fill 2 records with default fill values
@@ -306,6 +311,11 @@ program main
306311
err = nf90mpi_fill_var_rec(ncid, varid2, recno)
307312
call check(err, 'In nf90mpi_fill_var_rec: varid2, 2 ')
308313

314+
! UnifyFS requires a stronger file consistency
315+
call err = nf90mpi_sync(ncid)
316+
call MPI_Barrier(MPI_COMM_WORLD, err)
317+
call err = nf90mpi_sync(ncid)
318+
309319
! create a file type for the record variable */
310320
err = nf90mpi_inq_recsize(ncid, recsize)
311321
call check(err, 'In nf90mpi_inq_recsize: ')

0 commit comments

Comments
 (0)