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 #18 from LuxDL/ap/amdgpu
Browse files Browse the repository at this point in the history
Test AMDGPU
  • Loading branch information
avik-pal authored Jun 6, 2023
2 parents 30c4f01 + e64f900 commit 3e81b13
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 15 deletions.
33 changes: 31 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,37 @@ steps:
setup:
julia:
- "1"
- "1.6"
- "1.9-nightly"
- "nightly"
adjustments:
- with:
julia: "nightly"
soft_fail: true
- label: ":julia: Julia: {{matrix.julia}} + AMD GPU"
plugins:
- JuliaCI/julia#v1:
version: "{{matrix.julia}}"
- JuliaCI/julia-test#v1:
test_args: "--quickfail"
- JuliaCI/julia-coverage#v1:
codecov: true
dirs:
- src
- ext
env:
JULIA_AMDGPU_CORE_MUST_LOAD: "1"
JULIA_AMDGPU_HIP_MUST_LOAD: "1"
JULIA_AMDGPU_DISABLE_ARTIFACTS: "1"
GROUP: "AMDGPU"
agents:
queue: "juliagpu"
rocm: "*"
rocmgpu: "*"
if: build.message !~ /\[skip tests\]/
timeout_in_minutes: 60
matrix:
setup:
julia:
- "1"
- "nightly"
adjustments:
- with:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ jobs:
matrix:
version:
- "1"
- "1.6"
- "~1.9.0-0"
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
Expand All @@ -46,4 +44,3 @@ jobs:
- uses: codecov/codecov-action@v3
with:
files: lcov.info
flags: ${{ matrix.group }}
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LuxLib"
uuid = "82251201-b29d-42c6-8e01-566dec8acb11"
authors = ["Avik Pal <[email protected]> and contributors"]
version = "0.2.1"
version = "0.2.2"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
6 changes: 4 additions & 2 deletions ext/LuxLibTrackerExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@ end
epsilon::Real) where {T <: FP_32_64}
LuxLib._assert_same_backend(data(x), data(scale), data(bias))
if length(scale) != length(bias) != size(x, 3)
throw(ArgumentError("Length of `scale` and `bias` must be equal to the number of channels (N - 1 dim of the input array)."))
throw(ArgumentError("Length of `scale` and `bias` must be equal to the number of \
channels (N - 1 dim of the input array)."))
end
if size(x, 3) % groups != 0
throw(ArgumentError("Number of channels $(size(x, 3)) must be divisible by the number of groups $groups."))
throw(ArgumentError("Number of channels $(size(x, 3)) must be divisible by the \
number of groups $groups."))
end

y, mu, rsig = LuxLib._groupnorm(data(x), groups, data(scale), data(bias), epsilon)
Expand Down
4 changes: 1 addition & 3 deletions src/api/dropout.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ function dropout(rng::AbstractRNG,
::Val{false};
dims,
invp::T=inv(p)) where {T, T1, T2, N}
if size(x) != size(mask)
return dropout(rng, x, p, Val(true); dims, invp)
end
size(x) != size(mask) && return dropout(rng, x, p, Val(true); dims, invp)
return x .* ignore_derivatives(mask), mask, rng
end

Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[deps]
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
LuxAMDGPU = "83120cb1-ca15-4f04-bf3b-6967d2e6b60b"
LuxCUDA = "d0bbae9a-e099-4d5b-a835-1c6931763bda"
LuxTestUtils = "ac9de150-d08f-4546-94fb-7472b5760531"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
4 changes: 2 additions & 2 deletions test/api/dropout.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using LuxCUDA, Statistics, Test
using LuxLib
using Statistics, Test, LuxLib

include("../test_utils.jl")

Expand Down Expand Up @@ -145,6 +144,7 @@ end
@test y isa aType{T, length(x_shape)}
@test size(y) == x_shape
@test rng != rng_

@test_broken isapprox(std(y), std(x); atol=1.0f-2, rtol=1.0f-2)

__f = x -> sum(first(alpha_dropout(rng, x, T(0.5), Val(true))))
Expand Down
6 changes: 4 additions & 2 deletions test/test_utils.jl
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
using LuxLib, LuxTestUtils, StableRNGs, Test, Zygote
using LuxCUDA # CUDA Support
using LuxCUDA, LuxAMDGPU
using LuxTestUtils: @jet, @test_gradients, check_approx

const GROUP = get(ENV, "GROUP", "All")

cpu_testing() = GROUP == "All" || GROUP == "CPU"
cuda_testing() = (GROUP == "All" || GROUP == "CUDA") && LuxCUDA.functional()
amdgpu_testing() = (GROUP == "All" || GROUP == "AMDGPU") # && LuxAMDGPU.functional()
amdgpu_testing() = (GROUP == "All" || GROUP == "AMDGPU") && LuxAMDGPU.functional()

const MODES = begin
# Mode, Array Type, GPU?
cpu_mode = ("CPU", Array, false)
cuda_mode = ("CUDA", CuArray, true)
amdgpu_mode = ("AMDGPU", ROCArray, true)

modes = []
cpu_testing() && push!(modes, cpu_mode)
cuda_testing() && push!(modes, cuda_mode)
amdgpu_testing() && push!(modes, amdgpu_mode)
modes
end

Expand Down

2 comments on commit 3e81b13

@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/85005

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.2.2 -m "<description of version>" 3e81b136477d904d4b971bd3584278ffd8883d77
git push origin v0.2.2

Please sign in to comment.