From 3701b83f7182f07fa1d97709f85bdf348a8d765d Mon Sep 17 00:00:00 2001 From: Dingcheng Luo <44854707+dc-luo@users.noreply.github.com> Date: Fri, 26 Jul 2024 10:36:22 -0700 Subject: [PATCH] Updating CI (#25) * trying different ci image * using python instead of python3 * updated run scripts for using new image * adding conda --- .github/workflows/ci.yml | 19 +++++++++++++------ .github/workflows/run_examples.sh | 18 ++++++++++++++++-- .github/workflows/run_tests.sh | 23 +++++++++++++++++------ 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78660b7..05e40af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,12 @@ name: CI + on: push: branches: - main pull_request: + workflow_dispatch: defaults: run: @@ -14,18 +16,23 @@ jobs: style: runs-on: ubuntu-20.04 container: - image: quay.io/fenicsproject/stable:2019.1.0.r3 - options: --user 1001 --privileged - name: SOUPy Unit Tests + image: dcluo28/dibasis:latest + name: Repo Test steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Checkout hippylib run: git clone https://github.com/hippylib/hippylib.git - - name: See directory - run: pwd && ls + - name: Check directory + run: ls + - name: Check user + run: whoami - name: Run unit tests run: source .github/workflows/run_tests.sh - name: Run examples run: source .github/workflows/run_examples.sh + # - name: Activate conda + # run: conda init && source ~/.bashrc && conda activate dibasis + # - name: Check conda + # run: conda info diff --git a/.github/workflows/run_examples.sh b/.github/workflows/run_examples.sh index 0781a27..2842d2a 100644 --- a/.github/workflows/run_examples.sh +++ b/.github/workflows/run_examples.sh @@ -1,11 +1,25 @@ #!/bin/bash +set -ev + +CONDA_ENV=dibasis +PYTHON=python export HIPPYLIB_PATH=$(pwd)/hippylib +export HIPPYFLOW_PATH=$(pwd)/hippyflow + +# This is for running MPI on root in the docker container +export OMPI_MCA_btl_vader_single_copy_mechanism=none +export OMPI_ALLOW_RUN_AS_ROOT=1 +export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 # Run poisson example cd examples/poisson -python3 driver_poisson_mean.py +conda init +source ~/.bashrc +conda activate $CONDA_ENV + +$PYTHON driver_poisson_mean.py -mpirun -n 2 python3 driver_poisson_mean.py +mpirun -n 2 --oversubscribe python driver_poisson_mean.py diff --git a/.github/workflows/run_tests.sh b/.github/workflows/run_tests.sh index e3061a3..1e86113 100644 --- a/.github/workflows/run_tests.sh +++ b/.github/workflows/run_tests.sh @@ -1,16 +1,27 @@ #!/bin/bash set -ev -PYTHON=python3 - +CONDA_ENV=dibasis +PYTHON=python export HIPPYLIB_PATH=$(pwd)/hippylib +# This is for running MPI on root in the docker container +export OMPI_MCA_btl_vader_single_copy_mechanism=none +export OMPI_ALLOW_RUN_AS_ROOT=1 +export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 + # Run the code cd soupy/test + +conda init +source ~/.bashrc +conda activate $CONDA_ENV + $PYTHON -m unittest discover -v $PYTHON -m unittest discover -v -p 'ptest_*' -mpirun -n 4 $PYTHON ptest_meanVarRiskMeasureSAA.py -mpirun -n 4 $PYTHON ptest_scipyCostWrapper.py -mpirun -n 4 $PYTHON ptest_superquantileSAA.py -mpirun -n 4 $PYTHON ptest_transformedMeanRiskMeasureSAA.py +mpirun -n 2 --oversubscribe $PYTHON ptest_meanVarRiskMeasureSAA.py +mpirun -n 2 --oversubscribe $PYTHON ptest_scipyCostWrapper.py +mpirun -n 2 --oversubscribe $PYTHON ptest_superquantileSAA.py +mpirun -n 2 --oversubscribe $PYTHON ptest_transformedMeanRiskMeasureSAA.py +