Skip to content

Commit

Permalink
Migrate CUDA CI workflows (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasMoutawwakil authored Mar 13, 2024
1 parent fd32ad5 commit d719e6e
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 118 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/test_api_cuda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
{ torch_cuda: cu121, torch_pre_release: 1, cuda_version: 12.1.1 },
]

runs-on: nvidia-gpu
runs-on: [multi-gpu, nvidia-gpu, 4-a10, ci]

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -37,18 +38,13 @@ jobs:
--tag opt-bench-cuda:${{ matrix.image.cuda_version }}
.

- name: Get GPUs with most free memory
id: get_devices
run: |
echo "::set-output name=devices::$(nvidia-smi --query-gpu=memory.free,index --format=csv,noheader,nounits | sort -n -k1 | tail -n 2 | awk -F', ' '{print $2}' | xargs echo -n | sed 's/ /,/g' | awk '{print $0}')"
- name: Run tests
run: docker run
--rm
--pid host
--gpus all
--shm-size 64G
--env USE_CUDA="1"
--gpus '"device=${{ steps.get_devices.outputs.devices }}"'
--env PROCESS_SPECIFIC_VRAM="0"
--volume $(pwd):/workspace/optimum-benchmark
--workdir /workspace/optimum-benchmark
--entrypoint /bin/bash
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/test_cli_cuda_onnxruntime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ concurrency:

jobs:
build_image_and_run_cli_cuda_onnxruntime_tests:
runs-on: nvidia-gpu
runs-on: [single-gpu, nvidia-gpu, a10, ci]

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -28,20 +29,15 @@ jobs:
--tag opt-bench-cuda:11.8.0
.

- name: Get GPUs with most free memory
id: get_devices
run: |
echo "::set-output name=devices::$(nvidia-smi --query-gpu=memory.free,index --format=csv,noheader,nounits | sort -n -k1 | tail -n 2 | awk -F', ' '{print $2}' | xargs echo -n | sed 's/ /,/g' | awk '{print $0}')"
- name: Run tests
run: docker run
--rm
--pid host
--gpus all
--shm-size 64G
--env USE_CUDA="1"
--entrypoint /bin/bash
--gpus '"device=${{ steps.get_devices.outputs.devices }}"'
--env PROCESS_SPECIFIC_VRAM="0"
--volume $(pwd):/workspace/optimum-benchmark
--workdir /workspace/optimum-benchmark
--entrypoint /bin/bash
opt-bench-cuda:11.8.0
-c "pip install -e .[testing,onnxruntime-gpu,diffusers,timm] && pytest -k 'cli and cuda and onnxruntime' -x"
12 changes: 4 additions & 8 deletions .github/workflows/test_cli_cuda_pytorch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
{ torch_cuda: cu121, torch_pre_release: 1, cuda_version: 12.1.1 },
]

runs-on: nvidia-gpu
runs-on: [multi-gpu, nvidia-gpu, 4-a10, ci]

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -37,18 +38,13 @@ jobs:
--tag opt-bench-cuda:${{ matrix.image.cuda_version }}
.

- name: Get GPUs with most free memory
id: get_devices
run: |
echo "::set-output name=devices::$(nvidia-smi --query-gpu=memory.free,index --format=csv,noheader,nounits | sort -n -k1 | tail -n 2 | awk -F', ' '{print $2}' | xargs echo -n | sed 's/ /,/g' | awk '{print $0}')"
- name: Run tests
run: docker run
--rm
--pid host
--gpus all
--shm-size 64G
--env USE_CUDA="1"
--gpus '"device=${{ steps.get_devices.outputs.devices }}"'
--env PROCESS_SPECIFIC_VRAM="0"
--volume $(pwd):/workspace/optimum-benchmark
--workdir /workspace/optimum-benchmark
--entrypoint /bin/bash
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/test_cli_cuda_torch_ort.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ concurrency:

