|
| 1 | +name: tests |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 2 * * 3" # at 02:00 UTC Wednesday |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +concurrency: |
| 12 | + # automatically cancel the previously triggered workflows when there's a newer version |
| 13 | + group: cicd-tests-gpu-${{ github.event.pull_request.number || github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +# Supported versions of Python and PyTorch are listed here for use below and as documentation |
| 17 | +env: |
| 18 | + # supported versions of Python, copied from ci_tests.yml and should be synced where appropriate with that file |
| 19 | + PYTHON_VER1: '3.11' |
| 20 | + PYTORCH_VER1: '2.12.1' |
| 21 | + PYTORCH_VER3: '2.14.1' # for hyena tests, should be updated when possible |
| 22 | + TORCHVISION_VER1: '0.27.1' # used for testing with lowest PyTorch version (PYTORCH_VER1), update as needed |
| 23 | + |
| 24 | + TQDM_DISABLE: 1 # squelch TQDM output to reduce log file size |
| 25 | + |
| 26 | + PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python # https://github.com/Project-MONAI/MONAI/issues/4354 |
| 27 | + |
| 28 | + BUILD_MONAI: 1 # always build MONAI and ensure it tries to use the compiled extensions |
| 29 | + FORCE_CUDA: 1 # ensure CUDA code is built |
| 30 | + |
| 31 | +jobs: |
| 32 | + |
| 33 | + full-dep-gpu: |
| 34 | + runs-on: [self-hosted, linux, gpu] |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + timeout-minutes: 360 |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v7 |
| 40 | + - name: Set up Python ${{ env.PYTHON_VER1 }} |
| 41 | + uses: actions/setup-python@v6 |
| 42 | + with: |
| 43 | + python-version: ${{ env.PYTHON_VER1 }} |
| 44 | + cache: 'pip' |
| 45 | + - name: Install the complete dependencies |
| 46 | + run: | |
| 47 | + python -m pip install --upgrade pip wheel wheel_stub |
| 48 | + python -m pip install torch==${PYTORCH_VER1} torchvision==${TORCHVISION_VER1} |
| 49 | + python -m pip install --pre -U itk # TODO: needed? |
| 50 | + python monai/config/print_dependencies.py build-system | xargs pip install --no-build-isolation |
| 51 | + # tests below use the MONAI in the current directory, -e ensures the compiled code stays there and is found |
| 52 | + python -m pip install --no-build-isolation torch==${PYTORCH_VER1} torchvision==${TORCHVISION_VER1} -e .[all,testing,nvimgcodec] |
| 53 | + shell: bash |
| 54 | + - name: Run (almost) all tests |
| 55 | + run: | |
| 56 | + python -c 'import monai._C; cap=monai._C.max_compute_capability(); assert cap > 0, f"Capabilities too low: {cap}"' |
| 57 | + nvidia-smi || true |
| 58 | + python monai/config/check_env.py --env --monai |
| 59 | + ./runtests.sh -u --net |
| 60 | + # env: # FIXME: NGC test failing with "RuntimeError: NGC API response is not ok. Failed to get token." Need to fix key? |
| 61 | + # NGC_API_KEY: ${{ secrets.NGC_API_KEY }} |
| 62 | + # NGC_ORG: ${{ secrets.NGC_ORG }} |
| 63 | + # NGC_TEAM: ${{ secrets.NGC_TEAM }} |
| 64 | + |
| 65 | + full-dep-gpu-hyena: |
| 66 | + runs-on: [self-hosted, linux, gpu] |
| 67 | + strategy: |
| 68 | + fail-fast: false |
| 69 | + timeout-minutes: 30 |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v7 |
| 72 | + - name: Set up Python ${{ env.PYTHON_VER1 }} |
| 73 | + uses: actions/setup-python@v6 |
| 74 | + with: |
| 75 | + python-version: ${{ env.PYTHON_VER1 }} |
| 76 | + cache: 'pip' |
| 77 | + - name: Install the complete dependencies |
| 78 | + run: | |
| 79 | + python -m pip install --upgrade pip wheel wheel_stub |
| 80 | + python -m pip install torch==${PYTORCH_VER3} torchvision |
| 81 | + python monai/config/print_dependencies.py build-system | xargs pip install --no-build-isolation |
| 82 | + # tests below use the MONAI in the current directory, -e ensures the compiled code stays there and is found |
| 83 | + python -m pip install --no-build-isolation -e .[testing,hyena] |
| 84 | + shell: bash |
| 85 | + - name: Run Hyena tests |
| 86 | + run: | |
| 87 | + python -c "import torch; from monai.networks.blocks.hyena import is_nvsubquadratic_available; \ |
| 88 | + assert torch.cuda.is_available(), 'No CUDA devices found.'; \ |
| 89 | + assert is_nvsubquadratic_available(), 'nvsubquadratic must be importable.'" |
| 90 | + python -m unittest tests.networks.blocks.test_hyena_block tests.networks.nets.test_hyena_nd_unetr tests.networks.nets.test_swin_unetr |
0 commit comments