From f14e8019d8dffe4fc9770bc83a4e91c43c8010c3 Mon Sep 17 00:00:00 2001 From: William F Godoy Date: Tue, 9 Apr 2024 16:27:59 -0400 Subject: [PATCH] Refactor tests Separate weak dependencies back ends --- .github/workflows/ci-gpu-AMD.yaml | 2 -- .github/workflows/ci-gpu-NVIDIA.yaml | 2 -- Project.toml | 11 ++--------- test/Project.toml | 9 +++++++++ test/runtests.jl | 5 +++++ 5 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 test/Project.toml diff --git a/.github/workflows/ci-gpu-AMD.yaml b/.github/workflows/ci-gpu-AMD.yaml index 57c642b..e9a5c58 100644 --- a/.github/workflows/ci-gpu-AMD.yaml +++ b/.github/workflows/ci-gpu-AMD.yaml @@ -78,8 +78,6 @@ jobs: module load julia/1.9.1 module load rocm julia --project -e 'using Pkg; Pkg.instantiate()' - julia --project -e 'using Pkg; Pkg.add(name="AMDGPU", version="v0.8.6")' - julia --project -e 'using AMDGPU; AMDGPU.use_artifacts!(false)' julia --project -e 'using JACC.JACCPreferences; JACCPreferences.set_backend("AMDGPU")' - name: Test diff --git a/.github/workflows/ci-gpu-NVIDIA.yaml b/.github/workflows/ci-gpu-NVIDIA.yaml index 24070c4..0b67c93 100644 --- a/.github/workflows/ci-gpu-NVIDIA.yaml +++ b/.github/workflows/ci-gpu-NVIDIA.yaml @@ -75,8 +75,6 @@ jobs: if: steps.check.outputs.triggered == 'true' run: | julia --project -e 'using Pkg; Pkg.instantiate()' - julia --project -e 'using Pkg; Pkg.add(name="CUDA", version="v5.1.1")' - julia --project -e 'using CUDA; CUDA.set_runtime_version!(local_toolkit=true)' julia --project -e 'using JACC.JACCPreferences; JACCPreferences.set_backend("CUDA")' - name: Test diff --git a/Project.toml b/Project.toml index 00ce63a..4d57012 100644 --- a/Project.toml +++ b/Project.toml @@ -17,14 +17,7 @@ JACCCUDA = ["CUDA"] JACCONEAPI = ["oneAPI"] [compat] +AMDGPU = "0.8" +CUDA = "5" Preferences = "1.4.0" julia = "1.9.0" - -[extras] -AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e" -CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" -oneAPI = "8f75cd03-7ff8-4ecb-9b8f-daf728133b1b" -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" - -[targets] -test = ["AMDGPU", "CUDA", "oneAPI", "Test"] diff --git a/test/Project.toml b/test/Project.toml new file mode 100644 index 0000000..12adc99 --- /dev/null +++ b/test/Project.toml @@ -0,0 +1,9 @@ +[deps] +Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" +Preferences = "21216c6a-2e73-6563-6e65-726566657250" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[weakdeps] +AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e" +CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" +oneAPI = "8f75cd03-7ff8-4ecb-9b8f-daf728133b1b" diff --git a/test/runtests.jl b/test/runtests.jl index d435244..129a705 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,16 +1,21 @@ import JACC +using Pkg + const backend = JACC.JACCPreferences.backend @static if backend == "cuda" + Pkg.add(name="CUDA", version="v5.1.1") @show "CUDA backend loaded" include("tests_cuda.jl") elseif backend == "amdgpu" + Pkg.add(name="AMDGPU", version="v0.8.6") @show "AMDGPU backend loaded" include("tests_amdgpu.jl") elseif backend == "oneapi" + Pkg.add("oneAPI") @show "OneAPI backend loaded" include("tests_oneapi.jl")