Correct passing Fortran strings from C #272
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
BUILD_TYPE: Debug | |
jobs: | |
build: | |
strategy: | |
matrix: | |
# The order of these definition matters for the web output | |
# TODO: Test on 32-bit systems (not possible with Github Actions?) | |
# TODO: Test on Windows | |
os: [ubuntu-20.04, macos-11] | |
mpi: [MPICH, OpenMPI] | |
findmpi: [MPIEXEC_EXECUTABLE, MPI_HOME, CMAKE_C_COMPILER] | |
shared: [OFF, ON] | |
mpitrampoline: [9b06f8077405e7ad433314f45b35b40263fc45aa] | |
mpiwrapper: [4dcc42b92afd47a0588588d927c942c832e88e88] | |
exclude: | |
- os: macos-11 | |
shared: ON | |
runs-on: ${{matrix.os}} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install system packages | |
run: | | |
case $RUNNER_OS in | |
Linux) | |
sudo apt-get update | |
case "${{matrix.mpi}}" in | |
MPICH) sudo apt-get install libmpich-dev;; | |
OpenMPI) sudo apt-get install libopenmpi-dev;; | |
esac | |
;; | |
macOS) | |
case "${{matrix.mpi}}" in | |
MPICH) :;; | |
OpenMPI) brew install automake;; | |
esac | |
;; | |
esac | |
- name: Cache MPI | |
id: cache-mpi | |
uses: actions/cache@v2 | |
with: | |
path: ${{github.workspace}}/mpi | |
key: ${{runner.os}}-${{matrix.mpi}}-${{matrix.shared}}-v2 | |
- name: Install MPI ${{matrix.mpi}} | |
if: steps.cache-mpi.outputs.cache-hit != 'true' | |
run: | | |
case $RUNNER_OS in | |
Linux) | |
;; | |
macOS) | |
case ${{matrix.mpi}} in | |
MPICH) | |
wget https://www.mpich.org/static/downloads/4.0.3/mpich-4.0.3.tar.gz | |
tar xzf mpich*.tar.gz | |
cd mpich* | |
# Use GCC-11 from Homebrew | |
export CC=gcc-11 | |
export CXX=g++-11 | |
export F77=gfortran-11 | |
export FC=gfortran-11 | |
if [ ${{matrix.shared}} = OFF ]; then | |
export FFLAGS='-fallow-argument-mismatch' | |
export FCFLAGS='-fallow-argument-mismatch' | |
./configure \ | |
--disable-opencl \ | |
--enable-threads=multiple \ | |
--enable-two-level-namespace \ | |
--prefix=${{github.workspace}}/mpi | |
else | |
# On macOS, MPItrampoline shared libraries work | |
# only for statically linked MPICH libraries. | |
export CFLAGS='-fPIC -DPIC' | |
export CXXLAGS='-fPIC -DPIC' | |
export FFLAGS='-fPIC -DPIC -fallow-argument-mismatch' | |
export FCFLAGS='-fPIC -DPIC -fallow-argument-mismatch' | |
./configure \ | |
--disable-opencl \ | |
--disable-shared \ | |
--enable-static \ | |
--enable-threads=multiple \ | |
--enable-two-level-namespace \ | |
--prefix=${{github.workspace}}/mpi | |
fi | |
make -j2 | |
make -j2 install | |
;; | |
OpenMPI) | |
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.4.tar.gz | |
tar xzf openmpi*.tar.gz | |
cd openmpi* | |
# Use GCC-11 from Homebrew | |
export CC=gcc-11 | |
export CXX=g++-11 | |
export F77=gfortran-11 | |
export FC=gfortran-11 | |
# On macOS, MPItrampoline works only for statically | |
# linked OpenMPI libraries. | |
find . -type f -print0 | xargs -0 perl -pi -e 's/-Wl,-flat_namespace//g;s/\$\{wl\}-flat_namespace//g' | |
./autogen.pl --force | |
export CFLAGS='-fPIC -DPIC' | |
export CXXLAGS='-fPIC -DPIC' | |
export FFLAGS='-fPIC -DPIC -fallow-argument-mismatch' | |
export FCFLAGS='-fPIC -DPIC -fallow-argument-mismatch' | |
./configure \ | |
--disable-man-pages \ | |
--disable-shared \ | |
--enable-mpi-fortran=usempif08 \ | |
--enable-static \ | |
--prefix=${{github.workspace}}/mpi | |
make -j2 | |
make -j2 install | |
;; | |
esac | |
;; | |
esac | |
- name: Install MPIwrapper/${{matrix.mpi}} | |
run: | | |
# See MPIwrapper | |
export PATH="${{github.workspace}}/mpi/bin:$PATH" | |
git clone https://github.com/eschnett/MPIwrapper | |
cd MPIwrapper | |
git checkout ${{matrix.mpiwrapper}} | |
cmake -S . -B build \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
-DCMAKE_C_COMPILER=mpicc \ | |
-DCMAKE_CXX_COMPILER=mpicxx \ | |
-DCMAKE_Fortran_COMPILER=mpifort \ | |
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/mpiwrapper-${{matrix.mpi}} | |
cmake --build build --config ${{env.BUILD_TYPE}} | |
cmake --install build --config ${{env.BUILD_TYPE}} | |
- name: Install MPItrampoline | |
run: | | |
git clone https://github.com/eschnett/MPItrampoline | |
cd MPItrampoline | |
git checkout ${{matrix.mpitrampoline}} | |
case $RUNNER_OS in | |
Linux) | |
# do nothing | |
;; | |
macOS) | |
# Use GCC-11 from Homebrew | |
export CC=gcc-11 | |
export CXX=g++-11 | |
export FC=gfortran-11 | |
;; | |
esac | |
cmake -S . -B build \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ | |
-DBUILD_SHARED_LIBS=${{matrix.shared}} \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/mpitrampoline | |
cmake --build build | |
cmake --install build | |
- name: Configure Tests | |
run: | | |
case $RUNNER_OS in | |
Linux) | |
# Not needed for CMAKE_C_COMPILER | |
export FFLAGS='-fcray-pointer' | |
;; | |
macOS) | |
# Use GCC-11 from Homebrew | |
export CC=gcc-11 | |
export CXX=g++-11 | |
export FC=gfortran-11 | |
# Not needed for CMAKE_C_COMPILER | |
export FFLAGS='-fallow-argument-mismatch -fcray-pointer' | |
;; | |
esac | |
case "${{matrix.findmpi}}" in | |
MPIEXEC_EXECUTABLE) | |
cmake -B ${{github.workspace}}/build \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
-DMPIEXEC_EXECUTABLE=$HOME/mpitrampoline/bin/mpiexec \ | |
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/mpitest | |
;; | |
MPI_HOME) | |
cmake -B ${{github.workspace}}/build \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
-DMPI_HOME=$HOME/mpitrampoline \ | |
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/mpitest | |
;; | |
CMAKE_C_COMPILER) | |
cmake -B ${{github.workspace}}/build \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
-DCMAKE_C_COMPILER=$HOME/mpitrampoline/bin/mpicc \ | |
-DCMAKE_CXX_COMPILER=$HOME/mpitrampoline/bin/mpicxx \ | |
-DCMAKE_Fortran_COMPILER=$HOME/mpitrampoline/bin/mpifort \ | |
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/mpitest | |
;; | |
esac | |
- name: Build tests | |
run: | | |
case $RUNNER_OS in | |
Linux) | |
export FFLAGS='-fcray-pointer' | |
;; | |
macOS) | |
# Use GCC-11 from Homebrew | |
export CC=gcc-11 | |
export CXX=g++-11 | |
export FC=gfortran-11 | |
export FFLAGS='-fallow-argument-mismatch -fcray-pointer' | |
export MPITRAMPOLINE_CC=gcc-11 | |
export MPITRAMPOLINE_CXX=g++-11 | |
export MPITRAMPOLINE_FC=gfortran-11 | |
;; | |
esac | |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
- name: Install tests | |
run: cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
- name: Test C ${{matrix.mpi}} | |
run: | | |
case "${{matrix.mpi}}" in | |
MPICH) mpiexec_options='';; | |
OpenMPI) mpiexec_options='--oversubscribe';; | |
esac | |
export MPITRAMPOLINE_VERBOSE=1 | |
export MPITRAMPOLINE_MPIEXEC=$HOME/mpiwrapper-${{matrix.mpi}}/bin/mpiwrapperexec | |
export MPITRAMPOLINE_LIB=$HOME/mpiwrapper-${{matrix.mpi}}/lib/libmpiwrapper.so | |
$HOME/mpitrampoline/bin/mpiexec ${mpiexec_options} -n 4 $HOME/mpitest/bin/mpi-test-c | |
- name: Test C++ ${{matrix.mpi}} | |
run: | | |
case "${{matrix.mpi}}" in | |
MPICH) mpiexec_options='';; | |
OpenMPI) mpiexec_options='--oversubscribe';; | |
esac | |
export MPITRAMPOLINE_VERBOSE=1 | |
export MPITRAMPOLINE_MPIEXEC=$HOME/mpiwrapper-${{matrix.mpi}}/bin/mpiwrapperexec | |
export MPITRAMPOLINE_LIB=$HOME/mpiwrapper-${{matrix.mpi}}/lib/libmpiwrapper.so | |
$HOME/mpitrampoline/bin/mpiexec ${mpiexec_options} -n 4 $HOME/mpitest/bin/mpi-test-cxx | |
- name: Test Fortran 77 mpif ${{matrix.mpi}} | |
run: | | |
case "${{matrix.mpi}}" in | |
MPICH) mpiexec_options='';; | |
OpenMPI) mpiexec_options='--oversubscribe';; | |
esac | |
export MPITRAMPOLINE_VERBOSE=1 | |
export MPITRAMPOLINE_MPIEXEC=$HOME/mpiwrapper-${{matrix.mpi}}/bin/mpiwrapperexec | |
export MPITRAMPOLINE_LIB=$HOME/mpiwrapper-${{matrix.mpi}}/lib/libmpiwrapper.so | |
$HOME/mpitrampoline/bin/mpiexec ${mpiexec_options} -n 4 $HOME/mpitest/bin/mpi-test-mpif-f | |
- name: Test Fortran 90 mpif ${{matrix.mpi}} | |
run: | | |
case "${{matrix.mpi}}" in | |
MPICH) mpiexec_options='';; | |
OpenMPI) mpiexec_options='--oversubscribe';; | |
esac | |
export MPITRAMPOLINE_VERBOSE=1 | |
export MPITRAMPOLINE_MPIEXEC=$HOME/mpiwrapper-${{matrix.mpi}}/bin/mpiwrapperexec | |
export MPITRAMPOLINE_LIB=$HOME/mpiwrapper-${{matrix.mpi}}/lib/libmpiwrapper.so | |
$HOME/mpitrampoline/bin/mpiexec ${mpiexec_options} -n 4 $HOME/mpitest/bin/mpi-test-mpif-f90 | |
- name: Test Fortran 90 mpi ${{matrix.mpi}} | |
run: | | |
case "${{matrix.mpi}}" in | |
MPICH) mpiexec_options='';; | |
OpenMPI) mpiexec_options='--oversubscribe';; | |
esac | |
export MPITRAMPOLINE_VERBOSE=1 | |
export MPITRAMPOLINE_MPIEXEC=$HOME/mpiwrapper-${{matrix.mpi}}/bin/mpiwrapperexec | |
export MPITRAMPOLINE_LIB=$HOME/mpiwrapper-${{matrix.mpi}}/lib/libmpiwrapper.so | |
$HOME/mpitrampoline/bin/mpiexec ${mpiexec_options} -n 4 $HOME/mpitest/bin/mpi-test-mpi-f90 | |
- name: Test Fortran 90 mpi_f08 ${{matrix.mpi}} | |
run: | | |
case "${{matrix.mpi}}" in | |
MPICH) mpiexec_options='';; | |
OpenMPI) mpiexec_options='--oversubscribe';; | |
esac | |
export MPITRAMPOLINE_VERBOSE=1 | |
export MPITRAMPOLINE_MPIEXEC=$HOME/mpiwrapper-${{matrix.mpi}}/bin/mpiwrapperexec | |
export MPITRAMPOLINE_LIB=$HOME/mpiwrapper-${{matrix.mpi}}/lib/libmpiwrapper.so | |
$HOME/mpitrampoline/bin/mpiexec ${mpiexec_options} -n 4 $HOME/mpitest/bin/mpi-test-mpi_f08-f90 |