ccygwinmpimingwopenmpi

C language mpirun running error from cygwin


I try to run an C language MPI program using cygwin environment (console). The compilation process works fine, but I get an error when I try to run the output program. What I configured by now:

But about the code - a simple piece of code

#include "mpi.h"
#include <stdio.h>
int main( int argc, char *argv[] )
{
int rank, size;
MPI_Init( &argc, &argv );
MPI_Comm_size( MPI_COMM_WORLD, &size );
MPI_Comm_rank( MPI_COMM_WORLD, &rank );
printf( "Hello World! I am %d of %d\n", rank, size );
MPI_Finalize( );
return 0;
}

In the cygwin console, the compilation

mpicc file.c -o file

works fine and ends without any error. But the problem occurs when I try to run it with

mpirun -np 2 ./file

The error is:

[DESKTOP-3F9P53V:01959] [[INVALID],INVALID] FORCE-TERMINATE AT Not found:-13 - error /pub/devel/openmpi/v4.0/openmpi-4.1.5-1.x86_64/src/openmpi-4.1.5/orte/mca/plm/rsh/plm_rsh_component.c(335)

Looks like something is missing, but I don't know what. What other packages should I download? I reinstalled the openmpi package but no changes. Or the trouble comes from the versions of some cygwin packages ? (also, as a mention, the source for the packages is mirrors.kernel.org)


Solution

  • The expected behavior is

    $ mpicc -Wall prova.c -o prova
    
    $ mpirun -n 2 ./prova
    Hello World! I am 1 of 2
    Hello World! I am 0 of 2
    

    and your code works on my system. There is no need of Mingw on your PATH. To clean the PATH and test the program in a clean Cygwin enviroment you can run it as

    $ PATH="/usr/bin/" mpirun -n 2 ./prova
    Hello World! I am 0 of 2
    Hello World! I am 1 of 2
    

    You can also check that the packages are properly installed and nothing is missing with

    $ cygcheck -c openmpi libopenmpi40
    Cygwin Package Information
    Package              Version        Status
    libopenmpi40         4.1.5-1        OK
    openmpi              4.1.5-1        OK