Why does it take so long to complete MPI_Comm_spawn?

Why does it take so long to complete MPI_Comm_spawn?

Hi all,

I've using MPI_Comm_spawn in my code to dynamic create only one process but it takes a long time to complete (about 15s on Intel Xeon E5620 2.40GHz). I'm doing anything else but to call MPI_Comm_spawn. My simple code is:

#include <mpi.h>
#include <stdio.h>

int main(int argc, char ** argv)
        int rank;
        MPI_Comm comm_parent, intercomm;
        int errcodes;
        double t0, t1;

        MPI_Init(&argc, &argv);

        if(comm_parent == MPI_COMM_NULL){
                // Parent process
                t0 = MPI_Wtime();
                MPI_Comm_spawn(argv[0], &argv[1], 1, MPI_INFO_NULL, 0, MPI_COMM_SELF, &intercomm, &errcodes);
                t1 = MPI_Wtime();
                printf("Spawn time: %f\n", t1-t0);
                // Child process
                printf("child created\n");


$ mpiicc teste_spawn2.c -o teste_spawn


$ mpirun -n 1 -r ssh ./teste_spawn


Spawn time: 15.221280
child created

Does anyone know why?


3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Fernanda,

Please send the output from:

icc -V
mpirun -V
env | grep I_MPI
mpirun -n 1 -genv I_MPI_DEBUG 5 ./teste_spawn

I'm getting a spawn time of approximately 0.21 s with icc and IMPI 4.1 Update 2.

James Tullos
Technical Consulting Engineer
Intel® Cluster Tools


On additional testing, it appears that this occurs on every 8th rank launched on a node.  Our developers have stated that this is intentional, as a means of not overloading SSH connections.  As such, it will not be fixed.

Leave a Comment

Please sign in to add a comment. Not a member? Join today