Assignment 3

Assignment 3

von Ehsan Sasanianno -
Anzahl Antworten: 3

Hi,

I try to run my code on Zusie but having some issues.

I compile the code locally with "mpic++ -g -std=c++14 -O3 -o mpi mpi.cpp" and run it via "mpirun -n 4 ./mpi". On Zusie, I did the following:

  1. "mpic++ -g -std=c++14 -O3 -o mpi mpi.cpp"
    • risc47@zusie:~/exc_2> mpic++ -g std=c++14 -o test 1_mpi.cpp

      If 'mpic++' is not a typo you can run the following command to lookup the package that contains the binary:

          command-not-found mpic++

  2. "gcc -g -Wall -lmpi mpirun.cpp -o mpirun", I see some errors:  

    • In file included from /usr/include/c++/4.3/random:40,  from 1_mpi.cpp:5:/usr/include/c++/4.3/c++0x_warning.h:36:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.

  3. I tried "g++ -g -Wall -O3 -std=c++11 -lmpi mpirun.cpp -o mpirun"
    • I see: cc1plus: error: unrecognized command line option "-std=c++11

  4. I tried "load.ExecEnv::GnuCC_12.2" then 
    • risc47@zusie:~/exc_2$ g++ -g -Wall -O3 -std=c++11 -lmpi 1_mpi.cpp -o mpirun

      1_mpi.cpp:7:10: fatal error: mpi.h: No such file or directory

          7 | #include <mpi.h>

            |          ^~~~~~~

It seems like the older versions can not compile the code and the GnuCC_12 module does not have MPI and I don't have permission to install it. I don't know how to fix it. Any help is appreciated.

Thanks!

Als Antwort auf Ehsan Sasanianno

Re: Assignment 3

von Ioan-Cristian Olariu -
Hi Ehsan,

I think you should be fine by following slide 3 in the MPI deck. Basically:
module load GnuCC/7.2.0
g++ -Wall -O3 -lmpi matmult.cpp -o matmult
 
g++ version 7.2.0 defaults to the C++14 standard level so you shouldn't have any problem with #include <random>. 
 
It looks like the MPI libraries and headers are made available on Zusie through the mpt/2.04 module which for me is loaded by default on login. If you prefer to use the MPI compiler wrapper, try mpicxx instead of mpic++.
 
I hope this helps,
Cristian
Als Antwort auf Ioan-Cristian Olariu

Re: Assignment 3

von Ehsan Sasanianno -
Thank you so much. I could compile it by loading GnuCC/7.2.0 and running "mpicxx -Wall -std=c++14 -o test test.cpp -O3".

"g++" did not compile it even by using "-std=c++14". Not sure what is the issue but here is part of the error:

/scratch/riscpk/risc47/tmp/ccmNJ76J.o: In function `PMPI::Request::Wait()':
1_mpi.cpp.text._ZN4PMPI7Request4WaitEv[_ZN4PMPI7Request4WaitEv]+0x15): undefined reference to `PMPI::Request::ignored_status'
/scratch/riscpk/risc47/tmp/ccmNJ76J.o: In function `PMPI::Request::Test()':
1_mpi.cpp.text._ZN4PMPI7Request4TestEv[_ZN4PMPI7Request4TestEv]+0x19): undefined reference to `PMPI::Request::ignored_status'
/scratch/riscpk/risc47/tmp/ccmNJ76J.o: In function `PMPI::Comm::Recv(void*, int, PMPI::Datatype const&, int, int) const':
1_mpi.cpp.text._ZNK4PMPI4Comm4RecvEPviRKNS_8DatatypeEii[_ZNK4PMPI4Comm4RecvEPviRKNS_8DatatypeEii]+0x47): undefined reference to `PMPI::Comm::ignored_status'
Als Antwort auf Ehsan Sasanianno

Re: Assignment 3

von Wolfgang Schreiner -
For using g++, use the additional link option "-lmpi++" which provides the missing library (this is what "mpicxx" does).
 
Alternatively, googling for "undefined reference to `PMPI::Request::ignored_status" shows that it is also possible to compile with option "-DMPI_NO_CPPBIND" (this prevents that the MPI CPP bindings are pulled in).