Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
775e6b6
new error core NC_EMULTIDEFINE_HINTS for inconsistent I/O hints set b…
wkliao Nov 8, 2025
1709e89
rename hint variables used internally
wkliao Nov 8, 2025
af3f095
One Bcast and Allreduce to check consistency of all I/O hints
wkliao Nov 8, 2025
831402e
move setting is_open inside of open call
wkliao Nov 9, 2025
9d678d8
parallel_run.sh run ncmpidiff based on driver mode
wkliao Nov 9, 2025
c5b7853
make ncmpi_close() returns the same error code
wkliao Nov 15, 2025
726f693
duplicate MPI info for non-INA aggregators in case later switch to in…
wkliao Nov 15, 2025
a00ae89
pncio_write_str_naive.c assert disp and offset are 0s
wkliao Nov 15, 2025
64bb6f7
benchmarks/C/aggregation.c add indep I/O mode option
wkliao Nov 15, 2025
1e575dd
benchmarks/C/pnetcdf_put_vara.c add indep I/O mode option
wkliao Nov 15, 2025
80141cd
benchmarks/C/write_block_read_column.c add indep I/O mode option
wkliao Nov 15, 2025
73f0f11
benchmarks/C make ptest problem size larger
wkliao Nov 15, 2025
6889bbc
FLASH-IO/parallel_run.sh separate cases for running ncmpidiff
wkliao Nov 15, 2025
66764a1
test/C add an option to run in indep I/O mode
wkliao Nov 15, 2025
995bcac
test/nonblocking/bput_varn.m4 add an option to put multiple variables
wkliao Nov 15, 2025
97b0c2f
column_wise.m4 add testing for indep I/O mode
wkliao Nov 15, 2025
b72b67f
flexible_bput.c add testing for indep I/O mode
wkliao Nov 15, 2025
a532d59
testcases/alignment_test.c increases problem size
wkliao Nov 15, 2025
4aea2f2
tst_multi_redefine.c tests entering define mode multiple times
wkliao Nov 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 85 additions & 33 deletions benchmarks/C/aggregation.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ typedef struct {
int star_block;
int blocking_io;
int double_xtype;
int indep_io;
MPI_Offset len;
MPI_Offset w_size;
MPI_Offset r_size;
Expand Down Expand Up @@ -287,6 +288,11 @@ int benchmark_write(char *filename,
sts = (int*) malloc(sizeof(int) * num_reqs);

err = ncmpi_enddef(ncid); ERR(err)
if (cfg->indep_io) {
err = ncmpi_begin_indep_data(ncid);
ERR(err)
}

err = ncmpi_inq_header_size(ncid, &cfg->header_size); ERR(err)
err = ncmpi_inq_header_extent(ncid, &cfg->header_extent); ERR(err)
end_t = MPI_Wtime();
Expand All @@ -306,12 +312,17 @@ int benchmark_write(char *filename,
start[1] = cfg->len * (rank / psizes[1]);
count[1] = cfg->len;
count[2] = cfg->len;
if (cfg->blocking_io)
err = ncmpi_put_vara_double_all(ncid, varid[v], start,
if (cfg->blocking_io) {
if (cfg->indep_io)
err = ncmpi_put_vara_double(ncid, varid[v], start,
count, buf[v]);
else
err = ncmpi_put_vara_double_all(ncid, varid[v], start,
count, buf[v]);
}
else
err = ncmpi_iput_vara_double(ncid, varid[v], start, count,
buf[v], &reqs[k++]);
buf[v], &reqs[k++]);
ERR(err)
if (debug) DBG_PRINT("block-block", n, i);
v++;
Expand All @@ -323,9 +334,14 @@ int benchmark_write(char *filename,
count[2] = cfg->len;
stride[1] = 1;
stride[2] = nprocs;
if (cfg->blocking_io)
err = ncmpi_put_vars_double_all(ncid, varid[v], start,
if (cfg->blocking_io) {
if (cfg->indep_io)
err = ncmpi_put_vars_double(ncid, varid[v], start,
count, stride, buf[v]);
else
err = ncmpi_put_vars_double_all(ncid, varid[v], start,
count, stride, buf[v]);
}
else
err = ncmpi_iput_vars_double(ncid, varid[v], start, count,
stride, buf[v], &reqs[k++]);
Expand All @@ -338,9 +354,14 @@ int benchmark_write(char *filename,
start[2] = 0;
count[1] = cfg->len;
count[2] = bs_gsizes[2];
if (cfg->blocking_io)
err = ncmpi_put_vara_double_all(ncid, varid[v], start,
if (cfg->blocking_io) {
if (cfg->indep_io)
err = ncmpi_put_vara_double(ncid, varid[v], start,
count, buf[v]);
else
err = ncmpi_put_vara_double_all(ncid, varid[v], start,
count, buf[v]);
}
else
err = ncmpi_iput_vara_double(ncid, varid[v], start, count,
buf[v], &reqs[k++]);
Expand All @@ -353,9 +374,14 @@ int benchmark_write(char *filename,
start[2] = cfg->len * rank;
count[1] = sb_gsizes[1];
count[2] = cfg->len;
if (cfg->blocking_io)
err = ncmpi_put_vara_double_all(ncid, varid[v], start,
if (cfg->blocking_io) {
if (cfg->indep_io)
err = ncmpi_put_vara_double(ncid, varid[v], start,
count, buf[v]);
else
err = ncmpi_put_vara_double_all(ncid, varid[v], start,
count, buf[v]);
}
else
err = ncmpi_iput_vara_double(ncid, varid[v], start, count,
buf[v], &reqs[k++]);
Expand All @@ -372,13 +398,13 @@ int benchmark_write(char *filename,

if (!cfg->blocking_io) {
start_t = end_t;
#ifdef USE_INDEP_MODE
err = ncmpi_begin_indep_data(ncid); ERR(err)
err = ncmpi_wait(ncid, num_reqs, reqs, sts); ERR(err)
err = ncmpi_end_indep_data(ncid); ERR(err)
#else
err = ncmpi_wait_all(ncid, num_reqs, reqs, sts); ERR(err)
#endif

if (cfg->indep_io)
err = ncmpi_wait(ncid, num_reqs, reqs, sts);
else
err = ncmpi_wait_all(ncid, num_reqs, reqs, sts);
ERR(err)

/* check status of all requests */
for (i=0; i<num_reqs; i++) ERR(sts[i])

Expand Down Expand Up @@ -452,6 +478,11 @@ int benchmark_read(char *filename,
start_t = MPI_Wtime();
timing[1] = start_t - timing[0];

if (cfg->indep_io) {
err = ncmpi_begin_indep_data(ncid);
ERR(err)
}

/* Note that PnetCDF read the file in chunks of size 256KB, thus the read
* amount may be more than the file header size
*/
Expand Down Expand Up @@ -518,8 +549,12 @@ int benchmark_read(char *filename,
start[1] = cfg->len * (rank / psizes[1]);
count[1] = cfg->len;
count[2] = cfg->len;
if (cfg->blocking_io)
err = ncmpi_get_vara_double_all(ncid, v, start, count, buf[v]);
if (cfg->blocking_io) {
if (cfg->indep_io)
err = ncmpi_get_vara_double(ncid, v, start, count, buf[v]);
else
err = ncmpi_get_vara_double_all(ncid, v, start, count, buf[v]);
}
else
err = ncmpi_iget_vara_double(ncid, v, start, count, buf[v],
&reqs[k++]);
Expand All @@ -533,9 +568,14 @@ int benchmark_read(char *filename,
count[2] = cfg->len;
stride[1] = 1;
stride[2] = nprocs;
if (cfg->blocking_io)
err = ncmpi_get_vars_double_all(ncid, v, start, count,
if (cfg->blocking_io) {
if (cfg->indep_io)
err = ncmpi_get_vars_double(ncid, v, start, count,
stride, buf[v]);
else
err = ncmpi_get_vars_double_all(ncid, v, start, count,
stride, buf[v]);
}
else
err = ncmpi_iget_vars_double(ncid, v, start, count, stride,
buf[v], &reqs[k++]);
Expand All @@ -547,8 +587,12 @@ int benchmark_read(char *filename,
start[2] = 0;
count[1] = cfg->len;
count[2] = bs_gsizes[2];
if (cfg->blocking_io)
err = ncmpi_get_vara_double_all(ncid, v, start, count, buf[v]);
if (cfg->blocking_io) {
if (cfg->indep_io)
err = ncmpi_get_vara_double(ncid, v, start, count, buf[v]);
else
err = ncmpi_get_vara_double_all(ncid, v, start, count, buf[v]);
}
else
err = ncmpi_iget_vara_double(ncid, v, start, count, buf[v],
&reqs[k++]);
Expand All @@ -560,8 +604,12 @@ int benchmark_read(char *filename,
start[2] = cfg->len * rank;
count[1] = sb_gsizes[1];
count[2] = cfg->len;
if (cfg->blocking_io)
err = ncmpi_get_vara_double_all(ncid, v, start, count, buf[v]);
if (cfg->blocking_io) {
if (cfg->indep_io)
err = ncmpi_get_vara_double(ncid, v, start, count, buf[v]);
else
err = ncmpi_get_vara_double_all(ncid, v, start, count, buf[v]);
}
else
err = ncmpi_iget_vara_double(ncid, v, start, count, buf[v],
&reqs[k++]);
Expand All @@ -578,13 +626,12 @@ int benchmark_read(char *filename,
if (!cfg->blocking_io) {
start_t = end_t;

#ifdef USE_INDEP_MODE
err = ncmpi_begin_indep_data(ncid); ERR(err)
err = ncmpi_wait(ncid, num_reqs, reqs, sts); ERR(err)
err = ncmpi_end_indep_data(ncid); ERR(err)
#else
err = ncmpi_wait_all(ncid, num_reqs, reqs, sts); ERR(err)
#endif
if (cfg->indep_io)
err = ncmpi_wait(ncid, num_reqs, reqs, sts);
else
err = ncmpi_wait_all(ncid, num_reqs, reqs, sts);
ERR(err)

/* check status of all requests */
for (i=0; i<num_reqs; i++) ERR(sts[i])

Expand Down Expand Up @@ -629,6 +676,7 @@ usage(char *argv0)
" [-c] *-cyclic partitioning pattern\n"
" [-i] block-* partitioning pattern\n"
" [-j] *-block partitioning pattern\n"
" [-a] use independent I/O\n"
" [-m] use double type in both memory buffer and file\n"
" [-l len]: local variable of size len x len (default 10)\n"
" [-n num]: number of variables each pattern (default 1)\n"
Expand All @@ -646,7 +694,7 @@ int main(int argc, char** argv) {
char filename[256];
int i, rank, nprocs, verbose=1, nerrs=0, enable_read, enable_write;
int nvars, block_block, star_cyclic, block_star, star_block, num_records;
int blocking_io, double_xtype;
int blocking_io, double_xtype, indep_io;
double timing[11], max_t[11];
MPI_Offset len=0, sum_w_size, sum_r_size;
MPI_Comm comm=MPI_COMM_WORLD;
Expand All @@ -666,10 +714,11 @@ int main(int argc, char** argv) {
num_records = 1;
blocking_io = 0;
double_xtype = 0;
indep_io = 0;

/* get command-line arguments */
debug = 0;
while ((i = getopt(argc, argv, "hqdbcijmrwxl:n:t:")) != EOF)
while ((i = getopt(argc, argv, "hqdabcijkmrwxl:n:t:")) != EOF)
switch(i) {
case 'q': verbose = 0;
break;
Expand All @@ -683,6 +732,8 @@ int main(int argc, char** argv) {
break;
case 'j': star_block = 1;
break;
case 'a': indep_io = 1;
break;
case 'm': double_xtype = 1;
break;
case 'x': blocking_io = 1;
Expand Down Expand Up @@ -720,6 +771,7 @@ int main(int argc, char** argv) {
cfg.num_records = num_records;
cfg.blocking_io = blocking_io;
cfg.double_xtype = double_xtype;
cfg.indep_io = indep_io;

if (enable_read == 0 && enable_write == 0)
enable_read = enable_write = 1;
Expand Down
22 changes: 13 additions & 9 deletions benchmarks/C/parallel_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ unset PNETCDF_HINTS

fixed_length=23

TEST_MPIIO_MODES="0 1"

for i in ${check_PROGRAMS} ; do

for j in ${safe_modes} ; do
Expand All @@ -44,7 +46,7 @@ for i in ${check_PROGRAMS} ; do
fi
OUT_PREFIX="${TESTOUTDIR}/$i"

for mpiio_mode in 0 1 ; do
for mpiio_mode in ${TEST_MPIIO_MODES} ; do
if test "$mpiio_mode" = 1 ; then
USEMPIO_HINTS="nc_pncio=disable"
DRIVER_OUT_FILE="${OUT_PREFIX}.mpio"
Expand Down Expand Up @@ -83,9 +85,9 @@ for i in ${check_PROGRAMS} ; do
export PNETCDF_SAFE_MODE=$j
# echo "PNETCDF_SAFE_MODE=$PNETCDF_SAFE_MODE PNETCDF_HINTS=$PNETCDF_HINTS"

CMD_OPTS="-q -l 10"
CMD_OPTS="-q -l 500"
if test "$i" = "aggregation" ; then
CMD_OPTS+=" -b -c -i -j"
CMD_OPTS+=" -b -a -x -n 12 -t 2"
fi

# echo "${LINENO}: ${MPIRUN} ./$i $CMD_OPTS ${OUT_FILE}.nc"
Expand Down Expand Up @@ -128,12 +130,14 @@ for i in ${check_PROGRAMS} ; do
done # mpiio_mode

DIFF_OPT="-q"
# echo "${LINENO}: --- ncmpidiff $OUT_PREFIX.mpio.nc $OUT_PREFIX.mpio.ina.nc ---"
$MPIRUN $NCMPIDIFF $DIFF_OPT $OUT_PREFIX.mpio.nc $OUT_PREFIX.mpio.ina.nc
# echo "${LINENO}: --- ncmpidiff $OUT_PREFIX.mpio.nc $OUT_PREFIX.pncio.nc ---"
$MPIRUN $NCMPIDIFF $DIFF_OPT $OUT_PREFIX.mpio.nc $OUT_PREFIX.pncio.nc
# echo "${LINENO}: --- ncmpidiff $OUT_PREFIX.mpio.nc $OUT_PREFIX.pncio.ina.nc ---"
$MPIRUN $NCMPIDIFF $DIFF_OPT $OUT_PREFIX.mpio.nc $OUT_PREFIX.pncio.ina.nc
if test "x$TEST_MPIIO_MODES" = "x0 1" ; then
# echo "${LINENO}: --- ncmpidiff $OUT_PREFIX.mpio.nc $OUT_PREFIX.mpio.ina.nc ---"
$MPIRUN $NCMPIDIFF $DIFF_OPT $OUT_PREFIX.mpio.nc $OUT_PREFIX.mpio.ina.nc
# echo "${LINENO}: --- ncmpidiff $OUT_PREFIX.mpio.nc $OUT_PREFIX.pncio.nc ---"
$MPIRUN $NCMPIDIFF $DIFF_OPT $OUT_PREFIX.mpio.nc $OUT_PREFIX.pncio.nc
fi
# echo "${LINENO}: --- ncmpidiff $OUT_PREFIX.pncio.nc $OUT_PREFIX.pncio.ina.nc ---"
$MPIRUN $NCMPIDIFF $DIFF_OPT $OUT_PREFIX.pncio.nc $OUT_PREFIX.pncio.ina.nc

done # safe_modes
rm -f ${OUTDIR}/$i*nc*
Expand Down
34 changes: 26 additions & 8 deletions benchmarks/C/pnetcdf_put_vara.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ pnetcdf_io(char *filename,
int kind,
int len,
int nvars,
int ntimes)
int ntimes,
int indep_io)
{
char name[128], str_att[128], *file_kind;
int i, j, rank, nprocs, err, nerrs=0;
Expand Down Expand Up @@ -175,6 +176,11 @@ pnetcdf_io(char *filename,
/* exit define mode */
err = ncmpi_enddef(ncid); ERR

if (indep_io) {
err = ncmpi_begin_indep_data(ncid);
ERR
}

/* set up the access pattern */
start[0] = 0;
start[1] = len * (rank / psizes[1]);
Expand All @@ -190,14 +196,22 @@ pnetcdf_io(char *filename,
if (nonblocking)
err = ncmpi_iput_vara_float(ncid, varid[i], start,
count, buf[i], NULL);
else
err = ncmpi_put_vara_float_all(ncid, varid[i], start,
else {
if (indep_io)
err = ncmpi_put_vara_float(ncid, varid[i], start,
count, buf[i]);
else
err = ncmpi_put_vara_float_all(ncid, varid[i], start,
count, buf[i]);
}
ERR
}
}
if (nonblocking) {
err = ncmpi_wait_all(ncid, NC_REQ_ALL, NULL, NULL);
if (indep_io)
err = ncmpi_wait(ncid, NC_REQ_ALL, NULL, NULL);
else
err = ncmpi_wait_all(ncid, NC_REQ_ALL, NULL, NULL);
ERR
}
timing[1] = MPI_Wtime() - timing[1];
Expand Down Expand Up @@ -246,9 +260,10 @@ static void
usage(char *argv0)
{
char *help =
"Usage: %s [-h | -q | -i | -k num |-l num | -n num | -t num] [file_name]\n"
"Usage: %s [-h | -q | -a | -i | -k num |-l num | -n num | -t num] [file_name]\n"
" [-h] Print help\n"
" [-q] Quiet mode (reports when fail)\n"
" [-a] Use PnetCDF independent APIs\n"
" [-i] Use PnetCDF nonblocking APIs\n"
" [-k format] file format: 1 for CDF-1,\n"
" 2 for CDF-2,\n"
Expand All @@ -266,7 +281,7 @@ int main(int argc, char** argv)
extern char *optarg;
char filename[512];
int i, rank, kind, nerrs=0;
int nonblocking, nvars, len, ntimes;
int nonblocking, nvars, len, ntimes, indep_io;

MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
Expand All @@ -277,12 +292,15 @@ int main(int argc, char** argv)
nvars = 4;
len = 32;
ntimes = 1;
indep_io = 0;

/* get command-line arguments */
while ((i = getopt(argc, argv, "hqik:l:n:t:")) != EOF)
while ((i = getopt(argc, argv, "hqaik:l:n:t:")) != EOF)
switch(i) {
case 'q': verbose = 0;
break;
case 'a': indep_io = 1;
break;
case 'i': nonblocking = 1;
break;
case 'k': kind = atoi(optarg);
Expand All @@ -303,7 +321,7 @@ int main(int argc, char** argv)

MPI_Bcast(filename, 512, MPI_CHAR, 0, MPI_COMM_WORLD);

nerrs += pnetcdf_io(filename, nonblocking, kind, len, nvars, ntimes);
nerrs += pnetcdf_io(filename, nonblocking, kind, len, nvars, ntimes, indep_io);

MPI_Finalize();
return (nerrs > 0);
Expand Down
Loading
Loading