Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] calling a parallel solver from sequential code
From: Florian Bruckner (e0425375_at_[hidden])
Date: 2013-11-18 09:09:08


hi,

how can i call an MPI parallelized solver routine from a sequential
code. The sequential code is already existing and the structure looks
like to following:

void main()
{
    do {
          x = rand();

          sequential_code(); // this sequential code should only be
executed on the master node
          if (x == 2345) MPIsolve(); // this should be run in parallel
    } while(x == 1234);
}

i'm wondering how the call MPI-parallelized solver routine can be called
without parallelizing the whole existing sequential code. at a certain
point of the code-path of the sequential code, the parallel execution
should be started, but how can this be achived.

when starting the application with mpirun there must be some code
running on each node. and the same code-path needs to be followed by
each process. But this would mean that exactly the same sequential code
needs to be executed on each node!?

what am i missing?
thanks in advance
Florian