Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@luraess
Last active July 19, 2023 08:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luraess/c228ec08629737888a18c6a1e397643c to your computer and use it in GitHub Desktop.
Save luraess/c228ec08629737888a18c6a1e397643c to your computer and use it in GitHub Desktop.
ROCm-aware (AMDGPU) MPI test
using MPI
using AMDGPU
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 = ROCArray{Float64}(undef, N)
recv_mesg = ROCArray{Float64}(undef, N)
fill!(send_mesg, Float64(rank))
AMDGPU.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