Using MPI in MEX function

I am trying to run parallel code which is designed in the following way: I launch multiple MPI processes where only one of them (master) calls matlab script which further calls mex function in which I want to set-up MPI communication with the rest of the processes launched at the beginning. However, I am getting a MPI runtime error:
It looks like MPI_INIT failed for some reason; your parallel process is
likely to abort. There are many reasons that a parallel process can
fail during MPI_INIT; some of which are due to configuration or environment
problems. This failure appears to be an internal failure; here's some
additional information (which may only be relevant to an Open MPI
developer):
ompi_mpi_init: ompi_rte_init failed
--> Returned "(null)" (-43) instead of "Success" (0)
Does anybody have experience with similar approach? Is it possible to use MEX function and MPI together? I am using openmpi-2.0.0 and R2014b
The Matlab/C/Mex code is here: https://github.com/goghino/matlabMpiC

 Respuesta aceptada

Juraj
Juraj el 12 de Oct. de 2016
Editada: Walter Roberson el 28 de Oct. de 2017

0 votos

THIS APPROACH DOES NOT WORK!!!!!
The blocker is that a child cannot call MPI_Init() if its parent already called MPI_Init()
Fortunatly, there are some options (which I have not tried):-)
1) MPI_Comm_spawn matlab
master can MPI_Comm_spawn() matlab, and then matlab can merge the parent communicator, and communicate to master and slaves

Más respuestas (0)

Categorías

Más información sobre Performance and Memory en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 29 de Sept. de 2016

Editada:

el 28 de Oct. de 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by