diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..4e3431ab2 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,30 @@ +name: Docker Publisher + +on: + push: + branches: [ "master" ] + paths: + - toolchain/Dockerfile + + workflow_dispatch: + +jobs: + push_to_registry: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build & Publish thereto + uses: docker/build-push-action@v4 + with: + file: toolchain/Dockerfile + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/mfc:latest + diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..879b4c7c9 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,54 @@ +name: Documentation + +on: + push: + branches: + - master + + workflow_dispatch: + +jobs: + docs: + name: Build & Publish + runs-on: ubuntu-latest + + if: github.repository == 'MFlowCode/MFC' + concurrency: + group: docs-publish + cancel-in-progress: true + + steps: + - uses: actions/checkout@v3 + + # We build doxygen from source because of + # https://github.com/doxygen/doxygen/issues/9016 + - name: Build Doxygen + run: | + sudo apt install cmake ninja-build graphviz graphviz + git clone https://github.com/doxygen/doxygen.git ../doxygen + cmake -S ../doxygen -B ../doxygen/build -G Ninja + sudo ninja -C ../doxygen/build install + + - name: Build Documentation + run: | + pip3 install fypp + cmake -S . -B build -G Ninja --install-prefix=$(pwd)/build/install -D MFC_DOCUMENTATION=ON + ninja -C build install + + - name: Publish Documentation + run: | + set +e + git ls-remote "${{ secrets.DOC_PUSH_URL }}" -q + if [ "$?" -ne "0" ]; then exit 0; fi + set -e + git config --global user.name 'MFC Action' + git config --global user.email '<>' + git clone "${{ secrets.DOC_PUSH_URL }}" ../www + rm -rf ../www/* + mv build/install/docs/mfc/* ../www/ + git -C ../www add -A + git -C ../www commit -m "Docs @ ${GITHUB_SHA::7}" || true + git -C ../www push + +# DOC_PUSH_URL should be of the format: +# --> https://:@github.com// diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..a2f219485 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,19 @@ +name: Lint + +on: + push: + + pull_request: + + workflow_dispatch: + +jobs: + docs: + name: Lint Toolchain + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Lint the toolchain + run: ./mfc.sh lint diff --git a/.github/workflows/phoenix/submit.sh b/.github/workflows/phoenix/submit.sh new file mode 100644 index 000000000..d82d6aa5a --- /dev/null +++ b/.github/workflows/phoenix/submit.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +set -e + +usage() { + echo "Usage: $0 [script.sh] [cpu|gpu]" +} + +if [ ! -z "$1" ]; then + sbatch_script_contents=`cat $1` +else + usage + exit 1 +fi + +sbatch_cpu_opts="\ +#SBATCH -p cpu-small # partition +#SBATCH --ntasks-per-node=24 # Number of cores per node required +#SBATCH --mem-per-cpu=2G # Memory per core\ +" + +sbatch_gpu_opts="\ +#SBATCH -CV100-16GB +#SBATCH -G2\ +" + +if [ "$2" == "cpu" ]; then + sbatch_device_opts="$sbatch_cpu_opts" +elif [ "$2" == "gpu" ]; then + sbatch_device_opts="$sbatch_gpu_opts" +else + usage + exit 1 +fi + +job_slug="`basename "$1" | sed 's/\.sh$//' | sed 's/[^a-zA-Z0-9]/-/g'`-$2" + +sbatch <> $GITHUB_ENV + echo "CXX=g++-13" >> $GITHUB_ENV + echo "FC=gfortran-13" >> $GITHUB_ENV + brew install wget make python make cmake coreutils gcc@13 + + - name: (MacOS) Build OpenMPI + if: matrix.os == 'macos' && matrix.mpi == 'mpi' + run: | + echo "OMPI_FC=gfortran-13" >> $GITHUB_ENV + echo "OMPI_CXX=g++-13" >> $GITHUB_ENV + echo "OMPI_MPICC=gcc-13" >> $GITHUB_ENV + HOMEBREW_MAKE_JOBS=$(nproc) brew install --cc=gcc-13 --verbose --build-from-source open-mpi + + - name: Setup Ubuntu + if: matrix.os == 'ubuntu' && matrix.intel == false + run: | + sudo apt update -y + sudo apt install -y tar wget make cmake gcc g++ python3 python3-dev "openmpi-*" libopenmpi-dev + + - name: Setup Ubuntu (Intel) + if: matrix.os == 'ubuntu' && matrix.intel == true + run: | + sudo apt install tar wget make cmake python3 python3-dev + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB + rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB + sudo echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + sudo apt-get update + sudo apt-get install -y intel-oneapi-common-vars intel-oneapi-compiler-fortran-2022.1.0 intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2022.1.0 intel-oneapi-mkl-2021.4.0 intel-oneapi-mpi-2021.7.1 intel-oneapi-mpi-devel-2021.7.1 + source /opt/intel/oneapi/setvars.sh + echo "CXX=$(which icpc)" >> $GITHUB_ENV + echo "CC=$(which icc)" >> $GITHUB_ENV + echo "FC=$(which ifort)" >> $GITHUB_ENV + echo "OMPI_FC=$(which ifort)" >> $GITHUB_ENV + echo "OMPI_CXX=$(which icpc)" >> $GITHUB_ENV + echo "OMPI_MPICC=$(which icc)" >> $GITHUB_ENV + echo "MPI_HOME=/opt/intel/oneapi/mpi/2021.7.1/" >> $GITHUB_ENV + echo "I_MPI_ROOT=/opt/intel/oneapi/mpi/2021.7.1/" >> $GITHUB_ENV + + - name: Build + run: | + if [ '${{ matrix.intel }}' == 'true' ]; then source /opt/intel/oneapi/setvars.sh; fi + /bin/bash mfc.sh build -j $(nproc) --${{ matrix.debug }} --${{ matrix.mpi }} + + - name: Test + run: | + if [ '${{ matrix.intel }}' == 'true' ]; then source /opt/intel/oneapi/setvars.sh; fi + /bin/bash mfc.sh test -j $(nproc) $OPT1 $OPT2 + env: + OPT1: ${{ matrix.mpi == 'mpi' && '--test-all' || '' }} + OPT2: ${{ matrix.debug == 'debug' && '-% 20' || '' }} + + docker: + name: Github | Docker + runs-on: ubuntu-latest + steps: + - name: Clone + uses: actions/checkout@v3 + + - name: Test + run: sudo ./mfc.sh docker ./mfc.sh test -j $(nproc) -a + + self: + name: Georgia Tech | Phoenix (NVHPC) + if: github.repository == 'MFlowCode/MFC' + continue-on-error: true + strategy: + matrix: + device: ['cpu', 'gpu'] + runs-on: + group: phoenix + labels: self-hosted + steps: + - name: Clone + uses: actions/checkout@v3 + + - name: Build & Test + run: bash .github/workflows/phoenix/submit.sh .github/workflows/phoenix/test.sh ${{ matrix.device }} + + - name: Archive Logs + uses: actions/upload-artifact@v3 + if: always() + with: + name: logs + path: test-${{ matrix.device }}.out +