...
Proceed as in the basic CUDA tutorial above but also ] add MPI
, i.e. install MPI.jl next to CUDA.jl. After using MPI
you can then use MPI.has_cuda()
to check whether the used MPI has been compiled with CUDA support (always the case for the OpenMPI provided by the JuliaHPC module).. (The easiest way to get a CUDA-aware MPI that works with Julia is to use the JuliaHPC module and export OMPI_MCA_opal_cuda_support=1
.)
You should now be able to run the following code (if stored in a file cuda_mpi_test.jl
) from the shell via mpirun -n 5 julia --project cuda_mpi_test.jl
.
...