Last active
July 19, 2023 08:24
-
-
Save luraess/0063e90cb08eb2208b7fe204bbd90ed2 to your computer and use it in GitHub Desktop.
CUDA-aware MPI test
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
using MPI | |
using CUDA | |
MPI.Init() | |
comm = MPI.COMM_WORLD | |
rank = MPI.Comm_rank(comm) | |
size = MPI.Comm_size(comm) | |
dst = mod(rank+1, size) | |
src = mod(rank-1, size) | |
println("rank=$rank, size=$size, dst=$dst, src=$src") | |
N = 4 | |
send_mesg = CuArray{Float64}(undef, N) | |
recv_mesg = CuArray{Float64}(undef, N) | |
fill!(send_mesg, Float64(rank)) | |
CUDA.synchronize() | |
MPI.Sendrecv!(send_mesg, dst, 0, recv_mesg, src, 0, comm) | |
println("recv_mesg on proc $rank: $recv_mesg") | |
rank==0 && println("done.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment