Skip to content

Commit

Permalink
Test for has_gpu
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Jun 23, 2024
1 parent 2710132 commit 01598f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/src/knownissues.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).
Expand All @@ -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)).
Expand Down
10 changes: 8 additions & 2 deletions test/test_basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 01598f7

Please sign in to comment.