How to run compiled MPI function

3 visualizaciones (últimos 30 días)
Yangyang Xu
Yangyang Xu el 2 de Feb. de 2019
Comentada: Richard Hern el 10 de Dic. de 2022
Hi,
I did a simple MPI code and successfully compiled it by MEX. However, I do not know how to run it in MATLAB.
The name of the compiled file is called testMPI.mexa64, and I simply typed testMPI in MATLAB command window. It reported MPI_Init failed
Anyone can help on this?
#include "mex.h"
#include "math.h"
#include "stdio.h"
#include <mpi.h>
void mexFunction(
int nargout,
mxArray *pargout [ ],
int nargin,
const mxArray *pargin [ ]
) {
int comm_sz;
int my_rank;
int q = 0;
MPI_Init(NULL, NULL);
MPI_Comm_size(MPI_COMM_WORLD, &comm_sz);
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
printf("Hello from processor %d\n",my_rank);
MPI_Finalize();
printf("Hello, world!\n");
}
  2 comentarios
Amit P
Amit P el 7 de Jun. de 2019
I have the same problem with Matlab crashing every second time I run my Mex program.
I took the Crash Dump from the failed job and found the following:
[1] [0] fatal error
[1] Fatal error in MPI_Init: Other MPI error, error stack:
[1] MPI_Init(argc_p=0x0000000000000000, argv_p=0x0000000000000000) failed
[1] Cannot call MPI_INIT or MPI_INIT_THREAD more than once
Richard Hern
Richard Hern el 10 de Dic. de 2022
I ran into the same problem. Has it been solved?@Yangyang Xu@Amit P

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre MATLAB Compiler en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by