Could anyone point out the cause of the errors? I called through mpiexec -n 1 python master.py
from mpi4py import MPI
import os
mpi_comm = MPI.COMM_WORLD
mpi_rank = mpi_comm.Get_rank()
executable = "./mpi_hello_world"
intercomm = MPI.COMM_SELF.Spawn(executable, args=[""], maxprocs=2)
intercomm.barrier()
intercomm.Disconnect()
mpi_comm.Disconnect()
#include <mpi.h>
#include <stdio.h>
int main(int argc, char** argv) {
MPI_Comm intercomm;
MPI_Init(&argc, &argv);
MPI_Comm_get_parent(&intercomm);
printf("%d \n",MPI_Comm_get_parent(&intercomm));
int world_size;
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
int world_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
char processor_name[MPI_MAX_PROCESSOR_NAME];
int name_len;
MPI_Get_processor_name(processor_name, &name_len);
printf("Hello world from processor %s, rank %d out of %d processors\n",
processor_name, world_rank, world_size);
MPI_Comm_get_parent(&intercomm);
if (intercomm != MPI_COMM_NULL) MPI_Comm_disconnect(&intercomm);
MPI_Finalize();
}