2
0
mirror of https://github.com/Unidata/netcdf-c.git synced 2025-03-07 17:08:02 +08:00

Gave the modified test a unique test file name.

This commit is contained in:
Ward Fisher 2016-06-09 11:28:03 -06:00
parent 2610b58a5d
commit 54b57d0e60
2 changed files with 23 additions and 22 deletions

View File

@ -137,7 +137,8 @@ tst_elena_*.cdl tst_simple*.cdl tst_chunks.cdl pr_A1.* tauu_A1.* \
usi_01.* thetau_01.* tst_*.nc tst_*.h5 \ usi_01.* thetau_01.* tst_*.nc tst_*.h5 \
tst_grp_rename.cdl tst_grp_rename.nc tst_grp_rename.dmp ref_grp_rename.cdl \ tst_grp_rename.cdl tst_grp_rename.nc tst_grp_rename.dmp ref_grp_rename.cdl \
foo1.nc tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc \ foo1.nc tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc \
tst_atts_string_rewrite.nc tst_empty_vlen_unlim.nc tst_empty_vlen_lim.nc tst_atts_string_rewrite.nc tst_empty_vlen_unlim.nc tst_empty_vlen_lim.nc \
tst_parallel4_simplerw_coll.nc
if USE_HDF4_FILE_TESTS if USE_HDF4_FILE_TESTS
DISTCLEANFILES = AMSR_E_L2_Rain_V10_200905312326_A.hdf \ DISTCLEANFILES = AMSR_E_L2_Rain_V10_200905312326_A.hdf \

View File

