diff --git a/.github/workflows/a3.yml b/.github/workflows/a3.yml index 71e66ffd4d1..a79f3962c98 100644 --- a/.github/workflows/a3.yml +++ b/.github/workflows/a3.yml @@ -1,4 +1,4 @@ -name: netcdf-4.7.4_pnetcdf-12.1_ncint +name: netcdf-4.7.4_pnetcdf-12.1_ncint_openmpi_4.0.4 on: push: @@ -117,9 +117,20 @@ jobs: make sudo make install popd - - name: autoreconf - run: autoreconf -i - - name: pio build + - name: cmake build + run: | + set -x + echo 'export PATH=/home/runner/openmpi/bin:$PATH' > .bashrc + source .bashrc + export CC=mpicc + mkdir build + cd build + export LD_LIBRARY_PATH="/home/runner/netcdf-c/lib:/home/runner/pnetcdf/lib:/home/runner/hdf5/lib:/home/runner/openmpi/lib:$LD_LIBRARY_PATH" + cmake -Wno-dev -DWITH_MPIEXEC='/home/runner/openmpi/bin/mpiexec;--oversubscribe' -DNetCDF_C_LIBRARY=/home/runner/netcdf-c/lib/libnetcdf.so -DNetCDF_C_INCLUDE_DIR=/home/runner/netcdf-c/include -DPnetCDF_PATH='/home/runner/pnetcdf' -DPIO_ENABLE_FORTRAN=Off -DPIO_HDF5_LOGGING=On -DPIO_USE_MALLOC=On -DPIO_ENABLE_LOGGING=On -DPIO_ENABLE_TIMING=Off .. || (cat CMakeFiles/CMakeOutput.log && cat CMakeFiles/CMakeError.log) + make VERBOSE=1 + make tests VERBOSE=1 + ctest -VV + - name: autotools build run: | set -x echo 'export PATH=/home/runner/openmpi/bin:$PATH' > .bashrc @@ -128,8 +139,10 @@ jobs: source .bashrc export PATH="/home/runner/openmpi/bin:$PATH" export CC=/home/runner/openmpi/bin/mpicc + autoreconf -i ./configure --with-mpiexec='mpiexec --oversubscribe' which mpiexec make check + diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f1023cf9eb..d0dc010bd1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,9 @@ +# This is part of the PIO library. + +# This is the CMake build file for the main directory. + +# Jim Edwards + cmake_minimum_required (VERSION 2.8.12) project (PIO C Fortran) #cmake_policy(VERSION 3.5.2) @@ -16,6 +22,9 @@ set(PIO_VERSION_PATCH ${VERSION_PATCH}) # This is needed for the libpio.settings file. SET(PACKAGE_VERSION ${PIO_VERSION_MAJOR}.${PIO_VERSION_MINOR}.${PIO_VERSION_PATCH}) +# This provides cmake_print_variables() function for debugging. +include(CMakePrintHelpers) + # Determine the configure date. IF(DEFINED ENV{SOURCE_DATE_EPOCH}) EXECUTE_PROCESS( @@ -444,10 +453,8 @@ configure_file ( ) # Configure test scripts. -set(MPIEXEC mpiexec) -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/tests/cunit/run_tests.sh.in - ${CMAKE_CURRENT_BINARY_DIR}/tests/cunit/run_tests.sh @ONLY) -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/examples/c/run_tests.sh.in - ${CMAKE_CURRENT_BINARY_DIR}/examples/c/run_tests.sh @ONLY) +if (NOT WITH_MPIEXEC) + set(WITH_MPIEXEC mpiexec) +endif() +set(MPIEXEC "${WITH_MPIEXEC}" CACHE INTERNAL "") +set_property(GLOBAL PROPERTY WITH_MPIEXEC "${WITH_MPIEXEC}") diff --git a/cmake/LibMPI.cmake b/cmake/LibMPI.cmake index f1116724831..2fa9f52af50 100644 --- a/cmake/LibMPI.cmake +++ b/cmake/LibMPI.cmake @@ -1,3 +1,8 @@ +# This is part of the PIO library. + +# THis file contains CMake code related to MPI. + +# Jim Edwards include (CMakeParseArguments) # Find Valgrind to perform memory leak check @@ -90,6 +95,11 @@ function (add_mpi_test TESTNAME) # Get the platform name platform_name (PLATFORM) + get_property(WITH_MPIEXEC GLOBAL PROPERTY WITH_MPIEXEC) + if (WITH_MPIEXEC) + set(MPIEXEC "${WITH_MPIEXEC}") + endif () + # Default ("unknown" platform) execution if (PLATFORM STREQUAL "unknown") diff --git a/configure.ac b/configure.ac index 63ed63e6309..1d8b48470d6 100644 --- a/configure.ac +++ b/configure.ac @@ -207,9 +207,9 @@ AC_MSG_CHECKING([whether a user specified program to run mpi programs]) AC_ARG_WITH([mpiexec], [AS_HELP_STRING([--with-mpiexec=], [Specify command to launch MPI parallel tests.])], - [MPIEXEC=$with_mpiexec], [MPIEXEC=mpiexec]) -AC_MSG_RESULT([$MPIEXEC]) -AC_SUBST([MPIEXEC], [$MPIEXEC]) + [WITH_MPIEXEC=$with_mpiexec], [WITH_MPIEXEC=mpiexec]) +AC_MSG_RESULT([$WITH_MPIEXEC]) +AC_SUBST([WITH_MPIEXEC], [$WITH_MPIEXEC]) # Is doxygen installed? AC_CHECK_PROGS([DOXYGEN], [doxygen]) diff --git a/examples/c/run_tests.sh.in b/examples/c/run_tests.sh.in index 1caefa7585d..7651c835624 100755 --- a/examples/c/run_tests.sh.in +++ b/examples/c/run_tests.sh.in @@ -19,7 +19,7 @@ for EXAMPLE in $PIO_EXAMPLES do success1=false echo "running ${EXAMPLE}" - @MPIEXEC@ -n 4 ./${EXAMPLE} && success1=true + @WITH_MPIEXEC@ -n 4 ./${EXAMPLE} && success1=true if test $success1 = false; then break fi @@ -29,7 +29,7 @@ for EXAMPLE in $PIO_EXAMPLES_16 do success2=false echo "running ${EXAMPLE}" - @MPIEXEC@ -n 16 ./${EXAMPLE} && success2=true + @WITH_MPIEXEC@ -n 16 ./${EXAMPLE} && success2=true if test $success2 = false; then break fi diff --git a/tests/cunit/run_tests.sh.in b/tests/cunit/run_tests.sh.in index bd6e4f29215..0d322960da6 100644 --- a/tests/cunit/run_tests.sh.in +++ b/tests/cunit/run_tests.sh.in @@ -26,7 +26,7 @@ for TEST in $PIO_TESTS do success1=false echo "running ${TEST}" - @MPIEXEC@ -n 4 ./${TEST} && success1=true + @WITH_MPIEXEC@ -n 4 ./${TEST} && success1=true if test $success1 = false; then break fi @@ -38,7 +38,7 @@ for TEST in $PIO_TESTS_8 do success2=false echo "running ${TEST}" - @MPIEXEC@ -n 8 ./${TEST} && success2=true + @WITH_MPIEXEC@ -n 8 ./${TEST} && success2=true if test $success2 = false; then break fi