Skip to content

Commit

Permalink
Skip tests if there is no CUDA installed
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed May 7, 2024
1 parent 2c9b34c commit b04ce9f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
*.jl.cov
*.jl.mem
.DS_Store
/Manifest.toml
Manifest.toml
/dev/
3 changes: 2 additions & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[deps]
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
ITensorGPU = "d89171c1-af8f-46b3-badf-d2a472317c15"
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
46 changes: 25 additions & 21 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,31 @@ end

using ITensorGPU, Test, CUDA

println("Running ITensorGPU tests with a runtime CUDA version: $(CUDA.runtime_version())")
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",
)
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

0 comments on commit b04ce9f

Please sign in to comment.