@ -22,7 +22,7 @@
#include <mpe.h> #include <mpe.h>
#endif /* USE_MPE */ #endif /* USE_MPE */
#define FILE_NAME "tst_parallel4.nc" #define FILE_NAME "tst_parallel4_simplerw_coll.nc"
#define NDIMS 3 #define NDIMS 3
#define DIMSIZE 16 #define DIMSIZE 16
#define NUM_SLABS 16 #define NUM_SLABS 16
@ -41,7 +41,7 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
/* MPI stuff. */ /* MPI stuff. */
int mpi_namelen; int mpi_namelen;
char mpi_name[MPI_MAX_PROCESSOR_NAME]; char mpi_name[MPI_MAX_PROCESSOR_NAME];
int mpi_size, mpi_rank; int mpi_size, mpi_rank;
MPI_Comm comm = MPI_COMM_WORLD; MPI_Comm comm = MPI_COMM_WORLD;
@ -54,7 +54,7 @@ main(int argc, char **argv)
size_t count[NDIMS] = {1, DIMSIZE, DIMSIZE}; size_t count[NDIMS] = {1, DIMSIZE, DIMSIZE};
int data[DIMSIZE * DIMSIZE], data_in[DIMSIZE * DIMSIZE]; int data[DIMSIZE * DIMSIZE], data_in[DIMSIZE * DIMSIZE];
int j, i, ret; int j, i, ret;
char file_name[NC_MAX_NAME + 1]; char file_name[NC_MAX_NAME + 1];
int ndims_in, nvars_in, natts_in, unlimdimid_in; int ndims_in, nvars_in, natts_in, unlimdimid_in;
@ -72,23 +72,23 @@ main(int argc, char **argv)
/* Must be able to evenly divide my slabs between processors. */ /* Must be able to evenly divide my slabs between processors. */
if (NUM_SLABS % mpi_size != 0) if (NUM_SLABS % mpi_size != 0)
{ {
if (!mpi_rank) printf("NUM_SLABS (%d) is not evenly divisible by mpi_size(%d)\n", if (!mpi_rank) printf("NUM_SLABS (%d) is not evenly divisible by mpi_size(%d)\n",
NUM_SLABS, mpi_size); NUM_SLABS, mpi_size);
ERR; ERR;
} }
#ifdef USE_MPE #ifdef USE_MPE
MPE_Init_log(); MPE_Init_log();
s_init = MPE_Log_get_event_number(); s_init = MPE_Log_get_event_number();
e_init = MPE_Log_get_event_number(); e_init = MPE_Log_get_event_number();
s_define = MPE_Log_get_event_number(); s_define = MPE_Log_get_event_number();
e_define = MPE_Log_get_event_number(); e_define = MPE_Log_get_event_number();
s_write = MPE_Log_get_event_number(); s_write = MPE_Log_get_event_number();
e_write = MPE_Log_get_event_number(); e_write = MPE_Log_get_event_number();
s_close = MPE_Log_get_event_number(); s_close = MPE_Log_get_event_number();
e_close = MPE_Log_get_event_number(); e_close = MPE_Log_get_event_number();
s_open = MPE_Log_get_event_number(); s_open = MPE_Log_get_event_number();
e_open = MPE_Log_get_event_number(); e_open = MPE_Log_get_event_number();
MPE_Describe_state(s_init, e_init, "Init", "red"); MPE_Describe_state(s_init, e_init, "Init", "red");
MPE_Describe_state(s_define, e_define, "Define", "yellow"); MPE_Describe_state(s_define, e_define, "Define", "yellow");
MPE_Describe_state(s_write, e_write, "Write", "green"); MPE_Describe_state(s_write, e_write, "Write", "green");
@ -174,20 +174,20 @@ main(int argc, char **argv)
/* Close the netcdf file. */ /* Close the netcdf file. */
if (nc_close(ncid)) ERR; if (nc_close(ncid)) ERR;
//#endif //#endif
#ifdef USE_MPE #ifdef USE_MPE
MPE_Log_event(e_close, 0, "end close file"); MPE_Log_event(e_close, 0, "end close file");
#endif /* USE_MPE */ #endif /* USE_MPE */
/* Reopen the file and check it. */ /* Reopen the file and check it. */
if ((ret = nc_open_par(FILE_NAME, NC_NOWRITE|NC_MPIIO, comm, info, &ncid))) if ((ret = nc_open_par(FILE_NAME, NC_NOWRITE|NC_MPIIO, comm, info, &ncid)))
{ {
printf("ret = %d\n", ret); printf("ret = %d\n", ret);
return -1; return -1;
} }
if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR; if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR;
if (ndims_in != NDIMS || nvars_in != 1 || natts_in != 1 || if (ndims_in != NDIMS || nvars_in != 1 || natts_in != 1 ||
unlimdimid_in != -1) ERR; unlimdimid_in != -1) ERR;
/* Read all the slabs this process is responsible for. */ /* Read all the slabs this process is responsible for. */
@ -207,11 +207,11 @@ count[j] = 0;
if (nc_var_par_access(ncid, varid, NC_COLLECTIVE)) ERR; if (nc_var_par_access(ncid, varid, NC_COLLECTIVE)) ERR;
/* Read one slab of data. */ /* Read one slab of data. */
if (nc_get_vara_int(ncid, varid, start, count, data_in)) ERR; if (nc_get_vara_int(ncid, varid, start, count, data_in)) ERR;
if(mpi_rank != 0) { if(mpi_rank != 0) {
/* Check data. */ /* Check data. */
for (j = 0; j < DIMSIZE * DIMSIZE; j++) for (j = 0; j < DIMSIZE * DIMSIZE; j++)
if (data_in[j] != mpi_rank) if (data_in[j] != mpi_rank)
{ {
ERR; ERR;
break; break;
@ -229,13 +229,13 @@ if(mpi_rank != 0) {
/* Close the netcdf file. */ /* Close the netcdf file. */
if (nc_close(ncid)) ERR; if (nc_close(ncid)) ERR;
#ifdef USE_MPE #ifdef USE_MPE
MPE_Log_event(e_close, 0, "end close file"); MPE_Log_event(e_close, 0, "end close file");
#endif /* USE_MPE */ #endif /* USE_MPE */
/* Delete this large file. */ /* Delete this large file. */
// remove(file_name); // remove(file_name);
/* Shut down MPI. */ /* Shut down MPI. */
MPI_Finalize(); MPI_Finalize();