jobs:
build_image_and_run_cli_cuda_torch_ort_tests:
runs-on: nvidia-gpu
runs-on: [multi-gpu, nvidia-gpu, 4-a10, ci]

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -28,20 +29,15 @@ jobs:
--tag opt-bench-cuda:11.8.0
.

- name: Get GPUs with most free memory
id: get_devices
run: |
echo "::set-output name=devices::$(nvidia-smi --query-gpu=memory.free,index --format=csv,noheader,nounits | sort -n -k1 | tail -n 2 | awk -F', ' '{print $2}' | xargs echo -n | sed 's/ /,/g' | awk '{print $0}')"
- name: Run tests
run: docker run
--rm
--pid host
--gpus all
--shm-size 64G
--env USE_CUDA="1"
--entrypoint /bin/bash
--gpus '"device=${{ steps.get_devices.outputs.devices }}"'
--env PROCESS_SPECIFIC_VRAM="0"
--volume $(pwd):/workspace/optimum-benchmark
--workdir /workspace/optimum-benchmark
--entrypoint /bin/bash
opt-bench-cuda:11.8.0
-c "pip install -e .[testing,torch-ort,peft] && python -m torch_ort.configure && pytest -k 'cli and cuda and torch_ort' -x"
11 changes: 4 additions & 7 deletions .github/workflows/test_cli_tensorrt_llm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ concurrency:

jobs:
pull_image_and_run_cli_tensorrt_llm_tests:
runs-on: nvidia-gpu
runs-on: [single-gpu, nvidia-gpu, a10, ci]

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -26,18 +27,14 @@ jobs:
--tag opt-bench-tensorrt-llm:latest
.

- name: Get GPUs with most free memory
id: get_devices
run: |
echo "::set-output name=devices::$(nvidia-smi --query-gpu=memory.free,index --format=csv,noheader,nounits | sort -n -k1 | tail -n 2 | awk -F', ' '{print $2}' | xargs echo -n | sed 's/ /,/g' | awk '{print $0}')"
- name: Run tests
run: docker run
--rm
--gpus all
--pid host
--shm-size 64G
--env USE_CUDA="1"
--gpus '"device=${{ steps.get_devices.outputs.devices }}"'
--env PROCESS_SPECIFIC_VRAM="0"
--volume $(pwd):/workspace/optimum-benchmark
--workdir /workspace/optimum-benchmark
--entrypoint /bin/bash
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/test_cli_tensorrt_onnxruntime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ concurrency:

jobs:
build_image_and_run_cli_tensorrt_onnxruntime_tests:
runs-on: nvidia-gpu
runs-on: [single-gpu, nvidia-gpu, a10, ci]

steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -26,18 +27,14 @@ jobs:
--tag opt-bench-tensorrt:latest
.

- name: Get GPUs with most free memory
id: get_devices
run: |
echo "::set-output name=devices::$(nvidia-smi --query-gpu=memory.free,index --format=csv,noheader,nounits | sort -n -k1 | tail -n 2 | awk -F', ' '{print $2}' | xargs echo -n | sed 's/ /,/g' | awk '{print $0}')"
- name: Run tests
run: docker run
--rm
--gpus all
--pid host
--shm-size 64G
--env USE_CUDA="1"
--gpus '"device=${{ steps.get_devices.outputs.devices }}"'
--env PROCESS_SPECIFIC_VRAM="0"
--volume $(pwd):/workspace/optimum-benchmark
--workdir /workspace/optimum-benchmark
--entrypoint /bin/bash
Expand Down
4 changes: 3 additions & 1 deletion docker/cpu.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM ubuntu:latest
ARG UBUNTU_VERSION=20.04

FROM ubuntu:${UBUNTU_VERSION}

# Ignore interactive questions during `docker build`
ENV DEBIAN_FRONTEND noninteractive
Expand Down
1 change: 1 addition & 0 deletions examples/pytorch_timm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ launcher:
device_isolation: true

benchmark:
memory: true
input_shapes:
batch_size: 1

Expand Down
Loading

0 comments on commit d719e6e

Please sign in to comment.