Skip to content

Commit

Permalink
Test for potential multi-device
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Jun 7, 2024
1 parent e00224b commit 82a3315
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/amdgpu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ using FillArrays, Zygote # Extensions

ps_mixed = (; a=rand(2), b=device(rand(2)))
@test_throws ArgumentError get_device(ps_mixed)

dev = gpu_device()
x = rand(Float32, 10, 2)
x_dev = x |> dev
@test get_device(x_dev) isa parameterless_type(typeof(dev))

if LuxDeviceUtils.functional(LuxAMDGPUDevice)
dev2 = gpu_device(length(AMDGPU.devices()))
x_dev2 = x_dev |> dev2
@test get_device(x_dev2) isa typeof(dev2)
end
end

@testset "Wrapped Arrays" begin
Expand Down
11 changes: 11 additions & 0 deletions test/cuda.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@ using FillArrays, Zygote # Extensions

ps_mixed = (; a=rand(2), b=device(rand(2)))
@test_throws ArgumentError get_device(ps_mixed)

dev = gpu_device()
x = rand(Float32, 10, 2)
x_dev = x |> dev
@test get_device(x_dev) isa parameterless_type(typeof(dev))

if LuxDeviceUtils.functional(LuxCUDADevice)
dev2 = gpu_device(length(CUDA.devices()))
x_dev2 = x_dev |> dev2
@test get_device(x_dev2) isa typeof(dev2)
end
end

@testset "Wrapped Arrays" begin
Expand Down

0 comments on commit 82a3315

Please sign in to comment.