Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit f82cfa4

Browse files
authored
Merge pull request #6 from LuxDL/compat
Update compat bounds
2 parents 2866e27 + 0bfeb2e commit f82cfa4

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

Project.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LuxDeviceUtils"
22
uuid = "34f89e08-e1d5-43b4-8944-0b49ac560553"
33
authors = ["Avik Pal <[email protected]> and contributors"]
4-
version = "0.1.2"
4+
version = "0.1.3"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
@@ -12,6 +12,7 @@ PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930"
1212
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
1313
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1414
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
15+
TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77"
1516

1617
[weakdeps]
1718
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
@@ -33,11 +34,12 @@ ChainRulesCore = "1"
3334
FillArrays = "0.13, 1"
3435
Functors = "0.2, 0.3, 0.4"
3536
LuxAMDGPU = "0.1"
36-
LuxCUDA = "0.1"
37+
LuxCUDA = "0.2, 0.3"
3738
LuxCore = "0.1.4"
3839
Metal = "0.4"
3940
PackageExtensionCompat = "1"
4041
Preferences = "1"
42+
TruncatedStacktraces = "1"
4143
Zygote = "0.6"
4244
julia = "1.6"
4345

src/LuxDeviceUtils.jl

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module LuxDeviceUtils
33
using ChainRulesCore, Functors, LuxCore, Preferences, Random, SparseArrays
44
import Adapt: adapt, adapt_storage
55
import Base: PkgId, UUID
6+
import TruncatedStacktraces
67

78
using PackageExtensionCompat
89
function __init__()
@@ -33,6 +34,8 @@ Base.@kwdef struct LuxMetalDevice <: AbstractLuxGPUDevice
3334
pkgid::PkgId = PkgId(UUID("dde4c033-4e86-420c-a63e-0dd931031962"), "Metal")
3435
end
3536

37+
Base.show(io::IO, dev::AbstractLuxDevice) = print(io, nameof(dev))
38+
3639
struct LuxDeviceSelectionException <: Exception end
3740

3841
function Base.showerror(io::IO, e::LuxDeviceSelectionException)
@@ -127,9 +130,9 @@ function _get_gpu_device(; force_gpu_usage::Bool)
127130
Ignoring the Preferences backend!!!
128131
Please load the package and call this function again to respect the Preferences backend.""" maxlog=1
129132
else
130-
if getproperty(Base.loaded_modules[dev.pkgid], :functional)()
131-
@debug "Using GPU backend: $(_get_device_name(dev))."
132-
return dev
133+
if getproperty(Base.loaded_modules[device.pkgid], :functional)()
134+
@debug "Using GPU backend: $(_get_device_name(device))."
135+
return device
133136
else
134137
@warn "GPU backend: $(_get_device_name(device)) set via Preferences.jl is not functional. Defaulting to automatic GPU Backend selection." maxlog=1
135138
end

test/runtests.jl

+4-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ end
4242
end
4343
end
4444

45-
@testset "Aqua Tests" begin
46-
Aqua.test_all(LuxDeviceUtils; piracy=false)
45+
if VERSION v"1.9"
46+
@testset "Aqua Tests" begin
47+
Aqua.test_all(LuxDeviceUtils; piracy=false)
48+
end
4749
end
4850
end

0 commit comments

Comments
 (0)