From 02e4a4d603f5515ecc7837142181f4ac23784748 Mon Sep 17 00:00:00 2001 From: nHackel Date: Tue, 28 May 2024 12:02:16 +0200 Subject: [PATCH 01/11] Add JLArrays extension --- Project.toml | 4 ++++ ext/LinearOperatorsJLArraysExt.jl | 8 ++++++++ src/LinearOperators.jl | 3 +++ 3 files changed, 15 insertions(+) create mode 100644 ext/LinearOperatorsJLArraysExt.jl diff --git a/Project.toml b/Project.toml index a684f8a1..97b87f9b 100644 --- a/Project.toml +++ b/Project.toml @@ -13,17 +13,20 @@ TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" [weakdeps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" +JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb" LDLFactorizations = "40e66cde-538c-5869-a4ad-c39174c6795b" [extensions] LinearOperatorsChainRulesCoreExt = "ChainRulesCore" LinearOperatorsCUDAExt = "CUDA" LinearOperatorsLDLFactorizationsExt = "LDLFactorizations" +LinearOperatorsJLArraysExt = "JLArrays" [compat] ChainRulesCore = "1" CUDA = "4, 5" FastClosures = "0.2, 0.3" +JLArrays = "0.1" LDLFactorizations = "0.9, 0.10" LinearAlgebra = "1" Printf = "1" @@ -36,3 +39,4 @@ julia = "^1.6.0" ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" LDLFactorizations = "40e66cde-538c-5869-a4ad-c39174c6795b" +JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb" diff --git a/ext/LinearOperatorsJLArraysExt.jl b/ext/LinearOperatorsJLArraysExt.jl new file mode 100644 index 00000000..9fb937b1 --- /dev/null +++ b/ext/LinearOperatorsJLArraysExt.jl @@ -0,0 +1,8 @@ +module LinearOperatorsJLArraysExt + +using LinearOperators +isdefined(Base, :get_extension) ? (using JLArrays) : (using ..JLArrays) + +LinearOperators.storage_type(::JLArray{T, 2}) where {T} = JLArray{T, 1} + +end # module diff --git a/src/LinearOperators.jl b/src/LinearOperators.jl index d478c83e..5b21647b 100644 --- a/src/LinearOperators.jl +++ b/src/LinearOperators.jl @@ -43,6 +43,9 @@ end Requires.@require LDLFactorizations = "40e66cde-538c-5869-a4ad-c39174c6795b" begin include("../ext/LinearOperatorsLDLFactorizationsExt.jl") end + Requires.@require JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb" begin + include("../ext/LinearOperatorsJLArraysExt.jl") + end end end From 8a5b2c78c535bc50c72308ddddab07cec3dd62e0 Mon Sep 17 00:00:00 2001 From: nHackel Date: Wed, 29 May 2024 11:36:39 +0200 Subject: [PATCH 02/11] Fix discarded S kwarg in opEye --- src/special-operators.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/special-operators.jl b/src/special-operators.jl index d23e9393..a17c3443 100644 --- a/src/special-operators.jl +++ b/src/special-operators.jl @@ -68,7 +68,7 @@ Change `S` to use LinearOperators on GPU. """ function opEye(T::DataType, nrow::I, ncol::I; S = Vector{T}) where {I <: Integer} if nrow == ncol - return opEye(T, nrow) + return opEye(T, nrow; S = S) end prod! = @closure (res, v, α, β) -> mulOpEye!(res, v, α, β, min(nrow, ncol)) return LinearOperator{T}(nrow, ncol, false, false, prod!, prod!, prod!, S = S) From 0c6d57e740b24bcd87a6dfdcd62677209260a148 Mon Sep 17 00:00:00 2001 From: nHackel Date: Wed, 29 May 2024 11:36:53 +0200 Subject: [PATCH 03/11] Add s kwarg tests on JLArrays --- test/Project.toml | 2 ++ test/runtests.jl | 3 ++- test/test_S_kwarg.jl | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 test/test_S_kwarg.jl diff --git a/test/Project.toml b/test/Project.toml index d61e85c0..39732754 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -2,6 +2,7 @@ Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97" ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a" +JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb" LDLFactorizations = "40e66cde-538c-5869-a4ad-c39174c6795b" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" @@ -16,6 +17,7 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" Arpack = "0.5" ChainRulesCore = "1" FastClosures = "0.2, 0.3" +JLArrays = "0.1" LDLFactorizations = "0.9, 0.10" Requires = "1" Test = "1" diff --git a/test/runtests.jl b/test/runtests.jl index 53f05beb..c2dd6407 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,5 @@ using Arpack, Test, TestSetExtensions, LinearOperators -using LinearAlgebra, LDLFactorizations, SparseArrays +using LinearAlgebra, LDLFactorizations, SparseArrays, JLArrays using Zygote include("test_aux.jl") @@ -16,3 +16,4 @@ include("test_normest.jl") include("test_diag.jl") include("test_chainrules.jl") include("test_solve_shifted_system.jl") +include("test_S_kwarg.jl") diff --git a/test/test_S_kwarg.jl b/test/test_S_kwarg.jl new file mode 100644 index 00000000..08f0af49 --- /dev/null +++ b/test/test_S_kwarg.jl @@ -0,0 +1,40 @@ +function test_S_kwarg(; arrayType = JLArray) + mat = arrayType(rand(Float32, 32, 32)) + vec = arrayType(rand(Float32, 32)) + vecT = typeof(vec) + + # To test operators which can derive a default storage_type from their arguments + vecTother = typeof(arrayType(rand(Float64, 32))) + + @testset ExtendedTestSet "S Kwarg" begin + @test vecT == LinearOperators.storage_type(mat) + + # constructors.jl + @test LinearOperators.storage_type(LinearOperator(mat)) == LinearOperators.storage_type(mat) # default + @test LinearOperators.storage_type(LinearOperator(mat; S = vecTother)) == vecTother + @test LinearOperators.storage_type(LinearOperator(Symmetric(mat); S = vecT)) == vecT + @test LinearOperators.storage_type(LinearOperator(SymTridiagonal(Symmetric(mat)); S = vecT)) == vecT + @test LinearOperators.storage_type(LinearOperator(Hermitian(mat); S = vecT)) == vecT + @test LinearOperators.storage_type(LinearOperator(Float32, 32, 32, true, true, () -> 0; S = vecT)) == vecT + + # special-operators.jl + @test LinearOperators.storage_type(opEye(Float32, 32; S = vecT)) == vecT + @test LinearOperators.storage_type(opEye(Float32, 16, 32; S = vecT)) == vecT + @test LinearOperators.storage_type(opEye(Float32, 32, 32; S = vecT)) == vecT + + @test LinearOperators.storage_type(opOnes(Float32, 32, 32; S = vecT)) == vecT + @test LinearOperators.storage_type(opZeros(Float32, 32, 32; S = vecT)) == vecT + + @test LinearOperators.storage_type(opDiagonal(vec)) == vecT + @test LinearOperators.storage_type(opDiagonal(32, 32, vec)) == vecT + + @test LinearOperators.storage_type(opRestriction([1, 2, 3], 32; S = vecT)) == vecT + @test LinearOperators.storage_type(opExtension([1, 2, 3], 32; S = vecT)) == vecT + + @test LinearOperators.storage_type(BlockDiagonalOperator(mat, mat)) == vecT # default + @test LinearOperators.storage_type(BlockDiagonalOperator(mat, mat; S = vecTother)) == vecTother + end + +end + +test_S_kwarg() \ No newline at end of file From bc8c686c73fb0449b03e5fc79882fb53aa5ff596 Mon Sep 17 00:00:00 2001 From: nHackel Date: Mon, 3 Jun 2024 16:43:34 +0200 Subject: [PATCH 04/11] Add AMDGPU extension --- Project.toml | 4 ++++ ext/LinearOperatorsAMDGPUExt.jl | 8 ++++++++ src/LinearOperators.jl | 3 +++ 3 files changed, 15 insertions(+) create mode 100644 ext/LinearOperatorsAMDGPUExt.jl diff --git a/Project.toml b/Project.toml index 97b87f9b..4cf990c5 100644 --- a/Project.toml +++ b/Project.toml @@ -11,18 +11,21 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" [weakdeps] +AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e" ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb" LDLFactorizations = "40e66cde-538c-5869-a4ad-c39174c6795b" [extensions] +LinearOperatorsAMDGPUExt = "AMDGPU" LinearOperatorsChainRulesCoreExt = "ChainRulesCore" LinearOperatorsCUDAExt = "CUDA" LinearOperatorsLDLFactorizationsExt = "LDLFactorizations" LinearOperatorsJLArraysExt = "JLArrays" [compat] +AMDGPU = "0.6, 0.7, 0.8, 0.9" ChainRulesCore = "1" CUDA = "4, 5" FastClosures = "0.2, 0.3" @@ -36,6 +39,7 @@ TimerOutputs = "^0.5" julia = "^1.6.0" [extras] +AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e" ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" LDLFactorizations = "40e66cde-538c-5869-a4ad-c39174c6795b" diff --git a/ext/LinearOperatorsAMDGPUExt.jl b/ext/LinearOperatorsAMDGPUExt.jl new file mode 100644 index 00000000..56865164 --- /dev/null +++ b/ext/LinearOperatorsAMDGPUExt.jl @@ -0,0 +1,8 @@ +module LinearOperatorsAMDGPUExt + +using LinearOperators +isdefined(Base, :get_extension) ? (using AMDGPU) : (using ..AMDGPU) + +LinearOperators.storage_type(::ROCArray{T, 2, B}) where {T, B} = ROCArray{T, 1, B} + +end # module diff --git a/src/LinearOperators.jl b/src/LinearOperators.jl index 5b21647b..36409269 100644 --- a/src/LinearOperators.jl +++ b/src/LinearOperators.jl @@ -34,6 +34,9 @@ end @static if !isdefined(Base, :get_extension) function __init__() + Requires.@require AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e" begin + include("../ext/LinearOperatorsAMDGPUExt.jl") + end Requires.@require ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" begin include("../ext/LinearOperatorsChainRulesCoreExt.jl") end From 6dc3b23d4081e9dfd132474108e25840a785d6fe Mon Sep 17 00:00:00 2001 From: Tobias Knopp Date: Sun, 9 Jun 2024 10:52:21 +0200 Subject: [PATCH 05/11] add Metal.jl support/tests --- Project.toml | 4 ++++ ext/LinearOperatorsMetalExt.jl | 8 ++++++++ src/LinearOperators.jl | 3 +++ test/Project.toml | 2 ++ test/runtests.jl | 3 +++ test/test_S_kwarg.jl | 21 +++++++++++++-------- 6 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 ext/LinearOperatorsMetalExt.jl diff --git a/Project.toml b/Project.toml index 4cf990c5..ec4a3f2f 100644 --- a/Project.toml +++ b/Project.toml @@ -16,6 +16,7 @@ ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb" LDLFactorizations = "40e66cde-538c-5869-a4ad-c39174c6795b" +Metal = "dde4c033-4e86-420c-a63e-0dd931031962" [extensions] LinearOperatorsAMDGPUExt = "AMDGPU" @@ -23,6 +24,7 @@ LinearOperatorsChainRulesCoreExt = "ChainRulesCore" LinearOperatorsCUDAExt = "CUDA" LinearOperatorsLDLFactorizationsExt = "LDLFactorizations" LinearOperatorsJLArraysExt = "JLArrays" +LinearOperatorsMetalExt = "Metal" [compat] AMDGPU = "0.6, 0.7, 0.8, 0.9" @@ -32,6 +34,7 @@ FastClosures = "0.2, 0.3" JLArrays = "0.1" LDLFactorizations = "0.9, 0.10" LinearAlgebra = "1" +Metal = "1.1" Printf = "1" Requires = "1" SparseArrays = "1" @@ -44,3 +47,4 @@ ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" LDLFactorizations = "40e66cde-538c-5869-a4ad-c39174c6795b" JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb" +Metal = "dde4c033-4e86-420c-a63e-0dd931031962" diff --git a/ext/LinearOperatorsMetalExt.jl b/ext/LinearOperatorsMetalExt.jl new file mode 100644 index 00000000..36f9bced --- /dev/null +++ b/ext/LinearOperatorsMetalExt.jl @@ -0,0 +1,8 @@ +module LinearOperatorsMetalExt + +using LinearOperators +isdefined(Base, :get_extension) ? (using Metal) : (using ..Metal) + +LinearOperators.storage_type(::MtlArray{T, 2, S}) where {T, S} = MtlArray{T, 1, S} + +end # module \ No newline at end of file diff --git a/src/LinearOperators.jl b/src/LinearOperators.jl index 36409269..7158c471 100644 --- a/src/LinearOperators.jl +++ b/src/LinearOperators.jl @@ -49,6 +49,9 @@ end Requires.@require JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb" begin include("../ext/LinearOperatorsJLArraysExt.jl") end + Requires.@require Metal = "dde4c033-4e86-420c-a63e-0dd931031962" begin + include("../ext/LinearOperatorsMetalExt.jl") + end end end diff --git a/test/Project.toml b/test/Project.toml index 39732754..8e2f4dcc 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -5,6 +5,7 @@ FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a" JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb" LDLFactorizations = "40e66cde-538c-5869-a4ad-c39174c6795b" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +Metal = "dde4c033-4e86-420c-a63e-0dd931031962" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Requires = "ae029012-a4dd-5104-9daa-d747884805df" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" @@ -19,6 +20,7 @@ ChainRulesCore = "1" FastClosures = "0.2, 0.3" JLArrays = "0.1" LDLFactorizations = "0.9, 0.10" +Metal = "1.1" Requires = "1" Test = "1" TestSetExtensions = "3" diff --git a/test/runtests.jl b/test/runtests.jl index c2dd6407..41dcb22b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,9 @@ using Arpack, Test, TestSetExtensions, LinearOperators using LinearAlgebra, LDLFactorizations, SparseArrays, JLArrays using Zygote +if Sys.isapple() && occursin("arm64", Sys.MACHINE) + using Metal +end include("test_aux.jl") include("test_linop.jl") diff --git a/test/test_S_kwarg.jl b/test/test_S_kwarg.jl index 08f0af49..0acd9faa 100644 --- a/test/test_S_kwarg.jl +++ b/test/test_S_kwarg.jl @@ -1,19 +1,21 @@ -function test_S_kwarg(; arrayType = JLArray) +function test_S_kwarg(; arrayType = JLArray, notMetal = true) mat = arrayType(rand(Float32, 32, 32)) vec = arrayType(rand(Float32, 32)) vecT = typeof(vec) - # To test operators which can derive a default storage_type from their arguments - vecTother = typeof(arrayType(rand(Float64, 32))) + if notMetal + # To test operators which can derive a default storage_type from their arguments + vecTother = typeof(arrayType(rand(Float32, 32))) + end - @testset ExtendedTestSet "S Kwarg" begin + @testset ExtendedTestSet "S Kwarg with arrayType $(arrayType)" begin @test vecT == LinearOperators.storage_type(mat) # constructors.jl @test LinearOperators.storage_type(LinearOperator(mat)) == LinearOperators.storage_type(mat) # default - @test LinearOperators.storage_type(LinearOperator(mat; S = vecTother)) == vecTother + notMetal && @test LinearOperators.storage_type(LinearOperator(mat; S = vecTother)) == vecTother @test LinearOperators.storage_type(LinearOperator(Symmetric(mat); S = vecT)) == vecT - @test LinearOperators.storage_type(LinearOperator(SymTridiagonal(Symmetric(mat)); S = vecT)) == vecT + notMetal && @test LinearOperators.storage_type(LinearOperator(SymTridiagonal(Symmetric(mat)); S = vecT)) == vecT @test LinearOperators.storage_type(LinearOperator(Hermitian(mat); S = vecT)) == vecT @test LinearOperators.storage_type(LinearOperator(Float32, 32, 32, true, true, () -> 0; S = vecT)) == vecT @@ -32,9 +34,12 @@ function test_S_kwarg(; arrayType = JLArray) @test LinearOperators.storage_type(opExtension([1, 2, 3], 32; S = vecT)) == vecT @test LinearOperators.storage_type(BlockDiagonalOperator(mat, mat)) == vecT # default - @test LinearOperators.storage_type(BlockDiagonalOperator(mat, mat; S = vecTother)) == vecTother + notMetal && @test LinearOperators.storage_type(BlockDiagonalOperator(mat, mat; S = vecTother)) == vecTother end end -test_S_kwarg() \ No newline at end of file +test_S_kwarg() +if Sys.isapple() && occursin("arm64", Sys.MACHINE) + test_S_kwarg(arrayType = MtlArray, notMetal = false) +end \ No newline at end of file From 2ec08e97a8f6cb699b0680e19ab116aeb03b37bf Mon Sep 17 00:00:00 2001 From: nHackel Date: Tue, 2 Jul 2024 18:00:16 +0200 Subject: [PATCH 06/11] Refactor gpu tests into gpu/ folder --- .buildkite/pipeline.yml | 1 + test/gpu/amdgpu.jl | 15 +++++++++++++++ test/gpu/jlarrays.jl | 1 + test/gpu/metal.jl | 3 +++ test/gpu/nvidia.jl | 1 + test/{ => gpu}/test_S_kwarg.jl | 11 ++++------- test/runtests.jl | 8 +++++--- 7 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 test/gpu/amdgpu.jl create mode 100644 test/gpu/jlarrays.jl create mode 100644 test/gpu/metal.jl rename test/{ => gpu}/test_S_kwarg.jl (87%) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 814bf484..98f72513 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -11,5 +11,6 @@ steps: using Pkg Pkg.add("CUDA") Pkg.instantiate() + include("test/gpu/test_S_kwarg.jl") include("test/gpu/nvidia.jl")' timeout_in_minutes: 30 diff --git a/test/gpu/amdgpu.jl b/test/gpu/amdgpu.jl new file mode 100644 index 00000000..bda6b90f --- /dev/null +++ b/test/gpu/amdgpu.jl @@ -0,0 +1,15 @@ +using Test, LinearAlgebra, SparseArrays +using LinearOperators, AMDGPU + +@testset "AMDGPU -- AMDGPU.jl" begin + A = ROCArray(rand(Float32, 5, 5)) + B = ROCArray(rand(Float32, 10, 10)) + C = ROCArray(rand(Float32, 20, 20)) + M = BlockDiagonalOperator(A, B, C) + + v = ROCArray(rand(Float32, 35)) + y = M * v + @test y isa ROCArray{Float32} + + @testset "AMDGPU S kwarg" test_S_kwarg(arrayType = ROCArray) +end diff --git a/test/gpu/jlarrays.jl b/test/gpu/jlarrays.jl new file mode 100644 index 00000000..77c9b7a8 --- /dev/null +++ b/test/gpu/jlarrays.jl @@ -0,0 +1 @@ +test_S_kwarg(arrayType = JLArray) \ No newline at end of file diff --git a/test/gpu/metal.jl b/test/gpu/metal.jl new file mode 100644 index 00000000..7b9a08a0 --- /dev/null +++ b/test/gpu/metal.jl @@ -0,0 +1,3 @@ +if Sys.isapple() && occursin("arm64", Sys.MACHINE) + test_S_kwarg(arrayType = MtlArray, notMetal = false) +end \ No newline at end of file diff --git a/test/gpu/nvidia.jl b/test/gpu/nvidia.jl index bd419924..c707dee8 100644 --- a/test/gpu/nvidia.jl +++ b/test/gpu/nvidia.jl @@ -13,4 +13,5 @@ using LinearOperators, CUDA, CUDA.CUSPARSE, CUDA.CUSOLVER v = CUDA.rand(35) y = M * v @test y isa CuVector{Float32} + @testset "Nvidia S kwarg" test_S_kwarg(arrayType = CuArray) end diff --git a/test/test_S_kwarg.jl b/test/gpu/test_S_kwarg.jl similarity index 87% rename from test/test_S_kwarg.jl rename to test/gpu/test_S_kwarg.jl index 0acd9faa..56095dba 100644 --- a/test/test_S_kwarg.jl +++ b/test/gpu/test_S_kwarg.jl @@ -1,4 +1,6 @@ -function test_S_kwarg(; arrayType = JLArray, notMetal = true) +using Test, LinearOperators, LinearAlgebra + +function test_S_kwarg(; arrayType, notMetal = true) mat = arrayType(rand(Float32, 32, 32)) vec = arrayType(rand(Float32, 32)) vecT = typeof(vec) @@ -8,7 +10,7 @@ function test_S_kwarg(; arrayType = JLArray, notMetal = true) vecTother = typeof(arrayType(rand(Float32, 32))) end - @testset ExtendedTestSet "S Kwarg with arrayType $(arrayType)" begin + @testset "S Kwarg with arrayType $(arrayType)" begin @test vecT == LinearOperators.storage_type(mat) # constructors.jl @@ -37,9 +39,4 @@ function test_S_kwarg(; arrayType = JLArray, notMetal = true) notMetal && @test LinearOperators.storage_type(BlockDiagonalOperator(mat, mat; S = vecTother)) == vecTother end -end - -test_S_kwarg() -if Sys.isapple() && occursin("arm64", Sys.MACHINE) - test_S_kwarg(arrayType = MtlArray, notMetal = false) end \ No newline at end of file diff --git a/test/runtests.jl b/test/runtests.jl index 41dcb22b..d8619b1a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,9 +1,6 @@ using Arpack, Test, TestSetExtensions, LinearOperators using LinearAlgebra, LDLFactorizations, SparseArrays, JLArrays using Zygote -if Sys.isapple() && occursin("arm64", Sys.MACHINE) - using Metal -end include("test_aux.jl") include("test_linop.jl") @@ -20,3 +17,8 @@ include("test_diag.jl") include("test_chainrules.jl") include("test_solve_shifted_system.jl") include("test_S_kwarg.jl") +include("gpu/jlarrays.jl") +if Sys.isapple() && occursin("arm64", Sys.MACHINE) + using Metal + include("gpu/metal.jl") +end From 3102708c3b9ecf603a97b4149b828df81aaa6816 Mon Sep 17 00:00:00 2001 From: nHackel Date: Tue, 2 Jul 2024 18:08:31 +0200 Subject: [PATCH 07/11] Add buildkite step for AMDGPUs --- .buildkite/pipeline.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 98f72513..2fa8b28a 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -14,3 +14,21 @@ steps: include("test/gpu/test_S_kwarg.jl") include("test/gpu/nvidia.jl")' timeout_in_minutes: 30 + + - label: "AMD GPUs -- LinearOperators.jl" + plugins: + - JuliaCI/julia#v1: + version: 1.8 + agents: + queue: "juliagpu" + rocm: "*" + rocmgpu: "*" + command: | + julia --color=yes --project -e ' + using Pkg + Pkg.add("AMDGPU") + Pkg.instantiate() + include("test/gpu/test_S_kwarg.jl") + include("test/gpu/amdgpu.jl")' + timeout_in_minutes: 30 + From 58a4bd0d3900de6ee627939be01a09477e80bb92 Mon Sep 17 00:00:00 2001 From: nHackel Date: Wed, 3 Jul 2024 09:42:03 +0200 Subject: [PATCH 08/11] Increase Julia version for AMDGPU buildkite --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 2fa8b28a..9e8aa7f0 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -18,7 +18,7 @@ steps: - label: "AMD GPUs -- LinearOperators.jl" plugins: - JuliaCI/julia#v1: - version: 1.8 + version: 1.9 agents: queue: "juliagpu" rocm: "*" From 8289d45e840fab6e4f80444a7e4227f12e41a28e Mon Sep 17 00:00:00 2001 From: nHackel Date: Wed, 3 Jul 2024 09:46:22 +0200 Subject: [PATCH 09/11] Try fix AMD buildkite compat --- .buildkite/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 9e8aa7f0..9e2dcabb 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -18,7 +18,7 @@ steps: - label: "AMD GPUs -- LinearOperators.jl" plugins: - JuliaCI/julia#v1: - version: 1.9 + version: "1.10" agents: queue: "juliagpu" rocm: "*" From 144af538b44cdc9434d0c0484cb0258d10c9f4fd Mon Sep 17 00:00:00 2001 From: Niklas Hackelberg Date: Mon, 14 Oct 2024 11:50:43 +0200 Subject: [PATCH 10/11] Update test/gpu/metal.jl Co-authored-by: Dominique --- test/gpu/metal.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/gpu/metal.jl b/test/gpu/metal.jl index 7b9a08a0..a921eab9 100644 --- a/test/gpu/metal.jl +++ b/test/gpu/metal.jl @@ -1,3 +1,2 @@ -if Sys.isapple() && occursin("arm64", Sys.MACHINE) - test_S_kwarg(arrayType = MtlArray, notMetal = false) -end \ No newline at end of file +using Metal +test_S_kwarg(arrayType = MtlArray, notMetal = false) \ No newline at end of file From 2744a1bc95ef218b8a5403fd03d6d2e9c7b99a6e Mon Sep 17 00:00:00 2001 From: Niklas Hackelberg Date: Mon, 14 Oct 2024 11:50:52 +0200 Subject: [PATCH 11/11] Update test/runtests.jl Co-authored-by: Dominique --- test/runtests.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index d8619b1a..59af2c68 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -19,6 +19,5 @@ include("test_solve_shifted_system.jl") include("test_S_kwarg.jl") include("gpu/jlarrays.jl") if Sys.isapple() && occursin("arm64", Sys.MACHINE) - using Metal include("gpu/metal.jl") end