Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions test/cuda/cu_adapt.jl
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading