Skip to content

Commit

Permalink
Merge pull request #1733 from NCAR/ejh_openmpi_2
Browse files Browse the repository at this point in the history
Adding cmake build of C library to openmpi GitHub actions testing workflow, also allow setting of mpiexec command at configure
  • Loading branch information
edwardhartnett authored Aug 26, 2020
2 parents 00e667f + 7b874db commit e715d07
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 18 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/a3.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
21 changes: 14 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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(
Expand Down Expand Up @@ -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}")
10 changes: 10 additions & 0 deletions cmake/LibMPI.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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")

Expand Down
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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=<command>],
[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])
Expand Down
4 changes: 2 additions & 2 deletions examples/c/run_tests.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/cunit/run_tests.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit e715d07

Please sign in to comment.