Skip to content

Commit

Permalink
Test exports
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed May 7, 2024
1 parent 8b15c6e commit f66f599
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 24 deletions.
2 changes: 2 additions & 0 deletions src/ITensorGPU.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ function randomCuITensor(args...; kwargs...)
end
export cuITensor, randomCuITensor

# TODO: Change over to `using ITensorMPS`
# once it is registered.
using ITensors.ITensorMPS: MPO, MPS, randomMPS
function CuMPS(args...; kwargs...)
return cu(MPS(args...; kwargs...))
Expand Down
69 changes: 45 additions & 24 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,52 @@ end

using ITensorGPU, Test, CUDA

if !CUDA.has_cuda()
println("System does not have CUDA, skipping test.")
else
println("Running ITensorGPU tests with a runtime CUDA version: $(CUDA.runtime_version())")

CUDA.allowscalar(false)
@testset "ITensorGPU.jl" begin
#@testset "$filename" for filename in ("test_cucontract.jl",)
# println("Running $filename with autotune")
# cmd = `$(Base.julia_cmd()) -e 'using Pkg; Pkg.activate(".."); Pkg.instantiate(); include("test_cucontract.jl")'`
# run(pipeline(setenv(cmd, "CUTENSOR_AUTOTUNE" => 1); stdout=stdout, stderr=stderr))
#end
@testset "$filename" for filename in (
"test_dmrg.jl",
"test_cuitensor.jl",
"test_cudiag.jl",
"test_cudense.jl",
"test_cucontract.jl",
"test_cumpo.jl",
"test_cumps.jl",
"test_cutruncate.jl",
#"test_pastaq.jl",
@testset "ITensorGPU.jl" begin
@testset "Test exports" begin
@test issetequal(
names(ITensorGPU),
[
:ITensorGPU,
:cpu,
:cu,
:cuITensor,
:cuMPO,
:cuMPS,
:productCuMPS,
:randomCuITensor,
:randomCuMPO,
:randomCuMPS,
],
)
end
if !CUDA.has_cuda()
println("System does not have CUDA, skipping test.")
else
println(
"Running ITensorGPU tests with a runtime CUDA version: $(CUDA.runtime_version())"
)
println("Running $filename")
include(filename)

CUDA.allowscalar(false)
@testset "ITensorGPU.jl" begin
#@testset "$filename" for filename in ("test_cucontract.jl",)
# println("Running $filename with autotune")
# cmd = `$(Base.julia_cmd()) -e 'using Pkg; Pkg.activate(".."); Pkg.instantiate(); include("test_cucontract.jl")'`
# run(pipeline(setenv(cmd, "CUTENSOR_AUTOTUNE" => 1); stdout=stdout, stderr=stderr))
#end
@testset "$filename" for filename in (
"test_dmrg.jl",
"test_cuitensor.jl",
"test_cudiag.jl",
"test_cudense.jl",
"test_cucontract.jl",
"test_cumpo.jl",
"test_cumps.jl",
"test_cutruncate.jl",
#"test_pastaq.jl",
)
println("Running $filename")
include(filename)
end
end
end
end

0 comments on commit f66f599

Please sign in to comment.