Skip to content

Commit 39abc8a

Browse files
giordanoamontoison
authored andcommitted
Make package loadable on systems without oneAPI
At the moment it's impossible to load this package in an environment with `oneAPI.jl`, if oneAPI isn't actually available (e.g. on aarch64 machines), which breaks lots of downstream workflows.
1 parent ea7dd9b commit 39abc8a

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "KrylovPreconditioners"
22
uuid = "45d422c2-293f-44ce-8315-2cb988662dec"
33
authors = ["Alexis Montoison <[email protected]>"]
4-
version = "0.3.6"
4+
version = "0.3.7"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
module KrylovPreconditionersOneAPIExt
2-
using LinearAlgebra
3-
using SparseArrays
42
using oneAPI
5-
using oneAPI: global_queue, sycl_queue, context, device
6-
using oneAPI.oneMKL
7-
using LinearAlgebra: checksquare, BlasReal, BlasFloat
8-
import LinearAlgebra: ldiv!, mul!
9-
import Base: size, eltype, unsafe_convert
103

11-
using KrylovPreconditioners
12-
const KP = KrylovPreconditioners
13-
using KernelAbstractions
14-
const KA = KernelAbstractions
4+
# Don't do anything if oneAPI isn't actually available.
5+
if oneAPI.oneL0.NEO_jll.is_available() && oneAPI.oneL0.functional[]
6+
using oneAPI: global_queue, sycl_queue, context, device
7+
using LinearAlgebra
8+
using SparseArrays
9+
using oneAPI.oneMKL
10+
using LinearAlgebra: checksquare, BlasReal, BlasFloat
11+
import LinearAlgebra: ldiv!, mul!
12+
import Base: size, eltype, unsafe_convert
1513

16-
include("oneAPI/block_jacobi.jl")
17-
include("oneAPI/operators.jl")
14+
using KrylovPreconditioners
15+
const KP = KrylovPreconditioners
16+
using KernelAbstractions
17+
const KA = KernelAbstractions
18+
19+
include("oneAPI/block_jacobi.jl")
20+
include("oneAPI/operators.jl")
21+
end
1822

1923
end

0 commit comments

Comments
 (0)