Fix for MPI so that all phases show up in the phase timeseries plot. #1133
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
# Run Tests | |
# Matrix Options | |
# DOCS: 2-Build and publish, 1-build only, 0-no docs | |
name: Dymos Tests | |
on: | |
# Trigger on push, pull request | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master, develop ] | |
# Trigger via workflow_dispatch event | |
workflow_dispatch: | |
jobs: | |
test_ubuntu: | |
runs-on: ubuntu-latest | |
timeout-minutes: 90 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# baseline versions | |
- NAME: baseline | |
PY: '3.10' | |
NUMPY: 1.22 | |
SCIPY: 1.7 | |
PETSc: 3.17 | |
PYOPTSPARSE: 'v2.9.3' | |
SNOPT: 7.7 | |
OPENMDAO: 'latest' | |
OPTIONAL: '[all]' | |
JAX: '0.3.24' | |
# baseline versions except no pyoptsparse or SNOPT | |
- NAME: no_pyoptsparse | |
PY: '3.10' | |
NUMPY: 1.22 | |
SCIPY: 1.7 | |
PETSc: 3.17 | |
OPENMDAO: 'latest' | |
OPTIONAL: '[test]' | |
# baseline versions except with pyoptsparse but no SNOPT | |
- NAME: no_snopt | |
PY: '3.10' | |
NUMPY: 1.22 | |
SCIPY: 1.7 | |
PETSc: 3.17 | |
PYOPTSPARSE: 'v2.9.3' | |
OPENMDAO: 'latest' | |
OPTIONAL: '[test]' | |
# try latest versions | |
- NAME: latest | |
PY: 3 | |
NUMPY: 1 | |
SCIPY: 1 | |
PETSc: 3 | |
PYOPTSPARSE: 'latest' | |
SNOPT: 7.7 | |
OPENMDAO: 'dev' | |
OPTIONAL: '[test]' | |
JAX: '0.3.24' | |
# oldest supported versions | |
- NAME: oldest | |
PY: 3.8 | |
NUMPY: 1.22 | |
SCIPY: 1.7 | |
OPENMPI: '4.0' | |
MPI4PY: '3.0' | |
PETSc: 3.13 | |
PYOPTSPARSE: 'v2.6.1' | |
SNOPT: 7.2 | |
OPENMDAO: 3.26.0 | |
OPTIONAL: '[test]' | |
steps: | |
- name: Display run details | |
run: | | |
echo "=============================================================" | |
echo "Run #${GITHUB_RUN_NUMBER}" | |
echo "Run ID: ${GITHUB_RUN_ID}" | |
echo "Testing: ${GITHUB_REPOSITORY}" | |
echo "Triggered by: ${GITHUB_EVENT_NAME}" | |
echo "Initiated by: ${GITHUB_ACTOR}" | |
echo "=============================================================" | |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
if [[ "${{ matrix.NAME }}" == "latest" ]]; then | |
echo "Triggered by 'workflow_dispatch' event, will run '${{ matrix.NAME }}' build." | |
echo "RUN_BUILD=true" >> $GITHUB_ENV | |
else | |
echo "Triggered by 'workflow_dispatch' event, will not run '${{ matrix.NAME }}' build." | |
fi | |
else | |
echo "Triggered by '${{ github.event_name }}' event, running all builds." | |
echo "RUN_BUILD=true" >> $GITHUB_ENV | |
fi | |
- name: Create SSH key | |
if: env.RUN_BUILD | |
shell: bash | |
env: | |
SSH_PRIVATE_KEY: ${{secrets.SSH_PRIVATE_KEY}} | |
SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}} | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa | |
sudo chmod 600 ~/.ssh/id_rsa | |
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts | |
- name: Checkout code | |
if: env.RUN_BUILD | |
uses: actions/checkout@v3 | |
- name: Fetch tags | |
if: env.RUN_BUILD | |
run: | | |
git fetch --prune --unshallow --tags | |
- name: Setup conda | |
if: env.RUN_BUILD | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.PY }} | |
conda-version: "*" | |
channels: conda-forge,defaults | |
channel-priority: true | |
- name: Install Numpy/Scipy | |
if: env.RUN_BUILD | |
shell: bash -l {0} | |
run: | | |
echo "=============================================================" | |
echo "Install Numpy/Scipy" | |
echo "=============================================================" | |
conda install numpy=${{ matrix.NUMPY }} scipy=${{ matrix.SCIPY }} -q -y | |
- name: Install jax | |
if: env.RUN_BUILD && matrix.JAX | |
shell: bash -l {0} | |
run: | | |
echo "=============================================================" | |
echo "Install jax" | |
echo "=============================================================" | |
python -m pip install jaxlib==${{ matrix.JAX }} jax==${{ matrix.JAX }} | |
- name: Install PETSc | |
if: env.RUN_BUILD && matrix.PETSc | |
shell: bash -l {0} | |
run: | | |
echo "=============================================================" | |
echo "Install PETSc" | |
echo "=============================================================" | |
if [[ "${{ matrix.OPENMPI }}" && "${{ matrix.MPI4PY }}" ]]; then | |
conda install openmpi=${{ matrix.OPENMPI }} mpi4py=${{ matrix.MPI4PY }} petsc4py=${{ matrix.PETSc }} -q -y | |
elif [[ "${{ matrix.MPI4PY }}" ]]; then | |
conda install mpi4py=${{ matrix.MPI4PY }} petsc4py=${{ matrix.PETSc }} -q -y | |
else | |
conda install mpi4py petsc4py=${{ matrix.PETSc }} -q -y | |
fi | |
export OMPI_MCA_rmaps_base_oversubscribe=1 | |
echo "OMPI_MCA_rmaps_base_oversubscribe=1" >> $GITHUB_ENV | |
echo "-----------------------" | |
echo "Quick test of mpi4py:" | |
mpirun -n 2 python -c "from mpi4py import MPI; print(f'Rank: {MPI.COMM_WORLD.rank}')" | |
echo "-----------------------" | |
echo "Quick test of petsc4py:" | |
mpirun -n 2 python -c "import numpy; from mpi4py import MPI; comm = MPI.COMM_WORLD; import petsc4py; petsc4py.init(); x = petsc4py.PETSc.Vec().createWithArray(numpy.ones(5)*comm.rank, comm=comm); print(x.getArray())" | |
echo "-----------------------" | |
- name: Install pyOptSparse | |
id: build_pyoptsparse | |
if: env.RUN_BUILD && matrix.PYOPTSPARSE | |
shell: bash -l {0} | |
run: | | |
echo "=============================================================" | |
echo "Install pyoptsparse" | |
echo "=============================================================" | |
if [[ "${{ matrix.PYOPTSPARSE }}" == "conda-forge" ]]; then | |
if [[ "${{ matrix.SNOPT }}" ]]; then | |
echo "SNOPT ${{ matrix.SNOPT }} was requested but is not available on conda-forge" | |
fi | |
conda install -c conda-forge pyoptsparse | |
else | |
pip install git+https://github.com/OpenMDAO/build_pyoptsparse | |
if [[ "${{ matrix.PYOPTSPARSE }}" == "latest" ]]; then | |
LATEST_URL=`curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/mdolab/pyoptsparse/releases/latest` | |
LATEST_VER=`echo $LATEST_URL | awk '{split($0,a,"/tag/"); print a[2]}'` | |
BRANCH="-b $LATEST_VER" | |
else | |
BRANCH="-b ${{ matrix.PYOPTSPARSE }}" | |
fi | |
if [[ "${{ matrix.PAROPT }}" ]]; then | |
PAROPT="-a" | |
fi | |
if [[ "${{ matrix.SNOPT }}" == "7.7" && "${{ secrets.SNOPT_LOCATION_77 }}" ]]; then | |
echo " > Secure copying SNOPT 7.7 over SSH" | |
mkdir SNOPT | |
scp -qr ${{ secrets.SNOPT_LOCATION_77 }} SNOPT | |
SNOPT="-s SNOPT/src" | |
elif [[ "${{ matrix.SNOPT }}" == "7.2" && "${{ secrets.SNOPT_LOCATION_72 }}" ]]; then | |
echo " > Secure copying SNOPT 7.2 over SSH" | |
mkdir SNOPT | |
scp -qr ${{ secrets.SNOPT_LOCATION_72 }} SNOPT | |
SNOPT="-s SNOPT/source" | |
elif [[ "${{ matrix.SNOPT }}" ]]; then | |
echo "SNOPT version ${{ matrix.SNOPT }} was requested but source is not available" | |
fi | |
build_pyoptsparse $BRANCH $PAROPT $SNOPT | |
fi | |
- name: Install OpenMDAO | |
if: env.RUN_BUILD && matrix.OPENMDAO | |
shell: bash -l {0} | |
run: | | |
echo "=============================================================" | |
echo "Install OpenMDAO" | |
echo "=============================================================" | |
if [[ "${{ matrix.OPENMDAO }}" == "dev" ]]; then | |
pip install git+https://github.com/OpenMDAO/OpenMDAO | |
elif [[ "${{ matrix.OPENMDAO }}" == "latest" ]]; then | |
pip install openmdao | |
else | |
pip install openmdao==${{ matrix.OPENMDAO }} | |
fi | |
- name: Install Dymos | |
if: env.RUN_BUILD | |
shell: bash -l {0} | |
run: | | |
echo "=============================================================" | |
echo "Install Dymos" | |
echo "=============================================================" | |
pip install .${{ matrix.OPTIONAL }} | |
- name: Display environment info | |
if: env.RUN_BUILD | |
shell: bash -l {0} | |
run: | | |
conda info | |
conda list | |
conda env export --name test --file ${{ matrix.NAME }}_environment.yml | |
echo "=============================================================" | |
echo "Check installed versions of Python, Numpy and Scipy" | |
echo "=============================================================" | |
python -c "import sys; assert str(sys.version).startswith(str(${{ matrix.PY }})), \ | |
f'Python version {sys.version} is not the requested version (${{ matrix.PY }})'" | |
python -c "import numpy; assert str(numpy.__version__).startswith(str(${{ matrix.NUMPY }})), \ | |
f'Numpy version {numpy.__version__} is not the requested version (${{ matrix.NUMPY }})'" | |
python -c "import scipy; assert str(scipy.__version__).startswith(str(${{ matrix.SCIPY }})), \ | |
f'Scipy version {scipy.__version__} is not the requested version (${{ matrix.SCIPY }})'" | |
- name: 'Upload environment artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.NAME }}_environment | |
path: ${{ matrix.NAME }}_environment.yml | |
retention-days: 5 | |
- name: Run tests | |
if: env.RUN_BUILD | |
env: | |
DYMOS_CHECK_PARTIALS: True | |
shell: bash -l {0} | |
run: | | |
echo "=============================================================" | |
echo "Run Tests" | |
echo "Environment:" | |
echo " DYMOS_CHECK_PARTIALS: $DYMOS_CHECK_PARTIALS" | |
echo "=============================================================" | |
testflo -n 1 docs/dymos_book/test --pre_announce | |
testflo -n 1 joss/test --pre_announce | |
testflo -b benchmark --pre_announce | |
cd $HOME | |
testflo dymos -n 2 --show_skipped --coverage --durations 20 --coverpkg dymos | |
- name: Submit coverage | |
if: (github.event_name != 'workflow_dispatch') | |
shell: bash -l {0} | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_SERVICE_NAME: "github" | |
COVERALLS_PARALLEL: True | |
run: | | |
echo "=============================================================" | |
echo "Submit coverage" | |
echo "=============================================================" | |
cp $HOME/.coverage . | |
pip install coveralls | |
SITE_DIR=`python -c 'import site; print(site.getsitepackages()[-1])'` | |
coveralls --basedir $SITE_DIR | |
coveralls: | |
name: Finish coveralls | |
if: (github.event_name != 'workflow_dispatch') | |
needs: test_ubuntu | |
runs-on: ubuntu-latest | |
steps: | |
- uses: coverallsapp/github-action@master | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
parallel-finished: true |