Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify nc_test/tst_parallel2.c to remove a failure. #545

Merged
merged 3 commits into from
Nov 3, 2017
Merged
Changes from all commits
Commits
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
44 changes: 30 additions & 14 deletions nc_test/tst_parallel2.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <mpe.h>
#endif /* USE_MPE */

#undef DEBUG

#define FILE_NAME "tst_parallel2.nc"
#define NDIMS 3
#define DIMSIZE 8
Expand Down Expand Up @@ -54,7 +56,9 @@ main(int argc, char **argv)
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
MPI_Get_processor_name(mpi_name, &mpi_namelen);
/*printf("mpi_name: %s size: %d rank: %d\n", mpi_name, mpi_size, mpi_rank);*/
#ifdef DEBUG
printf("mpi_name: %s size: %d rank: %d\n", mpi_name, mpi_size, mpi_rank);
#endif

/* Must be able to evenly divide my slabs between processors. */
if (NUM_SLABS % mpi_size != 0)
Expand Down Expand Up @@ -85,12 +89,14 @@ main(int argc, char **argv)
MPE_Log_event(s_init, 0, "start init");
#endif /* USE_MPE */

/* if (!mpi_rank) */
/* { */
/* printf("\n*** Testing parallel I/O some more.\n"); */
/* printf("*** writing a %d x %d x %d file from %d processors...\n", */
/* NUM_SLABS, DIMSIZE, DIMSIZE, mpi_size); */
/* } */
#ifdef DEBUG
if (!mpi_rank)
{
printf("\n*** Testing parallel I/O some more.\n");
printf("*** writing a %d x %d x %d file from %d processors...\n",
NUM_SLABS, DIMSIZE, DIMSIZE, mpi_size);
}
#endif

/* We will write the same slab over and over. */
for (i = 0; i < DIMSIZE * DIMSIZE; i++)
Expand All @@ -103,6 +109,9 @@ main(int argc, char **argv)

/* Create a parallel netcdf-4 file. */
sprintf(file_name, "%s/%s", TEMP_LARGE, FILE_NAME);
#ifdef DEBUG
fprintf(stderr,"create: file_name=%s\n",file_name);
#endif
if (nc_create_par(file_name, NC_PNETCDF, comm, info, &ncid)) ERR;

/* A global attribute holds the number of processors that created
Expand Down Expand Up @@ -168,6 +177,9 @@ main(int argc, char **argv)
#endif /* USE_MPE */

/* Reopen the file and check it. */
#ifdef DEBUG
fprintf(stderr,"open: file_name=%s\n",file_name);
#endif
if (nc_open_par(file_name, NC_NOWRITE|NC_PNETCDF, comm, info, &ncid)) ERR;
if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
if (ndims_in != NDIMS || nvars_in != 1 || natts_in != 1 ||
Expand Down Expand Up @@ -209,16 +221,20 @@ main(int argc, char **argv)
MPE_Log_event(e_close, 0, "end close file");
#endif /* USE_MPE */

/* Delete this large file. */
remove(file_name);
MPI_Barrier(MPI_COMM_WORLD);
if (mpi_rank == 0)
remove(file_name);

/* Shut down MPI. */
MPI_Finalize();

/* if (!mpi_rank) */
/* { */
/* SUMMARIZE_ERR; */
/* FINAL_RESULTS; */
/* } */
#ifdef DEBUG
if (!mpi_rank)
{
SUMMARIZE_ERR;
FINAL_RESULTS;
}
#endif

return total_err;
}