Hello, I have what it could be a memory corruption with MPI_Get_processor_name() in Cygwin. I’m using OMPI 4.1.0; I tried also in Linux (same OMPI version) but there isn’t an issue there. Below the example of a trivial spawn operation. It has 2 scripts: spawned and spawner.
In the spawned script, if I move the MPI_Get_processor_name() line below MPI_Comm_size() I lose the values of rank and size. In fact, I declared some other variables in the int hostName_len, rank, size; line and I lost them too. Regards, Martín --- Spawned: #include "mpi.h" #include <stdio.h> #include <stdlib.h> int main(int argc, char ** argv){ int hostName_len,rank, size; MPI_Comm parentcomm; char hostName[200]; MPI_Init( NULL, NULL ); MPI_Comm_get_parent( &parentcomm ); MPI_Get_processor_name(hostName, &hostName_len); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); if (parentcomm != MPI_COMM_NULL) { printf("I'm the spawned h: %s r/s: %i/%i\n", hostName, rank, size); } MPI_Finalize(); return 0; } Spawner: #include "mpi.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char ** argv){ int processesToRun; MPI_Comm intercomm; if(argc < 2 ){ printf("Processes number needed!\n"); return 0; } processesToRun = atoi(argv[1]); MPI_Init( NULL, NULL ); printf("Spawning from parent:...\n"); MPI_Comm_spawn( "./spawned", MPI_ARGV_NULL, processesToRun, MPI_INFO_NULL, 0, MPI_COMM_SELF, &intercomm, MPI_ERRCODES_IGNORE); MPI_Finalize(); return 0; }