I recently installed Intel's Cluster Studio, and was testing IMPI. When I try running a simple hello world program using mpirun
, the process takes forever, and I have to end it myself. I used the following code:
#include <mpi.h>
#include <iostream>
#include <stdlib.h>
int main(int argc, char *argv[]) {
MPI::Init(argc, argv);
int rank = MPI::COMM_WORLD.Get_rank();
int size = MPI::COMM_WORLD.Get_size();
std::cout << "Returned: " << system("sleep 2") << " ";
std::cout << "Hello World! I am " << rank << " of " << size <<
std::endl;
MPI::Finalize();
return (0);
}
I compiled it with mpiicpc main.cpp -o main
.
This is the output when I added -show
option:
icpc main.cpp -o main -I/opt/intel/impi/4.1.1.036/intel64/include -L/opt/intel/impi/4.1.1.036/intel64/lib -Xlinker --enable-new-dtags -Xlinker -rpath -Xlinker /opt/intel/impi/4.1.1.036/intel64/lib -Xlinker -rpath -Xlinker /opt/intel/mpi-rt/4.1 -lmpigc4 -lmpigf -lmpi -lmpigi -ldl -lrt -lpthread
I ran the executable with mpirun -np 4 main
.
Additional info:
$which mpirun
/opt/intel/impi/4.1.1.036/intel64/bin/mpirun
$mpiicpc --version
icpc (ICC) 14.0.0 20130728
UPDATE:
I also tried compiling it using g++
instead of icpc
. No luck. My guess is there is a problem with the MPI runtime, but I can't find it. Debugging didn't work. I think the program is not initializing in the first place.
If someone is still interested, I found out what was wrong. According to this link, Unlike some other MPI implementations, Intel MPI Library uses a Multi-Purpose Daemon (MPD) job startup mechanism. To run programs compiled with mpicc (or related) commands, you must first set up MPD daemons.
So, I followed the steps explained in the link, executed the mpdboot
command, and voilĂ , It works finally.