Skip to content

Commit

Permalink
Setup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dalcinl committed Jan 22, 2024
1 parent d4a7a72 commit 29193ff
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 18 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest

steps:

- 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
68 changes: 50 additions & 18 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,72 @@

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
brew_prefix=$(brew --prefix)
OMPIRUN=$(ls $brew_prefix/Cellar/open-mpi/*/bin/mpirun)
OMPILIB=$(ls $brew_prefix/Cellar/open-mpi/*/lib/libmpi.dylib)
MPICHRUN=$(ls $brew_prefix/Cellar/mpich/*/bin/mpirun)
MPICHLIB=$(ls $brew_prefix/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/latest/lib/libmpi.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

0 comments on commit 29193ff

Please sign in to comment.