I have a runPR.sh script as below
DIR=/directory/buildagain/bin/Project
FILELIST=$1
while read FILE
do
echo "Processing ${FILE}..."
./makeInp.sh ${FILE} ${FILE} >INP/${FILE}.inp
${DIR} -PR INP/${FILE}.inp
done < ${FILELIST}
For the serial program, I run the program by typing make in /directory/buildagain and then ./runPR.sh values.txt. (values.txt just contains the line Chain)
EDIT: Here is a small portion of my code.
int main( int argc, char *argv[ ] )
{
MPI_Status status;
MPI_Init(&argc,&argv);
if( strcmp(argv[1],"-PR") == 0 )
runPR(argc-2, &argv[2]);
return 0;
}
int runPR(int argc, char* argv[])
{
cout<<"run here"<<endl;
int mynode, totalnodes;
int sum,startval,endval,accum;
int master=0;
MPI_Comm_size(MPI_COMM_WORLD, &totalnodes); // get totalnodes
MPI_Comm_rank(MPI_COMM_WORLD, &mynode); // get mynode
PROpt opt;
Solve* ps = new Solve();
cout<<"here1"<<endl;
cout<<"total nodes "<<totalnodes<<endl;
for(int j=0;j<totalnodes-1;j=j+1){
cout<<"processor"<<mynode<<" received from "<<j<<endl;
ps->getFile(&opt,argv[0]);
}
}
By typing mpirun -np 4 ../directory/buildagain/bin/Project -PR INP/Chain.inp, I see run here, here, total nodes1 printed 4 times. But I don't see cout<<"processor"<<mynode<<" received from "<<j<<endl; printed out, and I would expected total nodes to show 4, not 1. Also, the program just stops. Why is this?