/* This is part of the netCDF package. Copyright 2005 University Corporation for Atmospheric Research/Unidata See COPYRIGHT file for conditions of use. Test fix of bug involving creation of a file with pnetcdf APIs, then opening and modifying the file with netcdf. Author: Wei-keng Liao. */ #include #include #include #include #include #include #include #include #define NVARS 6 #define NX 5 #define FILENAME "tst_pnetcdf.nc" int main(int argc, char* argv[]) { int i, j, rank, nprocs, ncid, cmode, varid[NVARS], dimid[2], *buf; int err = 0; char str[32]; size_t start[2], count[2]; MPI_Comm comm=MPI_COMM_SELF; MPI_Info info=MPI_INFO_NULL; printf("\n*** Testing bug fix with changing pnetcdf variable offsets..."); MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &rank); if (nprocs > 1 && rank == 0) printf("This test program is intended to run on ONE process\n"); if (rank > 0) goto fn_exit; /* first, use PnetCDF to create a file with default header/variable alignment */ #ifdef DISABLE_PNETCDF_ALIGNMENT MPI_Info_create(&info); MPI_Info_set(info, "nc_header_align_size", "1"); MPI_Info_set(info, "nc_var_align_size", "1"); #endif cmode = NC_PNETCDF | NC_CLOBBER; if (nc_create_par(FILENAME, cmode, comm, info, &ncid)) ERR_RET; /* define dimension */ if (nc_def_dim(ncid, "Y", NC_UNLIMITED, &dimid[0])) ERR; if (nc_def_dim(ncid, "X", NX, &dimid[1])) ERR; /* Odd numbers are fixed variables, even numbers are record variables */ for (i=0; i