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

Commit

Permalink
Merge pull request #6 from LuxDL/compat
Browse files Browse the repository at this point in the history
Update compat bounds
  • Loading branch information
avik-pal authored Jul 5, 2023
2 parents 2866e27 + 0bfeb2e commit f82cfa4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
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

2 comments on commit f82cfa4

@avik-pal
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/86899

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.3 -m "<description of version>" f82cfa4ab2aad6d9eb80cd5ce495abd163b30ace
git push origin v0.1.3

Please sign in to comment.