mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-17 16:50:18 +08:00
no longer run tst_parallel_zlib with 1 processor in testing
This commit is contained in:
parent
2715513a06
commit
b4d2c7d64d
@ -52,7 +52,6 @@ echo "Parallel I/O test for Collective I/O, contributed by HDF Group."
|
||||
if test "@HAS_PAR_FILTERS@" = "yes"; then
|
||||
echo
|
||||
echo "Parallel I/O test with zlib."
|
||||
@MPIEXEC@ -n 1 ./tst_parallel_zlib
|
||||
@MPIEXEC@ -n 4 ./tst_parallel_zlib
|
||||
|
||||
echo
|
||||
|
@ -23,9 +23,8 @@
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int err = NC_NOERR, rank, nprocs;
|
||||
int rank, nprocs;
|
||||
int ncid, varid, dimid;
|
||||
size_t start[1], count[1], nrecs;
|
||||
|
||||
MPI_Init(&argc, &argv);
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
|
||||
@ -34,37 +33,68 @@ int main(int argc, char** argv)
|
||||
if (!rank)
|
||||
printf("\n*** Testing parallel I/O.\n");
|
||||
|
||||
/* if (!rank) */
|
||||
/* printf("*** testing record lenth with multiple processes writing records..."); */
|
||||
/* { */
|
||||
|
||||
/* size_t start[1], count[1], nrecs; */
|
||||
/* /\* nc_set_log_level(4); *\/ */
|
||||
/* if (nc_create_par(FILENAME, NC_CLOBBER | NC_NETCDF4, MPI_COMM_WORLD, */
|
||||
/* MPI_INFO_NULL, &ncid)) ERR; */
|
||||
|
||||
/* if (nc_def_dim(ncid, "time", NC_UNLIMITED, &dimid)) ERR; */
|
||||
/* if (nc_def_var(ncid, "var", NC_INT, 1, &dimid, &varid)) ERR; */
|
||||
/* if (nc_var_par_access(ncid, varid, NC_COLLECTIVE)) ERR; */
|
||||
/* if (nc_enddef(ncid)) ERR; */
|
||||
|
||||
/* start[0] = rank; */
|
||||
/* count[0] = 1; */
|
||||
/* if (nc_put_vara_int(ncid, varid, start, count, &rank)) ERR; */
|
||||
/* if (nc_inq_dimlen(ncid, dimid, &nrecs)) ERR; */
|
||||
/* if (nc_close(ncid)) ERR; */
|
||||
/* /\* nc_set_log_level(-1); *\/ */
|
||||
|
||||
/* if (nrecs != nprocs) */
|
||||
/* { */
|
||||
/* printf("Rank %d error at line %d of file %s:\n",rank,__LINE__,__FILE__); */
|
||||
/* printf("\tafter writing start=%zd count=%zd\n", start[0], count[0]); */
|
||||
/* printf("\texpecting number of records = %d but got %ld\n", */
|
||||
/* nprocs, nrecs); */
|
||||
/* ERR; */
|
||||
/* } */
|
||||
/* } */
|
||||
/* if (!rank) */
|
||||
/* SUMMARIZE_ERR; */
|
||||
|
||||
if (!rank)
|
||||
printf("*** testing record lenth with multiple processes writing records...");
|
||||
|
||||
/* nc_set_log_level(4); */
|
||||
if (nc_create_par(FILENAME, NC_CLOBBER | NC_NETCDF4, MPI_COMM_WORLD,
|
||||
MPI_INFO_NULL, &ncid)) ERR;
|
||||
|
||||
if (nc_def_dim(ncid, "time", NC_UNLIMITED, &dimid)) ERR;
|
||||
if (nc_def_var(ncid, "var", NC_INT, 1, &dimid, &varid)) ERR;
|
||||
if (nc_var_par_access(ncid, varid, NC_COLLECTIVE)) ERR;
|
||||
if (nc_enddef(ncid)) ERR;
|
||||
|
||||
start[0] = rank;
|
||||
count[0] = 1;
|
||||
if (nc_put_vara_int(ncid, varid, start, count, &rank)) ERR;
|
||||
if (nc_inq_dimlen(ncid, dimid, &nrecs)) ERR;
|
||||
if (nc_close(ncid)) ERR;
|
||||
/* nc_set_log_level(-1); */
|
||||
|
||||
if (nrecs != nprocs)
|
||||
printf("*** testing a reported enddef problem...");
|
||||
{
|
||||
printf("Rank %d error at line %d of file %s:\n",rank,__LINE__,__FILE__);
|
||||
printf("\tafter writing start=%zd count=%zd\n", start[0], count[0]);
|
||||
printf("\texpecting number of records = %d but got %ld\n",
|
||||
nprocs, nrecs);
|
||||
ERR;
|
||||
}
|
||||
int i;
|
||||
char varname[NC_MAX_NAME + 1];
|
||||
nc_set_log_level(4);
|
||||
if (nc_create_par(FILENAME, NC_CLOBBER | NC_MPIIO | NC_NETCDF4, MPI_COMM_WORLD,
|
||||
MPI_INFO_NULL, &ncid)) ERR;
|
||||
if (nc_def_dim(ncid, "time", NC_UNLIMITED, &dimid)) ERR;
|
||||
if (nc_def_var(ncid, "time", NC_INT, 1, &dimid, &varid)) ERR;
|
||||
if (nc_put_att_text(ncid, varid, "Att1", 1, "a")) ERR;
|
||||
if (nc_put_att_text(ncid, varid, "Att2", 1, "a")) ERR;
|
||||
if (nc_put_att_text(ncid, varid, "Att3", 1, "a")) ERR;
|
||||
if (nc_put_att_text(ncid, varid, "Att4", 1, "a")) ERR;
|
||||
for (i = 0; i < 253; i++)
|
||||
{
|
||||
snprintf(varname, 32, "dummy_var_%d", i);
|
||||
if (nc_def_var(ncid, varname, NC_INT, 1, &dimid, &varid)) ERR;
|
||||
}
|
||||
|
||||
if (nc_enddef(ncid)) ERR;
|
||||
if (nc_close(ncid)) ERR;
|
||||
nc_set_log_level(-1);
|
||||
|
||||
}
|
||||
if (!rank)
|
||||
SUMMARIZE_ERR;
|
||||
|
||||
|
||||
MPI_Finalize();
|
||||
|
||||
if (!rank)
|
||||
|
@ -60,6 +60,10 @@ main(int argc, char **argv)
|
||||
/*printf("mpi_name: %s size: %d rank: %d\n", mpi_name,
|
||||
mpi_size, mpi_rank);*/
|
||||
|
||||
/* This program must have exactly 4 processors. */
|
||||
if (mpi_size != 4)
|
||||
ERR;
|
||||
|
||||
#ifdef USE_MPE
|
||||
MPE_Init_log();
|
||||
s_init = MPE_Log_get_event_number();
|
||||
|
Loading…
Reference in New Issue
Block a user