diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 3e05b2a640..3f13ac3b83 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -56,7 +56,7 @@ jobs: cd build cmake -Wno-dev -DNetCDF_C_LIBRARY=/usr/lib/x86_64-linux-gnu/libnetcdf.so \ -DNetCDF_C_INCLUDE_DIR=/usr/include -DPnetCDF_PATH='/home/runner/pnetcdf' \ - -DPIO_ENABLE_FORTRAN=Off -DPIO_HDF5_LOGGING=On -DPIO_USE_MALLOC=On \ + -DPIO_ENABLE_FORTRAN=Off \ -DPIO_ENABLE_LOGGING=On -DPIO_ENABLE_TIMING=Off -DMPIEXEC_PREFLAGS="--oversubscribe" .. make VERBOSE=1 make tests VERBOSE=1 diff --git a/.github/workflows/cmake_ncint.yml b/.github/workflows/cmake_ncint.yml index 6f46d0eef1..95141df37d 100644 --- a/.github/workflows/cmake_ncint.yml +++ b/.github/workflows/cmake_ncint.yml @@ -60,7 +60,7 @@ jobs: cmake -Wno-dev -DPIO_ENABLE_NETCDF_INTEGRATION=OFF \ -DNetCDF_C_LIBRARY=/usr/lib/x86_64-linux-gnu/libnetcdf.so \ -DNetCDF_C_INCLUDE_DIR=/usr/include -DPnetCDF_PATH='/home/runner/pnetcdf' \ - -DPIO_HDF5_LOGGING=On -DPIO_ENABLE_FORTRAN=OFF -DPIO_USE_MALLOC=On \ + -DPIO_ENABLE_FORTRAN=OFF \ -DPIO_ENABLE_LOGGING=On -DPIO_ENABLE_TIMING=Off -DMPIEXEC_PREFLAGS="--oversubscribe" .. make VERBOSE=1 make tests VERBOSE=1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d49509f19..f8c9502ef4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,8 @@ # Jim Edwards -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 3.9.1) project (PIO C) -#cmake_policy(VERSION 3.5.2) # The project version number. set(VERSION_MAJOR 2 CACHE STRING "Project major version number.") @@ -107,9 +106,6 @@ else() set(USE_VARD 0) endif() -# Set a variable that appears in the config.h.in file. -set(USE_MALLOC 1) - # Set a variable that appears in the config.h.in file. if(PIO_ENABLE_LOGGING) set(ENABLE_LOGGING 1) @@ -281,7 +277,11 @@ add_subdirectory (src) # Custom "piotests" target (builds the test executables) add_custom_target (tests) -add_dependencies (tests pioc piof) +if (PIO_ENABLE_FORTRAN) + add_dependencies (tests pioc piof) +else() + add_dependencies (tests pioc) +endif() # Custom "check" target that depends upon "tests" add_custom_target (check COMMAND ${CMAKE_CTEST_COMMAND}) diff --git a/cmake_config.h.in b/cmake_config.h.in index 7561db067d..586030c202 100644 --- a/cmake_config.h.in +++ b/cmake_config.h.in @@ -15,10 +15,6 @@ /** The patch part of the version number. */ #define PIO_VERSION_PATCH @VERSION_PATCH@ -/** Set to non-zero to use native malloc. By defauly the PIO library - * will use the included bget() package for memory management. */ -#define PIO_USE_MALLOC @USE_MALLOC@ - /** Set to non-zero to turn on logging. Output may be large. */ #define PIO_ENABLE_LOGGING @ENABLE_LOGGING@ diff --git a/configure.ac b/configure.ac index b54e4fd84a..b645770455 100644 --- a/configure.ac +++ b/configure.ac @@ -92,9 +92,6 @@ if test -n "$fc_version_info"; then FC_VERSION="$FC_VERSION ( $fc_version_info)" fi -# Always use malloc in autotools builds. -AC_DEFINE([PIO_USE_MALLOC], [1], [use malloc for memory]) - AC_MSG_CHECKING([whether a PIO_BUFFER_SIZE was specified]) AC_ARG_WITH([piobuffersize], [AS_HELP_STRING([--with-piobuffersize=], diff --git a/ctest/CTestEnvironment-anlworkstation.cmake b/ctest/CTestEnvironment-anlworkstation.cmake index ddf04f063a..38e5b4b0a9 100644 --- a/ctest/CTestEnvironment-anlworkstation.cmake +++ b/ctest/CTestEnvironment-anlworkstation.cmake @@ -24,7 +24,3 @@ if (DEFINED ENV{VALGRIND_CHECK}) set (CTEST_CONFIGURE_OPTIONS "${CTEST_CONFIGURE_OPTIONS} -DPIO_VALGRIND_CHECK=ON") endif () -# If USE_MALLOC environment variable is set, then use native malloc (instead of bget package) -if (DEFINED ENV{USE_MALLOC}) - set (CTEST_CONFIGURE_OPTIONS "${CTEST_CONFIGURE_OPTIONS} -DPIO_USE_MALLOC=ON") -endif () diff --git a/src/clib/pio_rearrange.c b/src/clib/pio_rearrange.c index 85f1198470..8877cdef0b 100644 --- a/src/clib/pio_rearrange.c +++ b/src/clib/pio_rearrange.c @@ -2174,8 +2174,9 @@ subset_rearrange_create(iosystem_desc_t *ios, int maplen, PIO_Offset *compmap, } // PLOG((2,"At line %d rdispls[%d]=%d rcount=%d",__LINE__,1,rdispls[0], iodesc->rcount[0])); /* Determine whether fill values will be needed. */ - if ((ret = determine_fill(ios, iodesc, gdimlen, compmap))) - return pio_err(ios, NULL, ret, __FILE__, __LINE__); + if(! iodesc->readonly) + if ((ret = determine_fill(ios, iodesc, gdimlen, compmap))) + return pio_err(ios, NULL, ret, __FILE__, __LINE__); /* Pass the sindex from each compute task to its associated IO task. */ if ((mpierr = MPI_Gatherv(iodesc->sindex, iodesc->scount[0], PIO_OFFSET, diff --git a/src/clib/pioc.c b/src/clib/pioc.c index 7543fb0e6e..43035cc8e5 100644 --- a/src/clib/pioc.c +++ b/src/clib/pioc.c @@ -595,10 +595,6 @@ PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int ma /* Remember the maplen. */ iodesc->maplen = maplen; - /* check if the decomp is valid for write or is read-only */ - /* this check is expensive and memory intensive on compute task 0 */ -// iodesc->readonly = check_compmap(ios, iodesc, compmap); - /* Remember the map. */ if (!(iodesc->map = malloc(sizeof(PIO_Offset) * maplen))) return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); @@ -661,6 +657,10 @@ PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int ma /* Is this the subset rearranger? */ if (iodesc->rearranger == PIO_REARR_SUBSET) { + /* check if the decomp is valid for write or is read-only */ + /* this check is expensive and may be memory intensive on compute task 0 */ + iodesc->readonly = check_compmap(ios, iodesc, compmap); + iodesc->num_aiotasks = ios->num_iotasks; PLOG((2, "creating subset rearranger iodesc->num_aiotasks = %d", iodesc->num_aiotasks)); diff --git a/src/clib/pioc_support.c b/src/clib/pioc_support.c index 474f9f6bad..316b0c0483 100644 --- a/src/clib/pioc_support.c +++ b/src/clib/pioc_support.c @@ -3283,7 +3283,7 @@ bool check_compmap(iosystem_desc_t *ios, io_desc_t *iodesc,const PIO_Offset *com if(ios->compproc) { int *gmaplen; - if(ios->compmaster) + if(ios->compmaster == MPI_ROOT) gmaplen = malloc(ios->num_comptasks * sizeof(int)); else gmaplen = NULL; @@ -3292,9 +3292,9 @@ bool check_compmap(iosystem_desc_t *ios, io_desc_t *iodesc,const PIO_Offset *com return check_mpi(ios, NULL, ierr, __FILE__,__LINE__); int *displs; - int gcompmaplen; + int gcompmaplen=0; int *gcompmaps; - if(ios->compmaster) + if(ios->compmaster == MPI_ROOT) { displs = malloc(ios->num_comptasks * sizeof(int)); displs[0] = 0; @@ -3304,16 +3304,16 @@ bool check_compmap(iosystem_desc_t *ios, io_desc_t *iodesc,const PIO_Offset *com } gcompmaplen = displs[ios->num_comptasks-1] + gmaplen[ios->num_comptasks-1]; gcompmaps = malloc(gcompmaplen * sizeof(PIO_Offset)); - printf("gcompmaplen %d\n",gcompmaplen); - for(int i=0;inum_comptasks; i++) - printf("gmaplen=%d displs[%d]=%d\n",gmaplen[i], i,displs[i]); +// printf("gcompmaplen %d\n",gcompmaplen); +// for(int i=0;inum_comptasks; i++) +// printf("gmaplen=%d displs[%d]=%d\n",gmaplen[i], i,displs[i]); } /* next gather the compmap arrays */ if ((ierr = MPI_Gatherv(compmap, iodesc->maplen, MPI_OFFSET, gcompmaps, gmaplen, displs, MPI_OFFSET, 0, ios->comp_comm))) return check_mpi(ios, NULL, ierr, __FILE__,__LINE__); - if(ios->compmaster) + if(ios->compmaster == MPI_ROOT) { /* sort */ qsort(gcompmaps, gcompmaplen, sizeof(MPI_OFFSET), offsetsort); @@ -3332,6 +3332,6 @@ bool check_compmap(iosystem_desc_t *ios, io_desc_t *iodesc,const PIO_Offset *com } } - MPI_Bcast(&readonly, 1, MPI_CHAR, ios->compmaster, ios->intercomm); + MPI_Bcast(&readonly, 1, MPI_CHAR, ios->comproot, ios->my_comm); return readonly; }