failed to poll for a spawned proc

I am having problem running an openmpi program. It kept on giving me this error:

[opto023:31621] pls:tm: failed to poll for a spawned proc, return status = 17002
[opto023:31621] [0,0,0] ORTE_ERROR_LOG: In errno in file ../../../../../orte/mca/rmgr/urm/rmgr_urm.c at line 462
[opto023:31621] mpirun: spawn failed with errno=-11

I after I searched in the net, it might be due to OpenMPI and Torque problem.
check this forum.

The problem is solved by submitting the job using -S option

$qsub -S /bin/sh paralleljob.pbs

Send/receive C++ vector using MPI

I am using IT++ for some of my code and I tried to parallelize it. It came to the point where I need to sum up all the vectors from all the process. So in MPI, I will need to use MPI_Reduce. My question is since IT++ vector is not an array, can we then use MPI_Reduce with “count” parameter or do we need to define a new MPI data type to handle it?

It turns out that C++ std::vector stores the data contiguously similar to Array [1]. And IT++ vector uses std::vector of C++ standard. Hence, we can use a similar technique as Array.

this is a simple test code:

#include "mpi.h"

using namespace itpp;
int main(int argc, char** argv)
int my_rank;
int p;


vec test(3),result(3);
if (my_rank==0)
test(0)=1; test(1)=2; test(2)=3;
test(0)=4; test(1)=5; test(2)=6;
MPI_Reduce(&test(0),&result(0), test.length(), MPI_DOUBLE,
std::cout<<"test from "<<my_rank<<" :"<<test<<"\n";
std::cout<<"result from "<<my_rank<<" :"<<result<<"\n";

The code basically creates vector “test” and store {1,2,3} in root process and {4,5,6} in other process. After that the vector is summed up in root process and displayed. To compile this, I need to include the MPI header file and IT++ header files and libs (I also used Boost library to modify my IT++ source code)

mpicxx -I/usr/lib/openmpi/include -I/home/kurniawano/local/include -I/home/kurniawano/Download/NumericalComputation/boost_1_36_0 -L/home/kurniawano/local/lib -litpp testmpivec.cpp

Then I ran the code in two processes using

mpirun -np 2 ./a.out

The output is:
test from 1 :[4 5 6]
result from 1 :[0 8.44682e+252 5.31157e+222]
test from 0 :[1 2 3]
result from 0 :[5 7 9]

So you can see that the result in root (0) is a summation of the vector from the two processes.


Compiling C++ code with MPI for parallel processing

#include "mpi.h"
int main(int argc,char** argv)

then compile with

to run it, use
mpirun -np 4 ./a.out
for using 4 copies in 4 processors.