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

Update compat bounds #6

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LuxDeviceUtils"
uuid = "34f89e08-e1d5-43b4-8944-0b49ac560553"
authors = ["Avik Pal <[email protected]> and contributors"]
version = "0.1.2"
version = "0.1.3"

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

[weakdeps]
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
Expand All @@ -33,11 +34,12 @@ ChainRulesCore = "1"
FillArrays = "0.13, 1"
Functors = "0.2, 0.3, 0.4"
LuxAMDGPU = "0.1"
LuxCUDA = "0.1"
LuxCUDA = "0.2, 0.3"
LuxCore = "0.1.4"
Metal = "0.4"
PackageExtensionCompat = "1"
Preferences = "1"
TruncatedStacktraces = "1"
Zygote = "0.6"
julia = "1.6"

Expand Down
9 changes: 6 additions & 3 deletions src/LuxDeviceUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module LuxDeviceUtils
using ChainRulesCore, Functors, LuxCore, Preferences, Random, SparseArrays
import Adapt: adapt, adapt_storage
import Base: PkgId, UUID
import TruncatedStacktraces

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

Base.show(io::IO, dev::AbstractLuxDevice) = print(io, nameof(dev))

struct LuxDeviceSelectionException <: Exception end

function Base.showerror(io::IO, e::LuxDeviceSelectionException)
Expand Down Expand Up @@ -127,9 +130,9 @@ function _get_gpu_device(; force_gpu_usage::Bool)
Ignoring the Preferences backend!!!
Please load the package and call this function again to respect the Preferences backend.""" maxlog=1
else
if getproperty(Base.loaded_modules[dev.pkgid], :functional)()
@debug "Using GPU backend: $(_get_device_name(dev))."
return dev
if getproperty(Base.loaded_modules[device.pkgid], :functional)()
@debug "Using GPU backend: $(_get_device_name(device))."
return device
else
@warn "GPU backend: $(_get_device_name(device)) set via Preferences.jl is not functional. Defaulting to automatic GPU Backend selection." maxlog=1
end
Expand Down
6 changes: 4 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ end
end
end

@testset "Aqua Tests" begin
Aqua.test_all(LuxDeviceUtils; piracy=false)
if VERSION ≥ v"1.9"
@testset "Aqua Tests" begin
Aqua.test_all(LuxDeviceUtils; piracy=false)
end
end
end