Skip to content

Commit ab407a3

Browse files
Drop support for Julia < 1.9 and CUDA < 4. Remove Requires machinery.
1 parent 5f07cf3 commit ab407a3

File tree

8 files changed

+29
-71
lines changed

8 files changed

+29
-71
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
version:
13-
- '1.6'
13+
- '1.9'
1414
- '1'
1515
- 'nightly'
1616
os:

Project.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,15 @@ DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1111
LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3"
1212
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
1313
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
14-
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1514

1615
[compat]
1716
ArgCheck = "2"
1817
CEnum = "0.4"
1918
CUDA = "4, 5"
2019
DataStructures = "0.18"
2120
DocStringExtensions = "0.8, 0.9"
22-
Requires = "1"
2321
cuDNN = "1.1"
24-
julia = "1.6"
22+
julia = "1.9"
2523

2624
[extensions]
2725
CUDAExt = ["CUDA", "cuDNN"]
@@ -32,7 +30,7 @@ CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
3230
cuDNN = "02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd"
3331

3432
[targets]
35-
test = ["Test"]
33+
test = ["Test", "CUDA", "cuDNN"]
3634

3735
[weakdeps]
3836
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"

src/ONNXRunTime.jl

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
module ONNXRunTime
2-
if !isdefined(Base, :get_extension)
3-
using Requires: @require
4-
end
52

63
function _perm(arr::AbstractArray{T,N}) where {T,N}
74
ntuple(i->N+1-i, N)
@@ -16,12 +13,4 @@ end
1613
include("capi.jl")
1714
include("highlevel.jl")
1815

19-
@static if !isdefined(Base, :get_extension)
20-
function __init__()
21-
@require CUDA="052768ef-5323-5732-b1bb-66c8b64840ba" begin
22-
CUDA.functional() && include("cuda.jl")
23-
end
24-
end
25-
end
26-
2716
end #module

src/highlevel.jl

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -65,31 +65,23 @@ function load_inference(path::AbstractString; execution_provider::Symbol=:cpu,
6565
if execution_provider === :cpu
6666
session_options = CreateSessionOptions(api)
6767
elseif execution_provider === :cuda
68-
if isdefined(Base, :get_extension)
69-
CUDAExt = Base.get_extension(@__MODULE__, :CUDAExt)
70-
if isnothing(CUDAExt)
71-
@warn """
72-
The $(repr(execution_provider)) execution provider requires the CUDA.jl and cuDNN.jl packages to be available. Try adding `import CUDA, cuDNN` to your code.
73-
"""
74-
elseif !getfield(CUDAExt, :cuda_functional)()
75-
@warn """
76-
The $(repr(execution_provider)) execution provider requires CUDA to be functional. See `CUDA.functional`.
77-
"""
78-
elseif !(v"11.8" <= getfield(CUDAExt, :cuda_runtime_version)() < v"12")
79-
# Note: The supported version range is a property
80-
# inherited from the CUDA runtime library and needs to
81-
# be updated when the library is updated. It may be a
82-
# good idea to centralize this information somewhere.
83-
@warn """
84-
The $(repr(execution_provider)) execution provider requires a CUDA runtime version of at least 11.8 but less than 12. See `CUDA.set_runtime_version!`.
85-
"""
86-
end
87-
else
88-
if !isdefined(@__MODULE__, :CUDA)
89-
@warn """
90-
The $(repr(execution_provider)) execution provider requires the CUDA.jl package to be available. Try adding `import CUDA` to your code.
91-
"""
92-
end
68+
CUDAExt = Base.get_extension(@__MODULE__, :CUDAExt)
69+
if isnothing(CUDAExt)
70+
@warn """
71+
The $(repr(execution_provider)) execution provider requires the CUDA.jl and cuDNN.jl packages to be available. Try adding `import CUDA, cuDNN` to your code.
72+
"""
73+
elseif !getfield(CUDAExt, :cuda_functional)()
74+
@warn """
75+
The $(repr(execution_provider)) execution provider requires CUDA to be functional. See `CUDA.functional`.
76+
"""
77+
elseif !(v"11.8" <= getfield(CUDAExt, :cuda_runtime_version)() < v"12")
78+
# Note: The supported version range is a property
79+
# inherited from the CUDA runtime library and needs to
80+
# be updated when the library is updated. It may be a
81+
# good idea to centralize this information somewhere.
82+
@warn """
83+
The $(repr(execution_provider)) execution provider requires a CUDA runtime version of at least 11.8 but less than 12. See `CUDA.set_runtime_version!`.
84+
"""
9385
end
9486
session_options = CreateSessionOptions(api)
9587
cuda_options = OrtCUDAProviderOptions()

test/LocalPreferences.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[CUDA_Runtime_jll]
2+
version = "11.8"

test/Project.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
[deps]
22
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
33
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4+
cuDNN = "02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd"
45

56
[compat]
6-
CUDA = "3"
7+
CUDA = "5"
8+
cuDNN = "1.2"
9+
10+
[extras]
11+
CUDA_Runtime_jll = "76a88914-d11a-5bdc-97e0-2f5a05c973a2"

test/test_cuda.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module TestCUDA
22
import CUDA
3+
import cuDNN
34
using Test
45
using ONNXRunTime
56
const ORT = ONNXRunTime

test/test_cuda_extension.jl

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,35 +39,6 @@ function with_environment(f::Function; cuda_runtime_version)
3939
end
4040
end
4141

42-
@testset "Julia 1.6 CUDA 3" begin
43-
with_environment(cuda_runtime_version = "11.8") do env
44-
install_script = """
45-
using Pkg
46-
Pkg.develop(path = "$(package_path)")
47-
Pkg.add(name = "CUDA", version = "3")
48-
"""
49-
@test success(run(`julia +1.6 --project=$(env) -e "$(install_script)"`))
50-
# Correct dependency for :cuda.
51-
test_script = """
52-
using ONNXRunTime, CUDA
53-
load_inference("$(onnx_path)", execution_provider = :cuda)
54-
"""
55-
@test success(run(`julia +1.6 --project=$(env) -e "$(test_script)"`))
56-
# CUDA not loaded.
57-
test_script = """
58-
using ONNXRunTime
59-
load_inference("$(onnx_path)", execution_provider = :cuda)
60-
"""
61-
@test_throws ProcessFailedException run(`julia +1.6 --project=$(env) -e "$(test_script)"`)
62-
# CUDA not loaded but running on CPU, so it's fine.
63-
test_script = """
64-
using ONNXRunTime
65-
load_inference("$(onnx_path)", execution_provider = :cpu)
66-
"""
67-
@test success(run(`julia +1.6 --project=$(env) -e "$(test_script)"`))
68-
end
69-
end
70-
7142
@testset "Julia 1.9 CUDA 3" begin
7243
with_environment(cuda_runtime_version = "11.8") do env
7344
install_script = """

0 commit comments

Comments
 (0)