-1

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:

  • I use cygwin environment, here is the installed packages: enter image description here

  • also, I downloaded and added mingw to the user path: enter image description here

  • as you can see cygwin bin is also added to the path

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)

matzeri
  • 8,062
  • 2
  • 15
  • 16
dacian
  • 95
  • 1
  • 8
  • I don't understand. Why tag C++? Your post is about the C language. They are distinct languages. For example, C++ has function and operator overloading, C doesn't. Are you mixing the languages? Not advised unless necessary. – Thomas Matthews Apr 29 '23 at 16:59
  • @ThomasMatthews you're right, sorry for this mistake – dacian Apr 29 '23 at 17:15
  • 1
    try installing the `openssh` package. – Gilles Gouaillardet Apr 29 '23 at 17:44
  • @GillesGouaillardet after I installed openssh, the code runs now (I can see the prints in the console), but some things still have troubles; together with the effective output (from printf), the console also print: – dacian Apr 29 '23 at 17:56
  • PMIX ERROR: ERROR in file /pub/devel/openmpi/v4.0/openmpi-4.1.5-1.x86_64/src/openmpi-4.1.5/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c at line 168 PMIX ERROR: ERROR in file /pub/devel/openmpi/v4.0/openmpi-4.1.5-1.x86_64/src/openmpi-4.1.5/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c at line 168 – dacian Apr 29 '23 at 17:58
  • also @ThomasMatthews what should I do to run mpi on the a cpp program (I need C++ because I want to use opencv and I don't think that C support opencv)? I tried with mpicc cppfile.cpp -o cppfile, but I receive some errors: /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /tmp/ccT307Zu.o:lab4cpp.cpp:(.text+0xa2): undefined reference to `std::ios_base::Init::Init()'; I know that .cpp should be compiled with gcc but if I use gcc, then then how could I tell to the program to use mpicc? (If I compile with gcc then other errors related to MPI occurs) – dacian Apr 29 '23 at 18:11
  • I can't answer about `mpi` because I haven't used it. Maybe somebody other than I can answer it. – Thomas Matthews Apr 29 '23 at 18:13
  • @ThomasMatthews I found out that there exists mpic++ command, e.g. mpic++ cppfile.cpp -o cppfile but the compilation end with an error: /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lmpi_cxx: No such file or directory; looks like another thing is missed, this time seems to be related to gcc, do you have about the missed thing - maybe I missed another package? – dacian Apr 29 '23 at 18:18
  • before running `mpirun` try `export PMIX_MCA_gds=^ds12` – Gilles Gouaillardet Apr 30 '23 at 02:52
  • @GillesGouaillardet the error '... cannot find -lmpi_cxx' still exists after I used your command; but this error appear when I use mpic++, so I don't even reach the mpirun part – dacian Apr 30 '23 at 10:42

1 Answers1

0

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
matzeri
  • 8,062
  • 2
  • 15
  • 16
  • hello @matzeri; I already solved the problem related to the C language, but now I have some troubles related to the compilation for the C++ version of the code (with iostream); you can check the comments from the first post (basically, I get an '... cannot find -lmpi_cxx' error when I compile cpp file using mpic++); ALSO, i check the installated status for openmpi packages (as in your example), and for libopenmpi40 that status is Incomplete - how can I fix this? – dacian Apr 30 '23 at 11:21
  • update: after I reinstalled the libopenmpi40 package, now the status is OK for both packages but still I get errors when I m using mpic++: it cannot find -lhwloc, -levent_core, -levent_pthreads, -lz – dacian Apr 30 '23 at 11:27
  • That is a different thing and it is due to `pkg-config` and the content of `/usr/lib/pkgconfig/ompi-cxx.pc`. You should install `libhwloc-devel, libevent-devel, zlib-devel` – matzeri Apr 30 '23 at 11:34
  • I added these packages and now the problem is solved ! thank you ! I'll reward your post, also many thanks to Gilles and Gilles Gouaillardet and Thomas Matthews – dacian Apr 30 '23 at 12:26