mardi 24 octobre 2017

MPI directive for serial run

I added a piece of code to an open source software. My code reads data from a file, copies the data to an std::vector (using push_back) and later uses that vector for some applications. The code works when I run it in serial, however, in parallel I get the following error:

mpirun noticed that process rank 0 with PID 27564 on node alpha exited on signal 11 (Segmentation fault)

How can I make MPI to only run the part of the code I added in serial and the rest in parallel? I tried the following but I get the same error.

#ifdef HAVE_MPI

MPI_Comm_rank(MPI_COMM_WORLD, &rank)

#else

rank = MASTER_NODE;

#endif

if ( rank == MASTER_NODE){

//the rest of the code I added

}

Thanks.

Aucun commentaire:

Enregistrer un commentaire