https://github.com/JuliaParallel/MPI.jl
Raw File
Tip revision: 69ce0bf5c15e4a29cb4a4c3df3e8d02f3e9ba0ad authored by Simon Byrne on 23 January 2023, 18:49:26 UTC
Tag v0.20.8 (#712)
Tip revision: 69ce0bf
test_cart_coords.jl
using Test
using MPI

MPI.Init()
comm = MPI.COMM_WORLD
nnodes = MPI.Comm_size(comm)
ndims = 3
reorder = 1
periods = [0,1,0]
dims = MPI.Dims_create(nnodes, [0,0,0])
comm_cart = MPI.Cart_create(comm, dims; periodic=periods, reorder=reorder)

rank = MPI.Comm_rank(comm)
ccoords = MPI.Cart_coords(comm_cart, rank)
@test all(ccoords .>= 0)
@test all(ccoords .< dims)

coords = MPI.Cart_coords(comm_cart)
@test all(coords .>= 0)
@test all(coords .< dims)

MPI.free(comm_cart)

MPI.Finalize()
# @test MPI.Finalized()
back to top