-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run GPU Tests on Rapids Nightly at midnight UTC (#463)
- Loading branch information
1 parent
d1f3842
commit 6c739e9
Showing
2 changed files
with
34 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
name: "GPU CI/CD" | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' # scheduled trigger for nightly builds, runs at midnight UTC every day | ||
push: | ||
branches: | ||
- main | ||
|
@@ -21,34 +23,41 @@ concurrency: | |
jobs: | ||
# First, we build and push a NeMo-Curator container | ||
build-container: | ||
# "build-container" job is run if the "gpuci" label is added to the PR | ||
if: ${{ github.event.label.name == 'gpuci' || github.ref == 'refs/heads/main' }} | ||
# "build-container" job is run if the "gpuci" label is added to the PR / merge to main / scheduled run | ||
if: ${{ github.event.label.name == 'gpuci' || github.ref == 'refs/heads/main' || github.event_name == 'schedule' }} | ||
uses: NVIDIA/NeMo-FW-CI-templates/.github/workflows/[email protected] | ||
with: | ||
image-name: nemo_curator_container | ||
dockerfile: Dockerfile | ||
image-label: nemo-curator | ||
# Use different image-label / build-args based on event type | ||
# Given we only use "schedule" event for nightly builds, we use that in our conditions to distinguish nightly vs stable | ||
image-label: ${{ github.event_name == 'schedule' && 'nemo-curator-nightly' || 'nemo-curator' }} | ||
build-args: | | ||
IMAGE_LABEL=nemo-curator | ||
IMAGE_LABEL=${{ github.event_name == 'schedule' && 'nemo-curator-nightly' || 'nemo-curator' }} | ||
REPO_URL=https://github.com/${{ github.repository }}.git | ||
CURATOR_COMMIT=${{ github.sha }} | ||
BUILD_TYPE=${{ github.event_name == 'schedule' && 'nightly' || 'stable' }} | ||
prune-filter-timerange: 24h | ||
# We don't want to use cache for Nighlty Runs, as we want to build a fresh image each time | ||
use_cache: ${{ github.event_name != 'schedule' }} | ||
|
||
# Then, we run our PyTests in the container we just built | ||
run-gpu-tests: | ||
needs: build-container | ||
# This is the tag on our Azure runner found in Actions -> Runners -> Self-hosted runners | ||
# It has 2 A100 GPUs | ||
runs-on: self-hosted-azure | ||
# "run-gpu-tests" job is run if the "gpuci" label is added to the PR | ||
if: ${{ github.event.label.name == 'gpuci' || github.ref == 'refs/heads/main' }} | ||
# "run-gpu-tests" job is run if the "gpuci" label is added to the PR / merged to main / scheduled run | ||
if: ${{ github.event.label.name == 'gpuci' || github.ref == 'refs/heads/main' || github.event_name == 'schedule' }} | ||
env: | ||
CONTAINER_NAME: ${{ github.event_name == 'schedule' && 'nemo-curator-nightly-container' || 'nemo-curator-container' }} | ||
|
||
steps: | ||
# If something went wrong during the last cleanup, this step ensures any existing container is removed | ||
- name: Remove existing container if it exists | ||
run: | | ||
if [ "$(docker ps -aq -f name=nemo-curator-container)" ]; then | ||
docker rm -f nemo-curator-container | ||
if [ "$(docker ps -aq -f name=$CONTAINER_NAME)" ]; then | ||
docker rm -f $CONTAINER_NAME | ||
fi | ||
# This runs the container which was pushed by build-container, which we call "nemo-curator-container" | ||
|
@@ -57,33 +66,33 @@ jobs: | |
# `bash -c "sleep infinity"` keeps the container running indefinitely without exiting | ||
- name: Run Docker container | ||
run: | | ||
docker run --gpus all --name nemo-curator-container -d nemoci.azurecr.io/nemo_curator_container:${{ github.run_id }} bash -c "sleep infinity" | ||
docker run --gpus all --name $CONTAINER_NAME -d nemoci.azurecr.io/nemo_curator_container:${{ github.run_id }} bash -c "sleep infinity" | ||
# Expect `whoami` to be "azureuser" | ||
# Expect `nvidia-smi` to show our 2 A100 GPUs | ||
- name: Check GPUs | ||
run: | | ||
whoami | ||
docker exec nemo-curator-container nvidia-smi | ||
docker exec $CONTAINER_NAME nvidia-smi | ||
# In the virtual environment (called "curator") we created in the container, | ||
# list all of our packages. Useful for debugging | ||
- name: Verify installations | ||
run: | | ||
docker exec nemo-curator-container pip list | ||
docker exec $CONTAINER_NAME pip list | ||
# In the virtual environment (called "curator") we created in the container, | ||
# run our PyTests marked with `@pytest.mark.gpu` | ||
# We specify the `rootdir` to help locate the "pyproject.toml" file (which is in the root directory of the repository), | ||
# and then the directory where the PyTests are located | ||
- name: Run PyTests with GPU mark | ||
run: | | ||
docker exec nemo-curator-container pytest -m gpu --rootdir /opt/NeMo-Curator /opt/NeMo-Curator/tests | ||
docker exec $CONTAINER_NAME pytest -m gpu --rootdir /opt/NeMo-Curator /opt/NeMo-Curator/tests | ||
# After running `docker stop`, the container remains in an exited state | ||
# It is still present on our system and could be restarted with `docker start` | ||
# Thus, we use `docker rm` to permanently removed it from the system | ||
- name: Cleanup | ||
if: always() | ||
run: | | ||
docker stop nemo-curator-container && docker rm nemo-curator-container | ||
docker stop $CONTAINER_NAME && docker rm $CONTAINER_NAME |
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