diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..c98521f --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,46 @@ +name: ci + +on: + #push: + # branches: + # - main + pull_request: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + +permissions: + contents: read + +jobs: + runs-on: ${{ matrix.os }} + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-22.04 + - macos-13 + + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup MPICH + uses: mpi4py/setup-mpi@v1 + with: + mpi: mpich + + - name: Setup Open MPI + uses: mpi4py/setup-mpi@v1 + with: + mpi: openmpi + + - name: Build + run: make + + - name: Test + if: false + run: make check diff --git a/test.sh b/test.sh index 71ed03d..9d2d88c 100755 --- a/test.sh +++ b/test.sh @@ -2,40 +2,71 @@ set -x -if [ `uname -s` == Darwin ] ; then - OMPIRUN=/opt/homebrew/Cellar/open-mpi/4.1.5/bin/mpirun - OMPILIB=/opt/homebrew/Cellar/open-mpi/4.1.5/lib/libmpi.dylib - MPICHRUN=/opt/homebrew/Cellar/mpich/4.1.1/bin/mpirun - MPICHLIB=/opt/homebrew/Cellar/mpich/4.1.1/lib/libmpi.dylib +if [ $(uname -s) == Darwin ]; then + OMPIRUN=/opt/homebrew/Cellar/open-mpi/*/bin/mpirun + OMPILIB=/opt/homebrew/Cellar/open-mpi/*/lib/libmpi.dylib + MPICHRUN=/opt/homebrew/Cellar/mpich/*/bin/mpirun + MPICHLIB=/opt/homebrew/Cellar/mpich/*/lib/libmpi.dylib IMPIRUN=true IMPILIB= DBG=lldb DBGARGS="--one-line 'run' --one-line-on-crash 'bt' --one-line 'quit' --" else + OSID=$(grep '^ID=' /etc/os-release | cut -d= -f2) export HWLOC_COMPONENTS=-gl + if [ "$OSID" == "ubuntu" ]; then + OMPIRUN="/usr/bin/mpirun.openmpi --tag-output" + OMPILIB=/usr/lib/x86_64-linux-gnu/libmpi.so + MPICHRUN="/usr/bin/mpirun.mpich -l" + MPICHLIB=/usr/lib/x86_64-linux-gnu/libmpich.so + fi + if [ "$OSID" == "fedora" ]; then + OMPIRUN="/usr/lib64/openmpi/bin/mpirun --tag-output" + OMPILIB=/usr/lib64/openmpi/lib/libmpi.so + MPICHRUN="/usr/lib64/mpich/bin/mpirun -l" + MPICHLIB=/usr/lib64/mpich/lib/libmpi.so + fi + if [ -e /opt/intel/oneapi/mpi/latest ]; then + IMPIRUN="/opt/intel/oneapi/mpi/latest/bin/mpirun -l" + IMPILIB=/opt/intel/oneapi/mpi/2021.8.0/liblibmpi.so + fi #OPTS="--mca osc ucx" - OMPIRUN="/usr/bin/mpirun.openmpi --tag-output" - OMPILIB=/usr/lib/x86_64-linux-gnu/libmpi.so + #OMPIRUN="/usr/bin/mpirun.openmpi --tag-output" + #OMPILIB=/usr/lib/x86_64-linux-gnu/libmpi.so #OMPIRUN=/opt/ompi/gcc-debug/bin/mpirun #OMPILIB=/opt/ompi/gcc-debug/lib/libmpi.so - MPICHRUN="/usr/bin/mpirun.mpich -l" - MPICHLIB=/usr/lib/x86_64-linux-gnu/libmpich.so + #MPICHRUN="/usr/bin/mpirun.mpich -l" + #MPICHLIB=/usr/lib/x86_64-linux-gnu/libmpich.so #MPICHRUN="/opt/mpich/gcc/debug-ch4ucx/bin/mpirun -l" #MPICHLIB=/opt/mpich/gcc/debug-ch4ucx/lib/libmpi.so - IMPIRUN="/opt/intel/oneapi/mpi/2021.8.0/bin/mpirun -l" - IMPILIB=/opt/intel/oneapi/mpi/2021.8.0/lib/debug/libmpi.so + #IMPIRUN="/opt/intel/oneapi/mpi/2021.8.0/bin/mpirun -l" + #IMPILIB=/opt/intel/oneapi/mpi/2021.8.0/lib/debug/libmpi.so #IMPILIB=/opt/intel/oneapi/mpi/2021.8.0/lib/release/libmpi.so DBG=gdb DBGARGS='-ex "set width 1000" -ex "thread apply all bt" -ex run -ex bt -ex "set confirm off" -ex quit --args' fi +if [ "$GITHUB_ACTIONS" == "true" ]; then + DBG=false + DBGARGS= +fi + NP=2 #OPTS="${OPTS} -quiet" -make -j $1 && \ -MPI_LIB=${OMPILIB} ${OMPIRUN} ${OPTS} -n ${NP} $1 || \ -MPI_LIB=${OMPILIB} ${OMPIRUN} ${OPTS} -n ${NP} ${DBG} ${DBGARGS} $1 ; \ -MPI_LIB=${MPICHLIB} ${MPICHRUN} -n ${NP} $1 || \ -MPI_LIB=${MPICHLIB} ${MPICHRUN} -n ${NP} ${DBG} ${DBGARGS} $1 -MPI_LIB=${IMPILIB} ${IMPIRUN} -n ${NP} $1 || \ -MPI_LIB=${IMPILIB} ${IMPIRUN} -n ${NP} ${DBG} ${DBGARGS} $1 +make -j $1 + +if [ -n "${OMPILIB}" ]; then + MPI_LIB=${OMPILIB} ${OMPIRUN} ${OPTS} -n ${NP} $1 || \ + MPI_LIB=${OMPILIB} ${OMPIRUN} ${OPTS} -n ${NP} ${DBG} ${DBGARGS} $1 ; \ +fi + +if [ -n "${MPICHLIB}" ]; then + MPI_LIB=${MPICHLIB} ${MPICHRUN} -n ${NP} $1 || \ + MPI_LIB=${MPICHLIB} ${MPICHRUN} -n ${NP} ${DBG} ${DBGARGS} $1 +fi + +if [ -n "${IMPILIB}" ]; then + MPI_LIB=${IMPILIB} ${IMPIRUN} -n ${NP} $1 || \ + MPI_LIB=${IMPILIB} ${IMPIRUN} -n ${NP} ${DBG} ${DBGARGS} $1 +fi