diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml new file mode 100644 index 000000000..165864871 --- /dev/null +++ b/.buildkite/pipeline.yml @@ -0,0 +1,33 @@ +env: + SECRET_CODECOV_TOKEN: "" + +steps: + - label: "Julia v1 -- CUDA" + plugins: + - JuliaCI/julia#v1: + version: "1" + - JuliaCI/julia-test#v1: ~ + - JuliaCI/julia-coverage#v1: + dirs: + - src + - ext + agents: + queue: "juliagpu" + cuda: "*" + if: build.message !~ /\[skip tests\]/ + timeout_in_minutes: 30 + + - label: "Julia LTS -- CUDA" + plugins: + - JuliaCI/julia#v1: + version: "1.10" # "lts" isn't valid + - JuliaCI/julia-test#v1: ~ + - JuliaCI/julia-coverage#v1: + dirs: + - src + - ext + agents: + queue: "juliagpu" + cuda: "*" + if: build.message !~ /\[skip tests\]/ + timeout_in_minutes: 30 diff --git a/test/cuda/cu_adapt.jl b/test/cuda/cu_adapt.jl new file mode 100644 index 000000000..24360f637 --- /dev/null +++ b/test/cuda/cu_adapt.jl @@ -0,0 +1,30 @@ +using Test +using MPSKit +using TensorKit +using CUDA, cuTENSOR, Adapt + +@testset "Adapting to CuArray" begin + # start from random operators + L = 4 + T = ComplexF64 + + for V in (ℂ^2, U1Space(0 => 1, 1 => 1)) + O₁ = rand(T, V^L, V^L) + O₂ = rand(T, space(O₁)) + O₃ = rand(real(T), space(O₁)) + + # create MPO and convert it back to see if it is the same + mpo₁ = adapt(CuArray, FiniteMPO(O₁)) + mpo₂ = adapt(CuArray, FiniteMPO(O₂)) + mpo₃ = adapt(CuArray, FiniteMPO(O₃)) + + @test isfinite(mpo₁) + @test isfinite(typeof(mpo₁)) + @test GeometryStyle(typeof(mpo₁)) == FiniteChainStyle() + @test GeometryStyle(mpo₁) == FiniteChainStyle() + @test OperatorStyle(typeof(mpo₁)) == MPOStyle() + @test TensorKit.storagetype(mpo₁) == CuVector{T, 1, CUDA.DeviceMemory} + @test TensorKit.storagetype(mpo₂) == CuVector{T, 1, CUDA.DeviceMemory} + @test TensorKit.storagetype(mpo₃) == CuVector{T, 1, CUDA.DeviceMemory} + end +end diff --git a/test/runtests.jl b/test/runtests.jl index f08104e88..c1c525ade 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -12,4 +12,12 @@ init_code = quote end args = parse_args(ARGS) +is_buildkite = get(ENV, "BUILDKITE", "false") == "true" +if is_buildkite + empty!(testsuite) + gpu_testsuite = find_tests(joinpath(@__DIR__, "cuda")) + append!(testsuite, gpu_testsuite) +else + filter!(!(startswith("cuda") ∘ first), testsuite) +end runtests(MPSKit, args; testsuite, init_code)