On 7 September 2010 17:08, Allen Zhao <a.zhao_at_[hidden]> wrote:
> Â Hi, All,
> A newbie question:
> Suppose that I have a main executable (a non-MPI code, which just
> dynamically loaded a named share library), and I do compile the shared
> library with mpi-gcc. This way, when the main executable loads the shared
> library, what is going to happen?
Should work just fine. This is the way I use many MPI-based libs and
MPI itself from Python. However, make sure you dlopen() libmpi.so with
mode RTLD_GLOBAL, or things can co bad (this is the case with
> Can I parallel this application without calling MPI_Init() inside the main
> code, instead, I call MPI_Init() when the shared library is loaded by the
> main executable?
> Will it then be able to run in parallel?
Unlikely. But you could use MPI_Comm_spawn() to spawn a new
application, then your main sequential code "chats" to the child
parallel app using MPI calls.
> If this scenario
> is possible, when should I call MPI_Finalize()?
When you know you will not use MPI any more. Perhaps you could
register a finalizer using atexit()...
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)