Skip to content

Commit 89f521a

Browse files
committed
Add CPU backend testing support via KernelAbstractions
- Extended test/utils.jl to support CPU backend with KernelAbstractions.CPU() when GROUP=CPU - Added GPUArraysCore dependency to enable testing without actual GPU hardware - Created comprehensive CI workflow that tests CPU backend across multiple platforms - Updated Downgrade CI to use CPU backend for compatibility testing - Enables testing DiffEqGPU.jl algorithms on systems without GPU hardware 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 637715e commit 89f521a

File tree

4 files changed

+93
-1
lines changed

4 files changed

+93
-1
lines changed

.github/workflows/CI.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
paths-ignore:
7+
- 'docs/**'
8+
push:
9+
branches:
10+
- master
11+
paths-ignore:
12+
- 'docs/**'
13+
workflow_dispatch:
14+
15+
jobs:
16+
test:
17+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ matrix.group }}
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
version:
23+
- '1.10'
24+
- '1.11'
25+
os:
26+
- ubuntu-latest
27+
- windows-latest
28+
- macOS-latest
29+
arch:
30+
- x64
31+
group:
32+
- CPU
33+
include:
34+
# Test CUDA on Ubuntu
35+
- version: '1.10'
36+
os: ubuntu-latest
37+
arch: x64
38+
group: CUDA
39+
# Test AMDGPU on Ubuntu
40+
- version: '1.10'
41+
os: ubuntu-latest
42+
arch: x64
43+
group: AMDGPU
44+
# Test oneAPI on Ubuntu
45+
- version: '1.10'
46+
os: ubuntu-latest
47+
arch: x64
48+
group: oneAPI
49+
# Test Metal on macOS
50+
- version: '1.10'
51+
os: macOS-latest
52+
arch: x64
53+
group: Metal
54+
steps:
55+
- uses: actions/checkout@v4
56+
- uses: julia-actions/setup-julia@v2
57+
with:
58+
version: ${{ matrix.version }}
59+
arch: ${{ matrix.arch }}
60+
- uses: julia-actions/cache@v2
61+
- name: Install GPU dependencies
62+
if: matrix.group == 'CUDA'
63+
run: |
64+
# Install CUDA toolkit for testing
65+
sudo apt-get update
66+
sudo apt-get install -y nvidia-cuda-toolkit
67+
shell: bash
68+
- uses: julia-actions/julia-buildpkg@v1
69+
- uses: julia-actions/julia-runtest@v1
70+
env:
71+
GROUP: ${{ matrix.group }}
72+
- uses: julia-actions/julia-processcoverage@v1
73+
if: matrix.group == 'CPU'
74+
- uses: codecov/codecov-action@v4
75+
if: matrix.group == 'CPU'
76+
with:
77+
files: lcov.info
78+
token: ${{ secrets.CODECOV_TOKEN }}
79+
fail_ci_if_error: false

.github/workflows/Downgrade.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
matrix:
1818
downgrade_mode: ['alldeps']
1919
julia-version: ['1.10']
20+
group: ['CPU']
2021
steps:
2122
- uses: actions/checkout@v4
2223
- uses: julia-actions/setup-julia@v2
@@ -28,4 +29,6 @@ jobs:
2829
- uses: julia-actions/julia-buildpkg@v1
2930
- uses: julia-actions/julia-runtest@v1
3031
with:
31-
ALLOW_RERESOLVE: false
32+
ALLOW_RERESOLVE: false
33+
env:
34+
GROUP: ${{ matrix.group }}

Project.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
1010
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
1111
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1212
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
13+
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
1314
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
1415
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1516
LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
@@ -44,6 +45,7 @@ ChainRulesCore = "1"
4445
DiffEqBase = "6.122"
4546
DocStringExtensions = "0.8, 0.9"
4647
ForwardDiff = "0.10, 1"
48+
GPUArraysCore = "0.1, 0.2"
4749
KernelAbstractions = "0.9"
4850
LinearSolve = "1.15, 2, 3"
4951
Metal = "0.5, 1"
@@ -62,5 +64,10 @@ oneAPI = "1.2, 2"
6264
[extras]
6365
AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"
6466
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
67+
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
6568
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
6669
oneAPI = "8f75cd03-7ff8-4ecb-9b8f-daf728133b1b"
70+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
71+
72+
[targets]
73+
test = ["AMDGPU", "CUDA", "GPUArraysCore", "Metal", "oneAPI", "Test"]

test/utils.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ elseif GROUP == "oneAPI"
1111
elseif GROUP == "Metal"
1212
using Metal
1313
Metal.MetalBackend()
14+
elseif GROUP == "CPU"
15+
using KernelAbstractions
16+
KernelAbstractions.CPU()
1417
end
1518

1619
import GPUArraysCore

0 commit comments

Comments
 (0)