Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: [OMPI users] MPI process launch without "MPI_Spawn"
From: Rozzen.VINCONT_at_[hidden]
Date: 2007-12-06 06:05:45


Working with different MPI flavours, I have encountered limits when using MPI_spawn and threads.

The limit is that the number of spawns that can be made is limited. Over a given limit the application crashes.

I am trying to overcome the limitation but launching a new process that will make the spawn
in place of the initial mpi process.

I actually fail to launch the "launching process" when it is a MPI process. If it is a "classic" program
it works.

I tried to launch the "launching" process with the "system" call and the "fork-exec" call.
If the launced program is a non mpi program all works fine. If it is a mpi program
it fails to run.
This has been overcome using ssh to run the mpi program but it not satisfactory.

Follows a short example of one of the different tries.

FYI a try without using MPI_THREAD... has also been made leading to the same results.

Solution 1:start with "mpiexec --mca btl_tcp_if_exclude lo,eth1 --hostfile hostfile.txt -n 1 Test"
*first process : solution1.c build :mpicc -g -Wall solution1.c -o Test
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/types.h>
#include <fcntl.h>
#include "mpi.h"
#include <unistd.h>

int main(int argc, char *argv[]){

    int ThreadLevelWanted=MPI_THREAD_MULTIPLE;
    int ThreadLevelNew=MPI_THREAD_MULTIPLE;

    printf("MPI_Init_thread start\n");
    if(MPI_SUCCESS!=MPI_Init_thread( &argc,
        &ThreadLevelNew )){
        printf("** ERROR **\n");
        return -1;

    printf("system return : %i\n",
        system("/usr/bin/mpiexec --mca btl_tcp_if_exclude lo,eth1 --hostfile hostfile.txt -n 1 ExeToStart");

    sleep (100);

    printf(" byebye ");
    return 0;

*Second process : ExeToStart.c build :mpicc -g -Wall ExeToStart.c -o ExeToStart
#include <stdio.h>
int main( int argc, char **argv ) {

        sleep (20);

This test program doesn't start the second process;

If I don't make the "MPI_Init_thread" at the beggining of the first process there is no problem, but I need a MPI environnement for the two processes.

Thank you for you help.