Can someone explain why even when I set the number of process to more than 1 only two process child are created in the code below. Each MPI_Comm_spawn can create two child process using the code below, in the code used each process created with mpirun will call MPI_Comm_spawn once and will create 2 (#define NUM_SPAWNS 2) child process, so if I call N process then childs 2*N process child must be created. But this does not happen.
In the example below the number of the children must be 4 * 2 = 8. But...
for example:
:~$ mpirun -np 4 ./spawn_example
output:
I'm the parent.
I'm the parent.
I'm the parent.
I'm the parent.
I'm the spawned.
I'm the spawned.