Return value of MPI_Dims_create()


Return value of MPI_Dims_create()



Assuming I have 64 processes and I want to create an MPI Cartesian Topology in 3-D, the default topology returned by MPI_Dims_create() is 4x4x4. Why is it 4x4x4 and why not 8x4x2 or 4x8x2 or 16x2x2 or any other combination that is possible ?


64


3-D


MPI_Dims_create()


4x4x4


4x4x4


8x4x2


4x8x2


16x2x2




1 Answer
1



MPI_Dims_create is specifically made as convenience function to create a balanced topology.


MPI_Dims_create



A balanced topology, i.e. ideally cube has a certain optimal properties. Consider you are doing a simulation on a 160x160x160 grid with your processes.


160x160x160



With 4x4x4 each processor gets 40x40x40 to work on and in case of a simple border exchange has to send 40x40 to each of the 6 neighbors (9600 in total)


4x4x4


40x40x40


40x40


9600



With 8x4x2 each processor gets 20x40x80, the border is 2x20x40 + 2x20x80 + 2x40x80 = 11200


8x4x2


20x40x80


2x20x40 + 2x20x80 + 2x40x80 = 11200



With 16x2x2 each processor gets 10x80x80, the border is 4x10x80 + 2x80x80 = 16000


16x2x2


10x80x80


4x10x80 + 2x80x80 = 16000



As you can see, the border size that needs to be exchanged is the smallest for the cube. Generally, a balanced topology is a good default.



You can also set constraints with MPI_Dims_create or use MPI_Cart_create to create flexible Cartesian topologies.


MPI_Dims_create


MPI_Cart_create






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Render GeoTiff to on browser with leaflet

How to get chrome logged in user's email id through website

using states in a react-navigation without redux