From 52ac327ff5e291511a743c09f1f5274b402e03c7 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 10 Aug 2020 12:09:50 -0600 Subject: [PATCH 01/14] adding support for NETCDF_INTEGRATION option to cmake, also fixing cmake build issue in read-only directories --- CMakeLists.txt | 14 +++++++++++--- cmake_config.h.in | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fdc0695f32..2ab712a5361 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,7 @@ option (PIO_ENABLE_LOGGING "Enable debug logging (large output possible)" OFF) option (PIO_ENABLE_DOC "Enable building PIO documentation" ON) option (PIO_ENABLE_COVERAGE "Enable code coverage" OFF) option (PIO_ENABLE_EXAMPLES "Enable PIO examples" ON) +option (PIO_ENABLE_NETCDF_INTEGRATION "Enable netCDF integration (netcdf-c-4.7.4 or later required)" ON) option (PIO_INTERNAL_DOC "Enable PIO developer documentation" OFF) option (PIO_TEST_BIG_ENDIAN "Enable test to see if machine is big endian" ON) option (PIO_USE_MPIIO "Enable support for MPI-IO auto detect" ON) @@ -106,6 +107,13 @@ else() set(ENABLE_LOGGING 0) endif() +# Set a variable that appears in the config.h.in file. +if(PIO_ENABLE_NETCDF_INTEGRATION) + set(NETCDF_INTEGRATION 1) +else() + set(NETCDF_INTEGRATION 0) +endif() + if(PIO_USE_MPISERIAL) set(USE_MPI_SERIAL 1) else() @@ -416,7 +424,7 @@ INSTALL(FILES "${PIO_BINARY_DIR}/libpio.settings" ##### configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/clib/pio_meta.h.in - ${CMAKE_CURRENT_SOURCE_DIR}/src/clib/pio_meta.h @ONLY) + ${CMAKE_CURRENT_BINARY_DIR}/src/clib/pio_meta.h @ONLY) -FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/clib/pio_meta.h - DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src/clib/) +# FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/clib/pio_meta.h +# DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src/clib/) diff --git a/cmake_config.h.in b/cmake_config.h.in index eded4c71d97..5542a9d412a 100644 --- a/cmake_config.h.in +++ b/cmake_config.h.in @@ -34,4 +34,6 @@ #define HAVE_PAR_FILTERS @HAVE_PAR_FILTERS@ +#define NETCDF_INTEGRATION @NETCDF_INTEGRATION@ + #endif /* _PIO_CONFIG_ */ From c5794a8488ad79789414602d415ec1e6aa800621 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 10 Aug 2020 13:07:55 -0600 Subject: [PATCH 02/14] trying to fix cmake build --- cmake_config.h.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake_config.h.in b/cmake_config.h.in index 5542a9d412a..41e1a194687 100644 --- a/cmake_config.h.in +++ b/cmake_config.h.in @@ -32,8 +32,8 @@ #define USE_VARD @USE_VARD@ -#define HAVE_PAR_FILTERS @HAVE_PAR_FILTERS@ +#cmakedefine HAVE_PAR_FILTERS @HAVE_PAR_FILTERS@ -#define NETCDF_INTEGRATION @NETCDF_INTEGRATION@ +#cmakedefine NETCDF_INTEGRATION @NETCDF_INTEGRATION@ #endif /* _PIO_CONFIG_ */ From a28ec8c22293e6e5275fac9a011a376f78051207 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 10 Aug 2020 13:24:59 -0600 Subject: [PATCH 03/14] fixing cmake use of defines --- CMakeLists.txt | 2 +- cmake_config.h.in | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dac58ab5358..b4bf275c2de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,7 +77,7 @@ option (PIO_ENABLE_LOGGING "Enable debug logging (large output possible)" OFF) option (PIO_ENABLE_DOC "Enable building PIO documentation" ON) option (PIO_ENABLE_COVERAGE "Enable code coverage" OFF) option (PIO_ENABLE_EXAMPLES "Enable PIO examples" ON) -option (PIO_ENABLE_NETCDF_INTEGRATION "Enable netCDF integration (netcdf-c-4.7.4 or later required)" ON) +option (PIO_ENABLE_NETCDF_INTEGRATION "Enable netCDF integration" OFF) option (PIO_INTERNAL_DOC "Enable PIO developer documentation" OFF) option (PIO_TEST_BIG_ENDIAN "Enable test to see if machine is big endian" ON) option (PIO_USE_MPIIO "Enable support for MPI-IO auto detect" ON) diff --git a/cmake_config.h.in b/cmake_config.h.in index 41e1a194687..ac4551f8b26 100644 --- a/cmake_config.h.in +++ b/cmake_config.h.in @@ -32,8 +32,8 @@ #define USE_VARD @USE_VARD@ -#cmakedefine HAVE_PAR_FILTERS @HAVE_PAR_FILTERS@ +#cmakedefine HAVE_PAR_FILTERS -#cmakedefine NETCDF_INTEGRATION @NETCDF_INTEGRATION@ +#cmakedefine NETCDF_INTEGRATION #endif /* _PIO_CONFIG_ */ From b38aaefb2b2a3cbd937c496868da5bb9e952272c Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 10 Aug 2020 13:47:42 -0600 Subject: [PATCH 04/14] starting to add ncint code to cmake build --- src/CMakeLists.txt | 6 ++++++ src/ncint/CMakeLists.txt | 1 + 2 files changed, 7 insertions(+) create mode 100644 src/ncint/CMakeLists.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8f481196e42..19b0a043998 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -45,3 +45,9 @@ if (PIO_ENABLE_FORTRAN) set(FCFLAGS ${FCFLAGS} PARENT_SCOPE) set(FPPFLAGS ${FPPFLAGS} PARENT_SCOPE) endif () + +# Build the netCDF integration layer if desired. +if (PIO_ENABLE_NETCDF_INTEGRATION) + add_subdirectory (ncint) +endif () + diff --git a/src/ncint/CMakeLists.txt b/src/ncint/CMakeLists.txt new file mode 100644 index 00000000000..4a0b4d57faf --- /dev/null +++ b/src/ncint/CMakeLists.txt @@ -0,0 +1 @@ +cmake_minimum_required (VERSION 2.8.12) From f269769d9a37b52bcd28fb41ae25d013626bbfeb Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 10 Aug 2020 14:26:59 -0600 Subject: [PATCH 05/14] fixed setting of configure define in cmake --- CMakeLists.txt | 16 +++++++++------- cmake_config.h.in | 1 - 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b4bf275c2de..40e915f655e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,13 +213,6 @@ endif () set (CMAKE_Fortran_COMPILER_DIRECTIVE "CPR${CMAKE_Fortran_COMPILER_NAME}" CACHE STRING "Fortran compiler name preprocessor directive") -# configure a header file to pass some of the CMake settings -# to the source code -configure_file ( - "${PROJECT_SOURCE_DIR}/cmake_config.h.in" - "${PROJECT_BINARY_DIR}/config.h" - ) - #============================================================================== # SET CODE COVERAGE COMPILER FLAGS #============================================================================== @@ -426,3 +419,12 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/clib/pio_meta.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/clib/pio_meta.h @ONLY) +# configure a header file to pass some of the CMake settings +# to the source code +configure_file ( + "${PROJECT_SOURCE_DIR}/cmake_config.h.in" + "${PROJECT_BINARY_DIR}/config.h" + ) + + + diff --git a/cmake_config.h.in b/cmake_config.h.in index ac4551f8b26..c641cddfcf6 100644 --- a/cmake_config.h.in +++ b/cmake_config.h.in @@ -33,7 +33,6 @@ #define USE_VARD @USE_VARD@ #cmakedefine HAVE_PAR_FILTERS - #cmakedefine NETCDF_INTEGRATION #endif /* _PIO_CONFIG_ */ From eaa06560776d4bee2e687411e2274e6c025d8a65 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 19 Aug 2020 04:48:48 -0600 Subject: [PATCH 06/14] now building ncint directory with cmake --- src/clib/CMakeLists.txt | 4 ++++ src/ncint/CMakeLists.txt | 44 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index d81ec2edbc4..948a7a0f8dd 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -21,6 +21,10 @@ include_directories( target_include_directories (pioc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +# Include the ncint source directory +target_include_directories (pioc + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ncint) + # System and compiler CPP directives target_compile_definitions (pioc PUBLIC ${CMAKE_SYSTEM_DIRECTIVE}) diff --git a/src/ncint/CMakeLists.txt b/src/ncint/CMakeLists.txt index 4a0b4d57faf..8d5776d46c8 100644 --- a/src/ncint/CMakeLists.txt +++ b/src/ncint/CMakeLists.txt @@ -1 +1,45 @@ cmake_minimum_required (VERSION 2.8.12) + +add_library(ncint nc_get_vard.c ncintdispatch.c ncint_pio.c nc_put_vard.c) + +# set up include-directories +include_directories( + "${CMAKE_BINARY_DIR}" + "${PROJECT_SOURCE_DIR}" # to find foo/foo.h + "${PROJECT_BINARY_DIR}") # to find foo/config.h + +# Include the clib source directory +target_include_directories (ncint + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +# Include the ncint source directory +target_include_directories (ncint + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../clib) + +#===== NetCDF-C ===== +find_package (NetCDF "4.3.3" COMPONENTS C) +if (NetCDF_C_FOUND) + target_include_directories (ncint + PUBLIC ${NetCDF_C_INCLUDE_DIRS}) + target_compile_definitions (ncint + PUBLIC _NETCDF) + target_link_libraries (ncint + PUBLIC ${NetCDF_C_LIBRARIES}) + if (${NetCDF_C_HAS_PARALLEL}) + target_compile_definitions (ncint + PUBLIC _NETCDF4) + endif () + if (${NetCDF_C_LOGGING_ENABLED}) + target_compile_definitions (ncint + PUBLIC NETCDF_C_LOGGING_ENABLED) + # netcdf.h needs this to be defined to use netCDF logging. + target_compile_definitions (ncint + PUBLIC LOGGING) + endif() +else () + target_compile_definitions (ncint + PUBLIC _NONETCDF) +endif () + + + From 9f57a5cc540f8d6640d542eb44d1898de735ca64 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 19 Aug 2020 04:57:31 -0600 Subject: [PATCH 07/14] ncint build working! --- src/clib/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index 948a7a0f8dd..773acad1248 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -42,6 +42,10 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") string(APPEND CMAKE_C_FLAGS " -std=c99 ") endif() +if (NETCDF_INTEGRATION) + target_link_libraries(pioc PUBLIC ncint) +endif () + #============================================================================== # DEFINE THE INSTALL #============================================================================== From 6bd5fa47309495ef0df4a25efe38b74056ecd734 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 19 Aug 2020 05:46:34 -0600 Subject: [PATCH 08/14] moved cmake build of ncint into src/clib dir, now test works! --- src/clib/CMakeLists.txt | 11 +++--- src/ncint/CMakeLists.txt | 80 ++++++++++++++++++++-------------------- tests/CMakeLists.txt | 4 ++ 3 files changed, 50 insertions(+), 45 deletions(-) diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index 773acad1248..49f772ba371 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -6,10 +6,15 @@ project (PIOC C) # DEFINE THE TARGET #============================================================================== -add_library (pioc topology.c pio_file.c pioc_support.c pio_lists.c +set (src topology.c pio_file.c pioc_support.c pio_lists.c pioc.c pioc_sc.c pio_spmd.c pio_rearrange.c pio_nc4.c bget.c pio_nc.c pio_put_nc.c pio_get_nc.c pio_getput_int.c pio_msg.c pio_darray.c pio_darray_int.c pio_get_vard.c pio_put_vard.c pio_error.c) +if (NETCDF_INTEGRATION) + set (src ${src} ../ncint/nc_get_vard.c ../ncint/ncintdispatch.c ../ncint/ncint_pio.c ../ncint/nc_put_vard.c) +endif () + +add_library (pioc ${src}) # set up include-directories include_directories( @@ -42,10 +47,6 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") string(APPEND CMAKE_C_FLAGS " -std=c99 ") endif() -if (NETCDF_INTEGRATION) - target_link_libraries(pioc PUBLIC ncint) -endif () - #============================================================================== # DEFINE THE INSTALL #============================================================================== diff --git a/src/ncint/CMakeLists.txt b/src/ncint/CMakeLists.txt index 8d5776d46c8..2344f93bf84 100644 --- a/src/ncint/CMakeLists.txt +++ b/src/ncint/CMakeLists.txt @@ -1,45 +1,45 @@ cmake_minimum_required (VERSION 2.8.12) -add_library(ncint nc_get_vard.c ncintdispatch.c ncint_pio.c nc_put_vard.c) - -# set up include-directories -include_directories( - "${CMAKE_BINARY_DIR}" - "${PROJECT_SOURCE_DIR}" # to find foo/foo.h - "${PROJECT_BINARY_DIR}") # to find foo/config.h - -# Include the clib source directory -target_include_directories (ncint - PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) - -# Include the ncint source directory -target_include_directories (ncint - PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../clib) - -#===== NetCDF-C ===== -find_package (NetCDF "4.3.3" COMPONENTS C) -if (NetCDF_C_FOUND) - target_include_directories (ncint - PUBLIC ${NetCDF_C_INCLUDE_DIRS}) - target_compile_definitions (ncint - PUBLIC _NETCDF) - target_link_libraries (ncint - PUBLIC ${NetCDF_C_LIBRARIES}) - if (${NetCDF_C_HAS_PARALLEL}) - target_compile_definitions (ncint - PUBLIC _NETCDF4) - endif () - if (${NetCDF_C_LOGGING_ENABLED}) - target_compile_definitions (ncint - PUBLIC NETCDF_C_LOGGING_ENABLED) - # netcdf.h needs this to be defined to use netCDF logging. - target_compile_definitions (ncint - PUBLIC LOGGING) - endif() -else () - target_compile_definitions (ncint - PUBLIC _NONETCDF) -endif () +# add_library(ncint nc_get_vard.c ncintdispatch.c ncint_pio.c nc_put_vard.c) + +# # set up include-directories +# include_directories( +# "${CMAKE_BINARY_DIR}" +# "${PROJECT_SOURCE_DIR}" # to find foo/foo.h +# "${PROJECT_BINARY_DIR}") # to find foo/config.h + +# # Include the clib source directory +# target_include_directories (ncint +# PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../clib) + +# # Include the ncint source directory +# target_include_directories (ncint +# PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +# #===== NetCDF-C ===== +# find_package (NetCDF "4.3.3" COMPONENTS C) +# if (NetCDF_C_FOUND) +# target_include_directories (ncint +# PUBLIC ${NetCDF_C_INCLUDE_DIRS}) +# target_compile_definitions (ncint +# PUBLIC _NETCDF) +# target_link_libraries (ncint +# PUBLIC ${NetCDF_C_LIBRARIES}) +# if (${NetCDF_C_HAS_PARALLEL}) +# target_compile_definitions (ncint +# PUBLIC _NETCDF4) +# endif () +# if (${NetCDF_C_LOGGING_ENABLED}) +# target_compile_definitions (ncint +# PUBLIC NETCDF_C_LOGGING_ENABLED) +# # netcdf.h needs this to be defined to use netCDF logging. +# target_compile_definitions (ncint +# PUBLIC LOGGING) +# endif() +# else () +# target_compile_definitions (ncint +# PUBLIC _NONETCDF) +# endif () diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 115c732b51c..ebd9878d46b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -26,3 +26,7 @@ if (PIO_ENABLE_FORTRAN) message (STATUS "Cannot build performance test without gptl timing library") endif () endif() + +if (NETCDF_INTEGRATION) + add_subdirectory(ncint) +endif () From 444f0233d1106cf12bfdceddc833b2185acf3c16 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 19 Aug 2020 05:49:10 -0600 Subject: [PATCH 09/14] more work on ncint in cmake build --- src/CMakeLists.txt | 4 ---- src/ncint/CMakeLists.txt | 45 -------------------------------------- tests/ncint/CMakeLists.txt | 35 +++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 49 deletions(-) delete mode 100644 src/ncint/CMakeLists.txt create mode 100644 tests/ncint/CMakeLists.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 19b0a043998..1b76351a681 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,8 +46,4 @@ if (PIO_ENABLE_FORTRAN) set(FPPFLAGS ${FPPFLAGS} PARENT_SCOPE) endif () -# Build the netCDF integration layer if desired. -if (PIO_ENABLE_NETCDF_INTEGRATION) - add_subdirectory (ncint) -endif () diff --git a/src/ncint/CMakeLists.txt b/src/ncint/CMakeLists.txt deleted file mode 100644 index 2344f93bf84..00000000000 --- a/src/ncint/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -cmake_minimum_required (VERSION 2.8.12) - -# add_library(ncint nc_get_vard.c ncintdispatch.c ncint_pio.c nc_put_vard.c) - -# # set up include-directories -# include_directories( -# "${CMAKE_BINARY_DIR}" -# "${PROJECT_SOURCE_DIR}" # to find foo/foo.h -# "${PROJECT_BINARY_DIR}") # to find foo/config.h - -# # Include the clib source directory -# target_include_directories (ncint -# PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../clib) - -# # Include the ncint source directory -# target_include_directories (ncint -# PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) - -# #===== NetCDF-C ===== -# find_package (NetCDF "4.3.3" COMPONENTS C) -# if (NetCDF_C_FOUND) -# target_include_directories (ncint -# PUBLIC ${NetCDF_C_INCLUDE_DIRS}) -# target_compile_definitions (ncint -# PUBLIC _NETCDF) -# target_link_libraries (ncint -# PUBLIC ${NetCDF_C_LIBRARIES}) -# if (${NetCDF_C_HAS_PARALLEL}) -# target_compile_definitions (ncint -# PUBLIC _NETCDF4) -# endif () -# if (${NetCDF_C_LOGGING_ENABLED}) -# target_compile_definitions (ncint -# PUBLIC NETCDF_C_LOGGING_ENABLED) -# # netcdf.h needs this to be defined to use netCDF logging. -# target_compile_definitions (ncint -# PUBLIC LOGGING) -# endif() -# else () -# target_compile_definitions (ncint -# PUBLIC _NONETCDF) -# endif () - - - diff --git a/tests/ncint/CMakeLists.txt b/tests/ncint/CMakeLists.txt new file mode 100644 index 00000000000..a9fc3fda92b --- /dev/null +++ b/tests/ncint/CMakeLists.txt @@ -0,0 +1,35 @@ +include (LibMPI) + +include_directories("${CMAKE_SOURCE_DIR}/tests/ncint") +include_directories("${CMAKE_BINARY_DIR}") + +#============================================================================== +# PREPARE FOR TESTING +#============================================================================== + +# Don't run these tests if we are using MPI SERIAL. +add_executable (tst_pio_udf EXCLUDE_FROM_ALL tst_pio_udf.c) +add_dependencies (tests tst_pio_udf) +target_link_libraries (tst_pio_udf pioc) + +# Test Timeout in seconds. +if (PIO_VALGRIND_CHECK) + set (DEFAULT_TEST_TIMEOUT 480) +else () + set (DEFAULT_TEST_TIMEOUT 240) +endif () + +# All tests need a certain number of tasks, but they should be able to +# run successfully with more than they need. Test this by providing an +# extra processor for each C test. +set (AT_LEAST_TWO_TASKS 3) +set (AT_LEAST_THREE_TASKS 4) +set (AT_LEAST_FOUR_TASKS 5) +set (AT_LEAST_EIGHT_TASKS 9) +set (EXACTLY_FOUR_TASKS 4) + +add_mpi_test(tst_pio_udf + EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/tst_pio_udf + NUMPROCS ${AT_LEAST_FOUR_TASKS} + TIMEOUT ${DEFAULT_TEST_TIMEOUT}) + From 08c7999e25296317ccaadeb63dcfeb11df9445e1 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 19 Aug 2020 05:56:56 -0600 Subject: [PATCH 10/14] now all ncint tests work --- tests/ncint/CMakeLists.txt | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/tests/ncint/CMakeLists.txt b/tests/ncint/CMakeLists.txt index a9fc3fda92b..2df85384140 100644 --- a/tests/ncint/CMakeLists.txt +++ b/tests/ncint/CMakeLists.txt @@ -3,14 +3,8 @@ include (LibMPI) include_directories("${CMAKE_SOURCE_DIR}/tests/ncint") include_directories("${CMAKE_BINARY_DIR}") -#============================================================================== -# PREPARE FOR TESTING -#============================================================================== - -# Don't run these tests if we are using MPI SERIAL. -add_executable (tst_pio_udf EXCLUDE_FROM_ALL tst_pio_udf.c) -add_dependencies (tests tst_pio_udf) -target_link_libraries (tst_pio_udf pioc) +set (my_tests tst_async_multi tst_ncint_async_perf + tst_ncint_perf tst_pio_async tst_pio_udf) # Test Timeout in seconds. if (PIO_VALGRIND_CHECK) @@ -19,17 +13,13 @@ else () set (DEFAULT_TEST_TIMEOUT 240) endif () -# All tests need a certain number of tasks, but they should be able to -# run successfully with more than they need. Test this by providing an -# extra processor for each C test. -set (AT_LEAST_TWO_TASKS 3) -set (AT_LEAST_THREE_TASKS 4) -set (AT_LEAST_FOUR_TASKS 5) -set (AT_LEAST_EIGHT_TASKS 9) -set (EXACTLY_FOUR_TASKS 4) - -add_mpi_test(tst_pio_udf - EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/tst_pio_udf - NUMPROCS ${AT_LEAST_FOUR_TASKS} - TIMEOUT ${DEFAULT_TEST_TIMEOUT}) +FOREACH(tst ${my_tests}) + add_executable (${tst} EXCLUDE_FROM_ALL ${tst}.c) + add_dependencies (tests ${tst}) + target_link_libraries (${tst} pioc) + add_mpi_test(${tst} + EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/${tst} + NUMPROCS 4 + TIMEOUT ${DEFAULT_TEST_TIMEOUT}) +ENDFOREACH() From a604f76f390b44f8df2a81a7475b0dc9c08d8e05 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 19 Aug 2020 05:59:57 -0600 Subject: [PATCH 11/14] added new github workflow for netCDF integration with cmake --- .github/workflows/cmake_ncint.yml | 54 +++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/cmake_ncint.yml diff --git a/.github/workflows/cmake_ncint.yml b/.github/workflows/cmake_ncint.yml new file mode 100644 index 00000000000..d01b44aad82 --- /dev/null +++ b/.github/workflows/cmake_ncint.yml @@ -0,0 +1,54 @@ +name: cmake_ncint + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + env: + CC: mpicc + FC: mpifort + CPPFLAGS: "-I/usr/include -I/usr/local/include -I/home/runner/pnetcdf/include" + LDFLAGS: "-L/home/runner/pnetcdf/lib" + LD_LIBRARY_PATH: "/home/runner/pnetcdf/lib" + + steps: + - uses: actions/checkout@v2 + - name: Installs + run: | + sudo apt-get install netcdf-bin libnetcdf-dev doxygen graphviz wget gfortran libjpeg-dev libz-dev openmpi-bin libopenmpi-dev + + - name: cache-pnetcdf + id: cache-pnetcdf + uses: actions/cache@v2 + with: + path: ~/pnetcdf + key: pnetcdf-${{ runner.os }}-1.12.1 + + - name: build-pnetcdf + if: steps.cache-pnetcdf.outputs.cache-hit != 'true' + run: | + set -x + wget https://parallel-netcdf.github.io/Release/pnetcdf-1.12.1.tar.gz &> /dev/null + tar -xzvf pnetcdf-1.12.1.tar.gz + pushd pnetcdf-1.12.1 + ./configure --prefix=/home/runner/pnetcdf --enable-shared --disable-cxx + make + sudo make install + popd + + - name: cmake build + run: | + set -x + mkdir build + cd build + cmake -Wno-dev -DPIO_ENABLE_NETCDF_INTEGRATION=On -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_USE_MALLOC=On -DPIO_ENABLE_LOGGING=On -DPIO_ENABLE_TIMING=Off .. + make VERBOSE=1 + make tests VERBOSE=1 + ctest -VV From 15527bf8e001c16fcfa02b297c5843ebad4b5985 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 19 Aug 2020 06:03:06 -0600 Subject: [PATCH 12/14] cleaned up cmake_config.h.in --- cmake_config.h.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake_config.h.in b/cmake_config.h.in index fa5cc87c273..b7ed181b372 100644 --- a/cmake_config.h.in +++ b/cmake_config.h.in @@ -30,12 +30,16 @@ #define USE_VARD @USE_VARD@ +/* Does netCDF and HDF5 support parallel I/O filters? */ #cmakedefine HAVE_PAR_FILTERS -#cmakedefine NETCDF_INTEGRATION -#cmakedefine HAVE_PAR_FILTERS +/* Was PIO built with netCDF integration? */ #cmakedefine NETCDF_INTEGRATION + +/* Does PIO support netCDF/HDF5 files? */ #cmakedefine _NETCDF4 + +/* Does PIO support using pnetcdf for I/O? */ #cmakedefine _PNETCDF #endif /* _PIO_CONFIG_ */ From 78dd092ef6bba15322e5896706c9046cd617a06b Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 19 Aug 2020 06:07:08 -0600 Subject: [PATCH 13/14] clean up --- .github/workflows/cmake_ncint.yml | 6 +++++- src/CMakeLists.txt | 2 -- tests/ncint/CMakeLists.txt | 6 ++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake_ncint.yml b/.github/workflows/cmake_ncint.yml index d01b44aad82..bf306bef28d 100644 --- a/.github/workflows/cmake_ncint.yml +++ b/.github/workflows/cmake_ncint.yml @@ -1,4 +1,8 @@ -name: cmake_ncint +# This is the GitHub workflow file to build and test the PIO library with CMake, and netCDF integration. + +# Ed Hartnett 8/19/20 + + name: cmake_ncint on: push: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1b76351a681..8f481196e42 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -45,5 +45,3 @@ if (PIO_ENABLE_FORTRAN) set(FCFLAGS ${FCFLAGS} PARENT_SCOPE) set(FPPFLAGS ${FPPFLAGS} PARENT_SCOPE) endif () - - diff --git a/tests/ncint/CMakeLists.txt b/tests/ncint/CMakeLists.txt index 2df85384140..69421efde0a 100644 --- a/tests/ncint/CMakeLists.txt +++ b/tests/ncint/CMakeLists.txt @@ -1,3 +1,9 @@ +# This is part of the PIO library. +# +# This is the cmake file to build the test directory for netCDF integration. +# +# Ed Hartnett 8/19/20 + include (LibMPI) include_directories("${CMAKE_SOURCE_DIR}/tests/ncint") From e57c5aa1c4476e44431ee74892ecfebd1f1a5937 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 19 Aug 2020 06:20:54 -0600 Subject: [PATCH 14/14] properly dealing with ncint_mod.F90 in cmake build --- src/flib/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/flib/CMakeLists.txt b/src/flib/CMakeLists.txt index 1e357c81e5d..2f4f54feacc 100644 --- a/src/flib/CMakeLists.txt +++ b/src/flib/CMakeLists.txt @@ -31,6 +31,11 @@ set (PIO_Fortran_MODS ${CMAKE_CURRENT_BINARY_DIR}/pio.mod ${CMAKE_CURRENT_BINARY_DIR}/pionfatt_mod.mod ${CMAKE_CURRENT_BINARY_DIR}/pionfput_mod.mod) +if (NETCDF_INTEGRATION) + set (PIO_Fortran_SRCS ${PIO_Fortran_SRCS} ncint_mod.F90) + set (PIO_Fortran_MODS ${PIO_Fortran_MODS} ${CMAKE_CURRENT_BINARY_DIR}/ncint_mod.mod) +endif () + add_library (piof ${PIO_Fortran_SRCS} ${PIO_GenF90_SRCS}) if (NOT PIO_ENABLE_FORTRAN) set_target_properties(piof PROPERTIES EXCLUDE_FROM_ALL TRUE)