Skip to content

Commit eedc78d

Browse files
committed
Use cuda docker images
1 parent c27ae2e commit eedc78d

2 files changed

Lines changed: 23 additions & 41 deletions

File tree

.github/actions/setup-linux/action.yml

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ inputs:
1414
runs:
1515
using: "composite"
1616
steps:
17+
- name: Install common dependencies
18+
shell: bash
19+
run: |
20+
$(which sudo) apt-get update
21+
$(which sudo) apt-get install -y libblas-dev liblapack-dev liblapacke-dev zip git
22+
1723
- name: Use ccache
1824
uses: hendrikmuhs/ccache-action@v1.2
1925
with:
2026
key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ inputs.toolkit }}-py${{ inputs.python-version }}
2127
max-size: 1GB
2228

23-
- name: Install common dependencies
24-
shell: bash
25-
run: |
26-
sudo apt-get update
27-
sudo apt-get install -y libblas-dev liblapack-dev liblapacke-dev zip
28-
2929
- uses: actions/setup-python@v6
3030
with:
3131
python-version: ${{ inputs.python-version }}
@@ -42,43 +42,14 @@ runs:
4242
4343
- name: Install MPI
4444
shell: bash
45-
run: sudo apt-get install -y openmpi-bin openmpi-common libopenmpi-dev
46-
47-
- name: Install CUDA toolkit
48-
if: ${{ startsWith(inputs.toolkit, 'cuda') }}
49-
shell: bash
50-
env:
51-
# Note: the CI machine does not meet CUDA 13's driver requirement.
52-
# Compatibility matrix:
53-
# https://docs.nvidia.com/deeplearning/cudnn/backend/latest/reference/support-matrix.html
54-
PACKAGES: |
55-
{
56-
"cuda-12.6": "libcudnn9-dev-cuda-12 cuda-toolkit-12-6",
57-
"cuda-12.9": "libcudnn9-dev-cuda-12 cuda-toolkit-12-9",
58-
"cuda-13.0": "libcudnn9-dev-cuda-13 cuda-toolkit-13-0"
59-
}
60-
run: |
61-
# The CUDA binaries are hosted in the "sbsa" repo, the "arm64" repo is
62-
# Jetson specific. SBSA means Arm Server Base System Architecture.
63-
ARCH=${{ runner.arch == 'arm64' && 'sbsa' || 'x86_64' }}
64-
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/$ARCH/cuda-keyring_1.1-1_all.deb
65-
sudo dpkg -i cuda-keyring_1.1-1_all.deb
66-
sudo apt-get update
67-
sudo apt-get install -y \
68-
libnccl2 libnccl-dev \
69-
${{ fromJson(env.PACKAGES)[inputs.toolkit] }}
70-
echo "/usr/local/${{ inputs.toolkit }}/bin" >> $GITHUB_PATH
45+
run: $(which sudo) apt-get install -y openmpi-bin openmpi-common libopenmpi-dev
7146

7247
- name: CUDA packages and driver report
7348
if: ${{ startsWith(inputs.toolkit, 'cuda') }}
7449
shell: bash
7550
run: |
76-
sudo apt-get install -y ubuntu-drivers-common dkms
77-
echo "NVIDIA Driver Packages Available:"
78-
sudo ubuntu-drivers list --gpgpu
7951
echo "NVIDIA Driver Version:"
8052
cat /proc/driver/nvidia/version || echo "nvidia driver not found"
81-
echo "Installed NVIDIA and CUDA packages:"
8253
dpkg -l | egrep "cuda|nvidia" -i
8354
echo "DKMS Status:"
8455
dkms status || echo "dkms not found"

.github/workflows/build_and_test.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
outputs:
2323
matrix: ${{ steps.generator.outputs.matrix }}
2424
runner: ${{ steps.generator.outputs.runner }}
25+
container: ${{ steps.generator.outputs.container }}
2526
steps:
2627
- uses: actions/checkout@v5
2728
- name: Check lint
@@ -41,19 +42,28 @@ jobs:
4142
'aarch64': 'ubuntu-22.04-arm'
4243
}
4344
}
45+
let container = {
46+
'cpu': null
47+
}
4448
if (${{ github.repository == 'ml-explore/mlx' }}) {
45-
let cuda_toolkits = ['cuda-12.6', 'cuda-12.9']
49+
let cuda_versions = ['12.6', '12.9']
4650
let cuda_runner = {
47-
'x86_64': 'gpu-t4-4-core',
48-
'aarch64': 'ubuntu-22.04-arm'
51+
'x86_64': 'gpu-t4-4-core',
52+
'aarch64': 'ubuntu-22.04-arm'
4953
}
50-
for (let toolkit of cuda_toolkits) {
51-
matrix.toolkit.push(toolkit)
54+
for (let version of cuda_versions) {
55+
let toolkit = `cuda-${version}`
56+
matrix['toolkit'].push(toolkit)
5257
runner[toolkit] = cuda_runner
58+
container[toolkit] = `pytorch/pytorch:2.8.0-cuda${version}-cudnn9-devel`
5359
}
5460
}
61+
console.log(matrix)
62+
console.log(runner)
63+
console.log(container)
5564
core.setOutput('matrix', JSON.stringify(matrix))
5665
core.setOutput('runner', JSON.stringify(runner))
66+
core.setOutput('container', JSON.stringify(container))
5767
5868
linux_build_and_test:
5969
name: Linux (${{ matrix.toolkit }}, ${{ matrix.arch }})
@@ -62,6 +72,7 @@ jobs:
6272
fail-fast: false
6373
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
6474
runs-on: ${{ fromJson(needs.prepare.outputs.runner)[matrix.toolkit][matrix.arch] }}
75+
container: ${{ fromJson(needs.prepare.outputs.container)[matrix.toolkit] }}
6576
steps:
6677
- uses: actions/checkout@v5
6778
- uses: ./.github/actions/setup-linux

0 commit comments

Comments
 (0)