From 2f6a87a3c4cc38df042d1d0be582be311d021036 Mon Sep 17 00:00:00 2001 From: Leif Denby Date: Mon, 3 Jun 2024 11:33:40 +0100 Subject: [PATCH] add GPU-based runner on cirun.io --- .cirun.yml | 14 ++++++++++ .../workflows/ci-pip-install-and-test-gpu.yml | 27 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 .cirun.yml create mode 100644 .github/workflows/ci-pip-install-and-test-gpu.yml diff --git a/.cirun.yml b/.cirun.yml new file mode 100644 index 00000000..79d62f22 --- /dev/null +++ b/.cirun.yml @@ -0,0 +1,14 @@ +# setup for using github runners via https://cirun.io/ +runners: + - name: "aws-runner" + # Cloud Provider: AWS + cloud: "aws" + # https://aws.amazon.com/ec2/instance-types/g4/ + instance_type: "g4dn.xlarge" + # Ubuntu-20.4, ami image + machine_image: "ami-06fd8a495a537da8b" + preemptible: false + # Add this label in the "runs-on" param in .github/workflows/.yml + # So that this runner is created for running the workflow + labels: + - "cirun-aws-runner" diff --git a/.github/workflows/ci-pip-install-and-test-gpu.yml b/.github/workflows/ci-pip-install-and-test-gpu.yml new file mode 100644 index 00000000..2cc168f0 --- /dev/null +++ b/.github/workflows/ci-pip-install-and-test-gpu.yml @@ -0,0 +1,27 @@ +# cicd workflow for running tests with pytest +# needs to first install pdm, then install torch cpu manually and then install the package +# then run the tests + +name: test (pip install, gpu) + +on: [push, pull_request] + +jobs: + tests: + runs-on: "cirun-aws-runner--${{ github.run_id }}" + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install torch (GPU CUDA 12.1) + run: | + python -m pip install torch --index-url https://download.pytorch.org/whl/cu121 + + - name: Install package (including dev dependencies) + run: | + python -m pip install . + python -m pip install pytest + + - name: Run tests + run: | + python -m pytest