From 3cc4b9f03a3f240005ce6a51bddcb49ceb46a82a Mon Sep 17 00:00:00 2001 From: Yi-Te Huang Date: Sun, 22 Sep 2024 16:05:24 +0800 Subject: [PATCH 1/6] introduce `QuantumToolboxMetalExt` --- .buildkite/Metal_Ext.yml | 34 +++++++++++++++ .buildkite/pipeline.yml | 10 +++++ Project.toml | 4 ++ ext/QuantumToolboxMetalExt.jl | 54 +++++++++++++++++++++++ test/ext-test/metal_ext.jl | 80 +++++++++++++++++++++++++++++++++++ test/runtests.jl | 5 +++ 6 files changed, 187 insertions(+) create mode 100644 .buildkite/Metal_Ext.yml create mode 100644 ext/QuantumToolboxMetalExt.jl create mode 100644 test/ext-test/metal_ext.jl diff --git a/.buildkite/Metal_Ext.yml b/.buildkite/Metal_Ext.yml new file mode 100644 index 000000000..d4947b7b4 --- /dev/null +++ b/.buildkite/Metal_Ext.yml @@ -0,0 +1,34 @@ +steps: + - label: "Metal Julia {{matrix.version}}" + matrix: + setup: + version: + - "1.10" # oldest + #- "1" # latest + plugins: + - JuliaCI/julia#v1: + version: "{{matrix.version}}" + - JuliaCI/julia-test#v1: + test_args: "--quickfail" + - JuliaCI/julia-coverage#v1: + codecov: true + dirs: + - src + - ext + agents: + queue: "juliaecosystem" + os: "macos" + arch: "aarch64" + env: + GROUP: "Metal_Ext" + SECRET_CODECOV_TOKEN: "ZfhQu/IcRLqNyZ//ZNs5sjBPaV76IHfU5gui52Qn+Rp8tOurukqgScuyDt+3HQ4R0hJYBw1/Nqg6jmBsvWSc9NEUx8kGsUJFHfN3no0+b+PFxA8oJkWc9EpyIsjht5ZIjlsFWR3f0DpPqMEle/QyWOPcal63CChXR8oAoR+Fz1Bh8GkokLlnC8F9Ugp9xBlu401GCbyZhvLTZnNIgK5yy9q8HBJnBg1cPOhI81J6JvYpEmcIofEzFV/qkfpTUPclu43WNoFX2DZPzbxilf3fsAd5/+nRkRfkNML8KiN4mnmjHxPPbuY8F5zC/PS5ybXtDpfvaMQc01WApXCkZk0ZAQ==;U2FsdGVkX1+eDT7dqCME5+Ox5i8GvWRTQbwiP/VYjapThDbxXFDeSSIC6Opmon+M8go22Bun3bat6Fzie65ang==" + timeout_in_minutes: 60 + if: | + // Don't run Buildkite if the commit message includes the text [skip ci], [ci skip], or [no ci] + // Don't run Buildkite for PR draft + // Only run Buildkite when new commits and PR are made to main branch + build.message !~ /\[skip ci\]/ && + build.message !~ /\[ci skip\]/ && + build.message !~ /\[no ci\]/ && + !build.pull_request.draft && + (build.branch =~ /main/ || build.pull_request.base_branch =~ /main/) \ No newline at end of file diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 83595dff4..2a5483712 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -12,5 +12,15 @@ steps: - "test/ext-test/cuda_ext.jl" - "Project.toml" target: ".buildkite/CUDA_Ext.yml" + - staticfloat/forerunner: # Metal.jl tests + watch: + - ".buildkite/pipeline.yml" + - ".buildkite/Metal_Ext.yml" + - "src/**" + - "ext/QuantumToolboxMetalExt.jl" + - "test/runtests.jl" + - "test/ext-test/metal_ext.jl" + - "Project.toml" + target: ".buildkite/Metal_Ext.yml" agents: queue: "juliagpu" diff --git a/Project.toml b/Project.toml index 13503d4ee..63994cd45 100644 --- a/Project.toml +++ b/Project.toml @@ -25,9 +25,11 @@ StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" [weakdeps] CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" +Metal = "dde4c033-4e86-420c-a63e-0dd931031962" [extensions] QuantumToolboxCUDAExt = "CUDA" +QuantumToolboxMetalExt = "Metal" [compat] ArrayInterface = "6, 7" @@ -39,6 +41,7 @@ Graphs = "1.7" IncompleteLU = "0.2" LinearAlgebra = "<0.0.1, 1" LinearSolve = "2" +Metal = "1" OrdinaryDiffEqCore = "1" OrdinaryDiffEqTsit5 = "1" Pkg = "<0.0.1, 1" @@ -54,6 +57,7 @@ julia = "1.10" [extras] CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" +Metal = "dde4c033-4e86-420c-a63e-0dd931031962" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] diff --git a/ext/QuantumToolboxMetalExt.jl b/ext/QuantumToolboxMetalExt.jl new file mode 100644 index 000000000..9cf90420a --- /dev/null +++ b/ext/QuantumToolboxMetalExt.jl @@ -0,0 +1,54 @@ +module QuantumToolboxMetalExt + +using QuantumToolbox +import Metal: mtl, MtlArray + +@doc raw""" + MtlArray(A::QuantumObject) +If `A.data` is an arbitrary array, return a new [`QuantumObject`](@ref) where `A.data` is in the type of `Metal.MtlArray` for gpu calculations. +Note that this function will always change element type into `32`-bit (`Int32`, `Float32`, and `ComplexF32`). +""" +MtlArray(A::QuantumObject{<:AbstractArray{T}}) where {T<:Number} = QuantumObject(MtlArray(A.data), A.type, A.dims) +MtlArray(A::QuantumObject{<:AbstractArray{T}}) where {T<:Int64} = QuantumObject(MtlArray{Int32}(A.data), A.type, A.dims) +MtlArray(A::QuantumObject{<:AbstractArray{T}}) where {T<:Float64} = + QuantumObject(MtlArray{Float32}(A.data), A.type, A.dims) +MtlArray(A::QuantumObject{<:AbstractArray{T}}) where {T<:ComplexF64} = + QuantumObject(MtlArray{ComplexF32}(A.data), A.type, A.dims) + +@doc raw""" + MtlArray{T}(A::QuantumObject) +If `A.data` is an arbitrary array, return a new [`QuantumObject`](@ref) where `A.data` is in the type of `Metal.MtlArray` with element type `T` for gpu calculations. +""" +MtlArray{T}(A::QuantumObject{<:AbstractArray{Tq}}) where {T,Tq<:Number} = + QuantumObject(MtlArray{T}(A.data), A.type, A.dims) + +@doc raw""" + mtl(A::QuantumObject) +Return a new [`QuantumObject`](@ref) where `A.data` is in the type of `Metal` arrays for gpu calculations. +Note that this function will always change element type into `32`-bit (`Int32`, `Float32`, and `ComplexF32`). +""" +mtl(A::QuantumObject{<:AbstractArray{T}}) where {T<:Int64} = QuantumObject(MtlArray{Int32}(A.data), A.type, A.dims) +mtl(A::QuantumObject{<:AbstractArray{T}}) where {T<:Float64} = QuantumObject(MtlArray{Float32}(A.data), A.type, A.dims) +mtl(A::QuantumObject{<:AbstractArray{T}}) where {T<:ComplexF64} = + QuantumObject(MtlArray{ComplexF32}(A.data), A.type, A.dims) + +## TODO: Remove the following part if Metal.jl support `sparse` +import LinearAlgebra: Transpose, Adjoint +import QuantumToolbox: _spre, _spost, _sprepost +_spre(A::MtlArray, Id::AbstractMatrix) = kron(Id, A) +_spre(A::Tranpose{T,<:MtlArray}, Id::AbstractMatrix) where {T<:Number} = kron(Id, A) +_spre(A::Adjoint{T,<:MtlArray}, Id::AbstractMatrix) where {T<:Number} = kron(Id, A) +_spost(B::MtlArray, Id::AbstractMatrix) = kron(transpose(B), Id) +_spost(B::Tranpose{T,<:MtlArray}, Id::AbstractMatrix) where {T<:Number} = kron(transpose(B), Id) +_spost(B::Adjoint{T,<:MtlArray}, Id::AbstractMatrix) where {T<:Number} = kron(transpose(B), Id) +_sprepost(A::MtlArray, B::MtlArray) = kron(transpose(B), A) +_sprepost(A::MtlArray, B::Tranpose{T,<:MtlArray}) where {T<:Number} = kron(transpose(B), A) +_sprepost(A::MtlArray, B::Adjoint{T,<:MtlArray}) where {T<:Number} = kron(transpose(B), A) +_sprepost(A::Tranpose{T,<:MtlArray}, B::MtlArray) where {T<:Number} = kron(transpose(B), A) +_sprepost(A::Tranpose{T1,<:MtlArray}, B::Tranpose{T2,<:MtlArray}) where {T1<:Number,T2<:Number} = kron(transpose(B), A) +_sprepost(A::Tranpose{T1,<:MtlArray}, B::Adjoint{T2,<:MtlArray}) where {T1<:Number,T2<:Number} = kron(transpose(B), A) +_sprepost(A::Adjoint{T,<:MtlArray}, B::MtlArray) where {T<:Number} = kron(transpose(B), A) +_sprepost(A::Adjoint{T1,<:MtlArray}, B::Tranpose{T2,<:MtlArray}) where {T1<:Number,T2<:Number} = kron(transpose(B), A) +_sprepost(A::Adjoint{T1,<:MtlArray}, B::Adjoint{T2,<:MtlArray}) where {T1<:Number,T2<:Number} = kron(transpose(B), A) + +end diff --git a/test/ext-test/metal_ext.jl b/test/ext-test/metal_ext.jl new file mode 100644 index 000000000..27f7ec355 --- /dev/null +++ b/test/ext-test/metal_ext.jl @@ -0,0 +1,80 @@ +using Metal + +QuantumToolbox.about() +Metal.versioninfo() + +@testset "Metal Extension" verbose = true begin + ψdi = Qobj(Int64[1, 0]) + ψdf = Qobj(Float64[1, 0]) + ψdc = Qobj(ComplexF64[1, 0]) + ψsi = dense_to_sparse(ψdi) + ψsf = dense_to_sparse(ψdf) + ψsc = dense_to_sparse(ψdc) + + Xdi = Qobj(Int64[0 1; 1 0]) + Xdf = Qobj(Float64[0 1; 1 0]) + Xdc = Qobj(ComplexF64[0 1; 1 0]) + Xsi = dense_to_sparse(Xdi) + Xsf = dense_to_sparse(Xdf) + Xsc = dense_to_sparse(Xdc) + + # type conversion of dense arrays + @test typeof(mtl(ψdi).data) == typeof(MtlArray{Int32}(ψdi).data) <: MtlVector{Int32} + @test typeof(mtl(ψdf).data) == + typeof(MtlArray(ψdf).data) == + typeof(MtlArray{Float32}(ψdf).data) <: + MtlVector{Float32} + @test typeof(mtl(ψdc).data) == + typeof(MtlArray(ψdc).data) == + typeof(MtlArray{ComplexF32}(ψdc).data) <: + MtlVector{ComplexF32} + @test typeof(mtl(Xdi).data) == typeof(MtlArray{Int32}(Xdi).data) <: MtlMatrix{Int32} + @test typeof(mtl(Xdf).data) == + typeof(MtlArray(Xdf).data) == + typeof(MtlArray{Float32}(Xdf).data) <: + MtlMatrix{Float32} + @test typeof(mtl(Xdc).data) == + typeof(MtlArray(Xdc).data) == + typeof(MtlArray{ComplexF32}(Xdc).data) <: + MtlMatrix{ComplexF32} + + # type conversion of sparse arrays + @test typeof(mtl(ψsi).data) == typeof(MtlArray{Int32}(ψsi).data) <: MtlVector{Int32} + @test typeof(mtl(ψsf).data) == + typeof(MtlArray(ψsf).data) == + typeof(MtlArray{Float32}(ψsf).data) <: + MtlVector{Float32} + @test typeof(mtl(ψsc).data) == + typeof(MtlArray(ψsc).data) == + typeof(MtlArray{ComplexF32}(ψsc).data) <: + MtlVector{ComplexF32} + @test typeof(mtl(Xsi).data) == typeof(MtlArray{Int32}(Xsi).data) <: MtlMatrix{Int32} + @test typeof(mtl(Xsf).data) == + typeof(MtlArray(Xsf).data) == + typeof(MtlArray{Float32}(Xsf).data) <: + MtlMatrix{Float32} + @test typeof(mtl(Xsc).data) == + typeof(MtlArray(Xsc).data) == + typeof(MtlArray{ComplexF32}(Xsc).data) <: + MtlMatrix{ComplexF32} + + # brief example in README and documentation + N = 5 # cannot be too large since Metal.jl does not support sparse matrix + ω = 1.0f0 # Float32 + γ = 0.1f0 # Float32 + tlist = range(0, 10, 100) + + ## calculate by CPU + a_cpu = destroy(N) + ψ0_cpu = fock(N, 3) + H_cpu = ω * a_cpu' * a_cpu + sol_cpu = mesolve(H_cpu, ψ0_cpu, tlist, [sqrt(γ) * a_cpu], e_ops = [a_cpu' * a_cpu], progress_bar = Val(false)) + + ## calculate by GPU + a_gpu = mtl(destroy(N)) + ψ0_gpu = mtl(fock(N, 3)) + H_gpu = ω * a_gpu' * a_gpu + sol_gpu = mesolve(H_gpu, ψ0_gpu, tlist, [sqrt(γ) * a_gpu], e_ops = [a_gpu' * a_gpu], progress_bar = Val(false)) + + @test all(isapprox.(sol_cpu.expect, sol_gpu.expect; atol = 1e-6)) +end diff --git a/test/runtests.jl b/test/runtests.jl index 70c361cd0..094b4389f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -43,3 +43,8 @@ if (GROUP == "CUDA_Ext")# || (GROUP == "All") Pkg.add("CUDA") include(joinpath(testdir, "ext-test", "cuda_ext.jl")) end + +if (GROUP == "Metal_Ext")# || (GROUP == "All") + Pkg.add("Metal") + include(joinpath(testdir, "ext-test", "metal_ext.jl")) +end From 3f573f693a253d3a9cc207dd903f6116c64fdf54 Mon Sep 17 00:00:00 2001 From: Yi-Te Huang Date: Thu, 2 Jan 2025 22:23:47 +0900 Subject: [PATCH 2/6] modify buildkite CI structure --- .buildkite/Metal_Ext.yml | 2 +- .buildkite/pipeline.yml | 4 ++-- test/ext-test/gpu/{ => cuda}/Project.toml | 0 test/ext-test/gpu/{ => cuda}/cuda_ext.jl | 0 test/ext-test/gpu/metal/Project.toml | 6 ++++++ test/ext-test/{ => gpu/metal}/metal_ext.jl | 5 ----- test/runtests.jl | 24 +++++++++++++++------- 7 files changed, 26 insertions(+), 15 deletions(-) rename test/ext-test/gpu/{ => cuda}/Project.toml (100%) rename test/ext-test/gpu/{ => cuda}/cuda_ext.jl (100%) create mode 100644 test/ext-test/gpu/metal/Project.toml rename test/ext-test/{ => gpu/metal}/metal_ext.jl (98%) diff --git a/.buildkite/Metal_Ext.yml b/.buildkite/Metal_Ext.yml index d4947b7b4..734eee47b 100644 --- a/.buildkite/Metal_Ext.yml +++ b/.buildkite/Metal_Ext.yml @@ -4,7 +4,7 @@ steps: setup: version: - "1.10" # oldest - #- "1" # latest + - "1" # latest plugins: - JuliaCI/julia#v1: version: "{{matrix.version}}" diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 9d8923201..77aa452e4 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -9,7 +9,7 @@ steps: - "src/**" - "ext/QuantumToolboxCUDAExt.jl" - "test/runtests.jl" - - "test/ext-test/gpu/**" + - "test/ext-test/gpu/cuda/**" - "Project.toml" target: ".buildkite/CUDA_Ext.yml" - staticfloat/forerunner: # Metal.jl tests @@ -19,7 +19,7 @@ steps: - "src/**" - "ext/QuantumToolboxMetalExt.jl" - "test/runtests.jl" - - "test/ext-test/metal_ext.jl" + - "test/ext-test/gpu/metal/**" - "Project.toml" target: ".buildkite/Metal_Ext.yml" agents: diff --git a/test/ext-test/gpu/Project.toml b/test/ext-test/gpu/cuda/Project.toml similarity index 100% rename from test/ext-test/gpu/Project.toml rename to test/ext-test/gpu/cuda/Project.toml diff --git a/test/ext-test/gpu/cuda_ext.jl b/test/ext-test/gpu/cuda/cuda_ext.jl similarity index 100% rename from test/ext-test/gpu/cuda_ext.jl rename to test/ext-test/gpu/cuda/cuda_ext.jl diff --git a/test/ext-test/gpu/metal/Project.toml b/test/ext-test/gpu/metal/Project.toml new file mode 100644 index 000000000..8dc69ff07 --- /dev/null +++ b/test/ext-test/gpu/metal/Project.toml @@ -0,0 +1,6 @@ +[deps] +Metal = "dde4c033-4e86-420c-a63e-0dd931031962" +QuantumToolbox = "6c2fb7c5-b903-41d2-bc5e-5a7c320b9fab" + +[compat] +Metal = "1" \ No newline at end of file diff --git a/test/ext-test/metal_ext.jl b/test/ext-test/gpu/metal/metal_ext.jl similarity index 98% rename from test/ext-test/metal_ext.jl rename to test/ext-test/gpu/metal/metal_ext.jl index 27f7ec355..ebf9f4ed7 100644 --- a/test/ext-test/metal_ext.jl +++ b/test/ext-test/gpu/metal/metal_ext.jl @@ -1,8 +1,3 @@ -using Metal - -QuantumToolbox.about() -Metal.versioninfo() - @testset "Metal Extension" verbose = true begin ψdi = Qobj(Int64[1, 0]) ψdf = Qobj(Float64[1, 0]) diff --git a/test/runtests.jl b/test/runtests.jl index dde4b4419..7d8d98003 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -6,7 +6,7 @@ const GROUP = get(ENV, "GROUP", "All") const testdir = dirname(@__FILE__) # Put core tests in alphabetical order -core_tests = [ +#= core_tests = [ "block_diagonal_form.jl", "correlations_and_spectrum.jl", "dynamical_fock_dimension_mesolve.jl", @@ -59,7 +59,7 @@ if (GROUP == "CairoMakie_Ext")# || (GROUP == "All") end if (GROUP == "CUDA_Ext")# || (GROUP == "All") - Pkg.activate("ext-test/gpu") + Pkg.activate("ext-test/gpu/cuda") Pkg.develop(PackageSpec(path = dirname(@__DIR__))) Pkg.instantiate() @@ -71,10 +71,20 @@ if (GROUP == "CUDA_Ext")# || (GROUP == "All") QuantumToolbox.about() CUDA.versioninfo() - include(joinpath(testdir, "ext-test", "gpu", "cuda_ext.jl")) -end + include(joinpath(testdir, "ext-test", "gpu", "cuda", "cuda_ext.jl")) +end =# + +if (GROUP == "Metal_Ext") || (GROUP == "All") + Pkg.activate("ext-test/gpu/metal") + Pkg.develop(PackageSpec(path = dirname(@__DIR__))) + Pkg.instantiate() + + using QuantumToolbox + using Metal + Metal.allowscalar(false) # Avoid unexpected scalar indexing + + QuantumToolbox.about() + Metal.versioninfo() -if (GROUP == "Metal_Ext")# || (GROUP == "All") - Pkg.add("Metal") - include(joinpath(testdir, "ext-test", "metal_ext.jl")) + include(joinpath(testdir, "ext-test", "gpu", "metal", "metal_ext.jl")) end From 12a3cdac2c36ef07fceee9adbd2318eda6d7d143 Mon Sep 17 00:00:00 2001 From: Yi-Te Huang Date: Thu, 2 Jan 2025 22:25:39 +0900 Subject: [PATCH 3/6] fix typos --- ext/QuantumToolboxMetalExt.jl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ext/QuantumToolboxMetalExt.jl b/ext/QuantumToolboxMetalExt.jl index 9cf90420a..114b133e0 100644 --- a/ext/QuantumToolboxMetalExt.jl +++ b/ext/QuantumToolboxMetalExt.jl @@ -36,19 +36,20 @@ mtl(A::QuantumObject{<:AbstractArray{T}}) where {T<:ComplexF64} = import LinearAlgebra: Transpose, Adjoint import QuantumToolbox: _spre, _spost, _sprepost _spre(A::MtlArray, Id::AbstractMatrix) = kron(Id, A) -_spre(A::Tranpose{T,<:MtlArray}, Id::AbstractMatrix) where {T<:Number} = kron(Id, A) +_spre(A::Transpose{T,<:MtlArray}, Id::AbstractMatrix) where {T<:Number} = kron(Id, A) _spre(A::Adjoint{T,<:MtlArray}, Id::AbstractMatrix) where {T<:Number} = kron(Id, A) _spost(B::MtlArray, Id::AbstractMatrix) = kron(transpose(B), Id) -_spost(B::Tranpose{T,<:MtlArray}, Id::AbstractMatrix) where {T<:Number} = kron(transpose(B), Id) +_spost(B::Transpose{T,<:MtlArray}, Id::AbstractMatrix) where {T<:Number} = kron(transpose(B), Id) _spost(B::Adjoint{T,<:MtlArray}, Id::AbstractMatrix) where {T<:Number} = kron(transpose(B), Id) _sprepost(A::MtlArray, B::MtlArray) = kron(transpose(B), A) -_sprepost(A::MtlArray, B::Tranpose{T,<:MtlArray}) where {T<:Number} = kron(transpose(B), A) +_sprepost(A::MtlArray, B::Transpose{T,<:MtlArray}) where {T<:Number} = kron(transpose(B), A) _sprepost(A::MtlArray, B::Adjoint{T,<:MtlArray}) where {T<:Number} = kron(transpose(B), A) -_sprepost(A::Tranpose{T,<:MtlArray}, B::MtlArray) where {T<:Number} = kron(transpose(B), A) -_sprepost(A::Tranpose{T1,<:MtlArray}, B::Tranpose{T2,<:MtlArray}) where {T1<:Number,T2<:Number} = kron(transpose(B), A) -_sprepost(A::Tranpose{T1,<:MtlArray}, B::Adjoint{T2,<:MtlArray}) where {T1<:Number,T2<:Number} = kron(transpose(B), A) +_sprepost(A::Transpose{T,<:MtlArray}, B::MtlArray) where {T<:Number} = kron(transpose(B), A) +_sprepost(A::Transpose{T1,<:MtlArray}, B::Transpose{T2,<:MtlArray}) where {T1<:Number,T2<:Number} = + kron(transpose(B), A) +_sprepost(A::Transpose{T1,<:MtlArray}, B::Adjoint{T2,<:MtlArray}) where {T1<:Number,T2<:Number} = kron(transpose(B), A) _sprepost(A::Adjoint{T,<:MtlArray}, B::MtlArray) where {T<:Number} = kron(transpose(B), A) -_sprepost(A::Adjoint{T1,<:MtlArray}, B::Tranpose{T2,<:MtlArray}) where {T1<:Number,T2<:Number} = kron(transpose(B), A) +_sprepost(A::Adjoint{T1,<:MtlArray}, B::Transpose{T2,<:MtlArray}) where {T1<:Number,T2<:Number} = kron(transpose(B), A) _sprepost(A::Adjoint{T1,<:MtlArray}, B::Adjoint{T2,<:MtlArray}) where {T1<:Number,T2<:Number} = kron(transpose(B), A) end From 81365dd17768bc987203edf35d2343a7ceaec9e8 Mon Sep 17 00:00:00 2001 From: Yi-Te Huang Date: Thu, 2 Jan 2025 22:33:57 +0900 Subject: [PATCH 4/6] move gpu test files --- .buildkite/pipeline.yml | 4 ++-- test/ext-test/{gpu => }/cuda/Project.toml | 0 test/ext-test/{gpu => }/cuda/cuda_ext.jl | 0 test/ext-test/{gpu => }/metal/Project.toml | 0 test/ext-test/{gpu => }/metal/metal_ext.jl | 0 test/runtests.jl | 14 +++++++------- 6 files changed, 9 insertions(+), 9 deletions(-) rename test/ext-test/{gpu => }/cuda/Project.toml (100%) rename test/ext-test/{gpu => }/cuda/cuda_ext.jl (100%) rename test/ext-test/{gpu => }/metal/Project.toml (100%) rename test/ext-test/{gpu => }/metal/metal_ext.jl (100%) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 77aa452e4..44008080b 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -9,7 +9,7 @@ steps: - "src/**" - "ext/QuantumToolboxCUDAExt.jl" - "test/runtests.jl" - - "test/ext-test/gpu/cuda/**" + - "test/ext-test/cuda/**" - "Project.toml" target: ".buildkite/CUDA_Ext.yml" - staticfloat/forerunner: # Metal.jl tests @@ -19,7 +19,7 @@ steps: - "src/**" - "ext/QuantumToolboxMetalExt.jl" - "test/runtests.jl" - - "test/ext-test/gpu/metal/**" + - "test/ext-test/metal/**" - "Project.toml" target: ".buildkite/Metal_Ext.yml" agents: diff --git a/test/ext-test/gpu/cuda/Project.toml b/test/ext-test/cuda/Project.toml similarity index 100% rename from test/ext-test/gpu/cuda/Project.toml rename to test/ext-test/cuda/Project.toml diff --git a/test/ext-test/gpu/cuda/cuda_ext.jl b/test/ext-test/cuda/cuda_ext.jl similarity index 100% rename from test/ext-test/gpu/cuda/cuda_ext.jl rename to test/ext-test/cuda/cuda_ext.jl diff --git a/test/ext-test/gpu/metal/Project.toml b/test/ext-test/metal/Project.toml similarity index 100% rename from test/ext-test/gpu/metal/Project.toml rename to test/ext-test/metal/Project.toml diff --git a/test/ext-test/gpu/metal/metal_ext.jl b/test/ext-test/metal/metal_ext.jl similarity index 100% rename from test/ext-test/gpu/metal/metal_ext.jl rename to test/ext-test/metal/metal_ext.jl diff --git a/test/runtests.jl b/test/runtests.jl index 7d8d98003..6acf4c6a7 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -6,7 +6,7 @@ const GROUP = get(ENV, "GROUP", "All") const testdir = dirname(@__FILE__) # Put core tests in alphabetical order -#= core_tests = [ +core_tests = [ "block_diagonal_form.jl", "correlations_and_spectrum.jl", "dynamical_fock_dimension_mesolve.jl", @@ -59,7 +59,7 @@ if (GROUP == "CairoMakie_Ext")# || (GROUP == "All") end if (GROUP == "CUDA_Ext")# || (GROUP == "All") - Pkg.activate("ext-test/gpu/cuda") + Pkg.activate("ext-test/cuda") Pkg.develop(PackageSpec(path = dirname(@__DIR__))) Pkg.instantiate() @@ -71,11 +71,11 @@ if (GROUP == "CUDA_Ext")# || (GROUP == "All") QuantumToolbox.about() CUDA.versioninfo() - include(joinpath(testdir, "ext-test", "gpu", "cuda", "cuda_ext.jl")) -end =# + include(joinpath(testdir, "ext-test", "cuda", "cuda_ext.jl")) +end -if (GROUP == "Metal_Ext") || (GROUP == "All") - Pkg.activate("ext-test/gpu/metal") +if (GROUP == "Metal_Ext")# || (GROUP == "All") + Pkg.activate("ext-test/metal") Pkg.develop(PackageSpec(path = dirname(@__DIR__))) Pkg.instantiate() @@ -86,5 +86,5 @@ if (GROUP == "Metal_Ext") || (GROUP == "All") QuantumToolbox.about() Metal.versioninfo() - include(joinpath(testdir, "ext-test", "gpu", "metal", "metal_ext.jl")) + include(joinpath(testdir, "ext-test", "metal", "metal_ext.jl")) end From a2f2abb3b50b0630bbda61e0d04519d535639879 Mon Sep 17 00:00:00 2001 From: Yi-Te Huang <44385685+ytdHuang@users.noreply.github.com> Date: Fri, 10 Jan 2025 00:21:33 +0900 Subject: [PATCH 5/6] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 6cd947e5c..7e4e10366 100644 --- a/Project.toml +++ b/Project.toml @@ -49,7 +49,7 @@ DiffEqCallbacks = "4.2.1 - 4" DiffEqNoiseProcess = "5" Distributed = "1" FFTW = "1.5" -GPUArrays = "10, 11" +GPUArrays = "11.2 - 11" Graphs = "1.7" IncompleteLU = "0.2" JET = "0.9" From 9eedf59e39ed91b11a49334aca5a64d222ad485a Mon Sep 17 00:00:00 2001 From: Yi-Te Huang <44385685+ytdHuang@users.noreply.github.com> Date: Thu, 16 Jan 2025 11:01:12 +0900 Subject: [PATCH 6/6] update `Metal` compat --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 7e4e10366..a8cdb74b1 100644 --- a/Project.toml +++ b/Project.toml @@ -56,7 +56,7 @@ JET = "0.9" KernelAbstractions = "0.9.2" LinearAlgebra = "1" LinearSolve = "2" -Metal = "1" +Metal = "1.5" OrdinaryDiffEqCore = "1" OrdinaryDiffEqTsit5 = "1" Pkg = "1"