[petsc-users] Refactoring an MPI code to call from another mpi code

Navid Shervani-Tabar nshervt at gmail.com
Sat May 5 19:51:55 CDT 2018


Dear All,

I have a question 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 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 any related topics on common websites like stackoverflow and the
archives of this mailing list.


Thanks,

Navid

PS1: When connecting the two codes, I decided to call Aux by Main rather
than running the Aux as 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 Aux is written in Fortran.

PS3: The Main code was originally using Deal.II as solver.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180505/253dc994/attachment.html>


More information about the petsc-users mailing list