[Beowulf] Refactoring an MPI code to call from another MPI code

Navid Shervani-Tabar nshervt at gmail.com
Sat May 5 22:10:46 PDT 2018

Dear All,

I have a question which is more on the software side, and I was advised
that I might find people with related expertise here.

I have two programs Main and Solver, each of which uses MPI for parallel
processing. I am keeping Main as the main code and am modifying Solver as a
subroutine which is being called by Main.

The problem arises when both codes initiate the MPI (since both were
originally standalone programs) and then each have their own parallel
structure, which leads the code to crash as MPI_init can only be called
once in the now combined program.

I thought this must have been a common problem and there should be
discussions on how to approach this; However, to my surprise, I couldn't
find anything with this setting on common websites like stackoverflow and
the archives of this mailing list.



PS1: When connecting the two codes, I decided to call Solver by Main rather
than running the Solver as an executable by Main to have a more optimized
and robust setting and also avoid the overhead.

PS2: Code Main is written in c++ and code Solver is written in Fortran.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.beowulf.org/pipermail/beowulf/attachments/20180506/57e80973/attachment.html>

More information about the Beowulf mailing list