-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix testing to not include all backends automatically
- Loading branch information
1 parent
979efc6
commit e8bb4c9
Showing
1 changed file
with
27 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,47 @@ | ||
using DistanceTransforms | ||
using Test | ||
|
||
using KernelAbstractions | ||
using CUDA, AMDGPU, Metal | ||
using oneAPI | ||
using Random | ||
AVAILABLE_GPU_BACKENDS = ["CUDA", "AMDGPU", "Metal", "oneAPI"] | ||
TEST_BACKENDS = filter(x->x in [AVAILABLE_GPU_BACKENDS; "CPU"], ARGS) | ||
|
||
if isempty(TEST_BACKENDS) | ||
using Preferences | ||
TEST_BACKENDS = [load_preference(KomaMRICore, "test_backend", "CPU")] | ||
@info "Using [preferences.KomaMRICore]." backend=first(TEST_BACKENDS) | ||
else | ||
@info "Using test_args" backend=first(TEST_BACKENDS) | ||
end | ||
|
||
USE_GPU = any(AVAILABLE_GPU_BACKENDS .∈ Ref(TEST_BACKENDS)) | ||
|
||
if CUDA.functional() | ||
@info "Using CUDA" | ||
if "CUDA" in TEST_BACKENDS | ||
using CUDA | ||
CUDA.versioninfo() | ||
backend = CUDABackend() | ||
dev = CuArray | ||
elseif AMDGPU.functional() | ||
@info "Using AMD" | ||
elseif "AMDGPU" in TEST_BACKENDS | ||
using AMDGPU | ||
AMDGPU.versioninfo() | ||
backend = ROCBackend() | ||
dev = ROCArray | ||
elseif oneAPI.functional() ## not well supported | ||
@info "Using oneAPI" | ||
oneAPI.versioninfo() | ||
backend = oneBackend() | ||
dev = oneArray | ||
elseif Metal.functional() | ||
@info "Using Metal" | ||
elseif "Metal" in TEST_BACKENDS | ||
using Metal | ||
Metal.versioninfo() | ||
backend = MetalBackend() | ||
dev = MtlArray | ||
elseif "oneAPI" in TEST_BACKENDS | ||
using oneAPI | ||
oneAPI.versioninfo() | ||
backend = oneBackend() | ||
dev = oneArray | ||
else | ||
@info "No GPU is available. Using CPU." | ||
@info "CPU using $(Threads.nthreads()) thread(s)" maxlog=1 | ||
backend = CPU() | ||
dev = Array | ||
end | ||
|
||
using KernelAbstractions | ||
using Random | ||
|
||
include("transform.jl") | ||
include("utils.jl") |