diff --git a/test/Polar/TestPolarForm.jl b/test/Polar/TestPolarForm.jl index f1558717..bf9800a0 100644 --- a/test/Polar/TestPolarForm.jl +++ b/test/Polar/TestPolarForm.jl @@ -2,6 +2,8 @@ module TestPolarFormulation using Test +using AMDGPU +using CUDA using FiniteDiff using KernelAbstractions using LinearAlgebra diff --git a/test/Polar/second_order.jl b/test/Polar/second_order.jl index 619311f8..947d55f1 100644 --- a/test/Polar/second_order.jl +++ b/test/Polar/second_order.jl @@ -62,7 +62,7 @@ function test_hessprod_with_finitediff(polar, device, MT; rtol=1e-6, atol=1e-6) proj_fd = zeros(nx+nu) mul!(proj_fd, H_fd, tgt) - if startswith(string(device), "ROCBackend") + if isa(device, ROCBackend) @test_broken myisapprox(projp, proj_fd, rtol=rtol) else @test myisapprox(projp, proj_fd, rtol=rtol) @@ -121,7 +121,7 @@ function test_full_space_hessian(polar, device, MT) Hd = FiniteDiff.finite_difference_jacobian(grad_fd_x, x) # Test that both Hessian match - if startswith(string(device), "ROCBackend") + if isa(device, ROCBackend) @test_broken myisapprox(Hd, H, rtol=1e-5) else @test myisapprox(Hd, H, rtol=1e-5) diff --git a/test/Project.toml b/test/Project.toml index 022d6f71..156c2dea 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,4 +1,5 @@ [deps] +AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e" CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" @@ -8,7 +9,6 @@ LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3" LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Metis = "2679e427-3c69-5b7f-982b-ece356f1e94b" -Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" diff --git a/test/quickstart.jl b/test/quickstart.jl index ebe5fcd5..7a7c3da1 100644 --- a/test/quickstart.jl +++ b/test/quickstart.jl @@ -1,4 +1,6 @@ using Test +using AMDGPU +using CUDA using KernelAbstractions using ExaPF diff --git a/test/runtests.jl b/test/runtests.jl index aa219014..af100841 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,9 +1,10 @@ using LinearAlgebra -using Pkg using Random using SparseArrays using Test +using AMDGPU +using CUDA using KernelAbstractions using ExaPF @@ -18,18 +19,8 @@ is_package_installed(name::String) = !isnothing(Base.find_package(name)) ARCHS = Any[(CPU(), Array, SparseMatrixCSC)] -test_cuda = if is_package_installed("CUDA") - using CUDA - CUDA.has_cuda_gpu() -else - false -end -test_rocm = if is_package_installed("AMDGPU") - using AMDGPU - AMDGPU.has_rocm_gpu() -else - false -end +test_cuda = CUDA.functional() && CUDA.has_cuda_gpu() +test_rocm = AMDGPU.functional() && AMDGPU.has_rocm_gpu() # Setup CUDA if test_cuda