working on parallel numrec problem

This commit is contained in:
Edward Hartnett 2022-04-18 08:22:50 -06:00
parent 60a0f07ccc
commit e9ac9bda1c
3 changed files with 16 additions and 5 deletions

View File

@ -178,8 +178,8 @@ find_var_dim_max_length(NC_GRP_INFO_T *grp, int varid, int dimid,
if (MPI_Allreduce(maxlen, &real_maxlen, 1, NC_MPI_SIZE_T, MPI_MAX, if (MPI_Allreduce(maxlen, &real_maxlen, 1, NC_MPI_SIZE_T, MPI_MAX,
grp->nc4_info->comm)) grp->nc4_info->comm))
BAIL(NC_EMPI); BAIL(NC_EMPI);
*maxlen = real_maxlen;
} }
*maxlen = real_maxlen;
} }
#endif /* USE_PARALLEL */ #endif /* USE_PARALLEL */
} }

View File

@ -509,7 +509,8 @@ main(int argc, char **argv)
/* Go thru formats and run all tests for each of two (for netCDF-3 /* Go thru formats and run all tests for each of two (for netCDF-3
* only builds), or 4 (for netCDF-4 builds) different formats. */ * only builds), or 4 (for netCDF-4 builds) different formats. */
for (i = NUM_FORMATS; i >= 1; i--) /* for (i = NUM_FORMATS; i >= 1; i--) */
i = NC_FORMAT_NETCDF4;
{ {
switch (i) switch (i)
{ {

View File

@ -31,6 +31,12 @@ int main(int argc, char** argv)
MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (!rank)
printf("\n*** Testing parallel I/O.\n");
if (!rank)
printf("*** testing record lenth with multiple processes writing records...");
if (nc_create_par(FILENAME, NC_CLOBBER | NC_NETCDF4, MPI_COMM_WORLD, if (nc_create_par(FILENAME, NC_CLOBBER | NC_NETCDF4, MPI_COMM_WORLD,
MPI_INFO_NULL, &ncid)) ERR; MPI_INFO_NULL, &ncid)) ERR;
@ -42,9 +48,6 @@ int main(int argc, char** argv)
start[0] = rank; start[0] = rank;
count[0] = 1; count[0] = 1;
if (nc_put_vara_int(ncid, varid, start, count, &rank)) ERR; if (nc_put_vara_int(ncid, varid, start, count, &rank)) ERR;
MPI_Barrier(MPI_COMM_WORLD);
nc_redef(ncid);
nc_enddef(ncid);
if (nc_inq_dimlen(ncid, dimid, &nrecs)) ERR; if (nc_inq_dimlen(ncid, dimid, &nrecs)) ERR;
if (nrecs != nprocs) if (nrecs != nprocs)
@ -57,6 +60,13 @@ int main(int argc, char** argv)
} }
if (nc_close(ncid)) ERR; if (nc_close(ncid)) ERR;
if (!rank)
SUMMARIZE_ERR;
MPI_Finalize(); MPI_Finalize();
if (!rank)
FINAL_RESULTS;
return 0; return 0;
} }