Merge pull request #327 from carterbox/costs-reduce #335
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
name: Run unit tests | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- "tests/**" | |
- "src/tike/**" | |
- pyproject.toml | |
- .github/workflows/unit-tests.yml | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "tests/**" | |
- "src/tike/**" | |
- pyproject.toml | |
- .github/workflows/unit-tests.yml | |
jobs: | |
linux-x86-no-mpi: | |
runs-on: self-hosted | |
continue-on-error: true | |
strategy: | |
matrix: | |
python-version: | |
- "3.10" | |
- "3.11" | |
- "3.9" | |
steps: | |
- uses: actions/checkout@v3 | |
- run: | | |
echo ${CUDA_VISIBLE_DEVICES} | |
echo "CUDA_VERSION=$(nvidia-smi -q | grep "CUDA Version" | sed 's/CUDA Version\s*: //' | sed 's/\.[0-9]*//')" >> "$GITHUB_ENV" | |
- run: | | |
conda config --remove channels defaults || true | |
conda config --add channels conda-forge | |
conda config --show channels | |
name: Configure Conda to only use conda-forge | |
- run: > | |
conda create --quiet --yes --force | |
-n tike | |
--channel conda-forge | |
--file requirements.txt | |
pytest | |
python=${{ matrix.python-version }} | |
cuda-version=$CUDA_VERSION | |
name: Create build environment | |
- run: conda remove -n tike mpi4py --yes --quiet || true | |
name: Remove MPI from test environment | |
- run: conda list -n tike | |
name: List build environment | |
- run: | | |
source activate tike | |
pip install . --no-deps --no-build-isolation | |
name: Setup and install | |
- run: | | |
source activate tike | |
python tests/print-gpu-info.py | |
name: Print GPU info | |
- run: | | |
source activate tike | |
export TIKE_TEST_CI | |
pytest -vs tests | |
name: Run tests | |
- run: | | |
cd tests/result | |
zip -r9 ../../result.zip . | |
name: Zip results | |
- uses: actions/upload-artifact@v3 | |
if: ${{ matrix.python-version == '3.9' }} | |
with: | |
path: result.zip | |
name: Without MPI results | |
- run: conda remove -n tike --all | |
name: Clean up environment | |
linux-x86-with-mpi: | |
runs-on: self-hosted | |
continue-on-error: true | |
strategy: | |
matrix: | |
python-version: | |
- "3.8" | |
steps: | |
- uses: actions/checkout@v3 | |
- run: | | |
echo ${CUDA_VISIBLE_DEVICES} | |
echo "CUDA_VERSION=$(nvidia-smi -q | grep "CUDA Version" | sed 's/CUDA Version\s*: //' | sed 's/\.[0-9]*//')" >> "$GITHUB_ENV" | |
- run: | | |
conda config --remove channels defaults || true | |
conda config --add channels conda-forge | |
conda config --show channels | |
name: Configure Conda to only use conda-forge | |
- run: > | |
conda create --quiet --yes --force | |
-n tike | |
--channel conda-forge | |
--file requirements.txt | |
pytest | |
python=${{ matrix.python-version }} | |
'openmpi=*=h*' | |
mpi4py | |
cuda-version=$CUDA_VERSION | |
name: Create build environment | |
- run: conda list -n tike | |
name: List build environment | |
- run: | | |
source activate tike | |
pip install . --no-deps --no-build-isolation | |
name: Setup and install | |
- run: | | |
source activate tike | |
python tests/print-gpu-info.py | |
name: Print GPU info | |
- run: | | |
source activate tike | |
export OMPI_MCA_opal_cuda_support=true | |
export TIKE_TEST_CI | |
mpiexec -n 2 python -m pytest -vs tests | |
name: Run tests with MPI | |
- run: | | |
cd tests/result | |
zip -r9 ../../result.zip . | |
name: Zip results | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: result.zip | |
name: MPI results | |
- run: conda remove -n tike --all | |
name: Clean up environment |