From 01598f7ca3a33fa77d525bfbac8962da651306e4 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Sat, 22 Jun 2024 10:01:03 -0700 Subject: [PATCH] Test for has_gpu --- docs/src/knownissues.md | 3 ++- test/test_basic.jl | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/src/knownissues.md b/docs/src/knownissues.md index d3e6a2a64..6fc71ed30 100644 --- a/docs/src/knownissues.md +++ b/docs/src/knownissues.md @@ -180,7 +180,7 @@ Make sure to: ``` - Then in Julia, upon loading MPI and CUDA modules, you can check - CUDA version: `CUDA.versioninfo()` - - If MPI has CUDA: `MPI.has_cuda()` + - If MPI has CUDA: [`MPI.has_cuda()`](@ref) - If you are using correct MPI library: `MPI.libmpi` After that, it may be preferred to run the Julia MPI script (as suggested [here](https://discourse.julialang.org/t/cuda-aware-mpi-works-on-system-but-not-for-julia/75060/11)) launching it from a shell script (as suggested [here](https://discourse.julialang.org/t/cuda-aware-mpi-works-on-system-but-not-for-julia/75060/4)). @@ -197,6 +197,7 @@ Make sure to: ``` - Then in Julia, upon loading MPI and CUDA modules, you can check - AMDGPU version: `AMDGPU.versioninfo()` + - If MPI has ROCm: [`MPI.has_rocm()`](@ref) - If you are using correct MPI implementation: `MPI.identify_implementation()` After that, [this script](https://gist.github.com/luraess/c228ec08629737888a18c6a1e397643c) can be used to verify if ROCm-aware MPI is functional (modified after the CUDA-aware version from [here](https://discourse.julialang.org/t/cuda-aware-mpi-works-on-system-but-not-for-julia/75060/11)). It may be preferred to run the Julia ROCm-aware MPI script launching it from a shell script (as suggested [here](https://discourse.julialang.org/t/cuda-aware-mpi-works-on-system-but-not-for-julia/75060/4)). diff --git a/test/test_basic.jl b/test/test_basic.jl index 57b6a65e5..3da013963 100644 --- a/test/test_basic.jl +++ b/test/test_basic.jl @@ -8,16 +8,22 @@ MPI.Init() @test MPI.has_cuda() isa Bool -if get(ENV,"JULIA_MPI_TEST_ARRAYTYPE","") == "CuArray" +if get(ENV, "JULIA_MPI_TEST_ARRAYTYPE", "") == "CuArray" @test MPI.has_cuda() end @test MPI.has_rocm() isa Bool -if get(ENV,"JULIA_MPI_TEST_ARRAYTYPE","") == "ROCArray" +if get(ENV, "JULIA_MPI_TEST_ARRAYTYPE", "") == "ROCArray" @test MPI.has_rocm() end +@test MPI.has_gpu() isa Bool + +if get(ENV, "JULIA_MPI_TEST_ARRAYTYPE", "") == "CuArray" || get(ENV, "JULIA_MPI_TEST_ARRAYTYPE", "") == "ROCArray" + @test MPI.has_gpu() +end + @test !MPI.Finalized() MPI.Finalize() @test MPI.Finalized()