MPI.jl: Functions for cartesian process topology

question

#1

Hi all,

I cannot find any functions to create and use a cartesian process topology on the list of supported functions on the github page of MPI.jl. In particular, I am missing the functions:

  • MPI_Dims_create
  • MPI_Cart_create
  • MPI_Cart_coords
  • MPI_Cart_shift

Are these functions not wrapped or am I missing something? If they are missing, could they be added?

Thanks!

Sam


#2

You are correct that they have not been wrapped. I shouldn’t be too difficult to add them, but I don’t know if anyone has the right combination of time and motivation to do so. If you want to add them yourself and submit a pull request, the general procedure is:

  1. Add the function name to gen_functions.c.
  2. Run deps/build.jl. This will update the list of function names. The purpose of the printf statements in gen_functions.c is to create global constants in Julia (the name following the colon).
  3. In mpi-base.jl, add a Julia function containing a ccall, using the global constants created in steps 1 and 2. This function should have exactly the same arguments at the MPI function. Note that MPI.jl uses the Fortran MPI interface, so scalar arguments need an extra Ref around them.
  4. If you want, create higher-level functions that call the function written in step 3. For example, MPI_Dims_create takes an array and an integer argument specifying the array length. You could create a function that takes the array but not the length argument, and call length on the array.
  5. Add a test. The test need to be just enough to make sure the arguments are getting passed through the ccall correctly.

#3

Thanks for the explanation @JaredCrean2! It looks pretty straightforward, even for a Julia-newcomer like me. I will do a PR.


#4

This is then solved now. Here is my PR: https://github.com/JuliaParallel/MPI.jl/pull/227