Call to IMSL library in a Fortran program with MPI

I am trying to parallelize a Fortran 77 program that I compile and run on a Linux cluster using PGI. The program calls an IMSL function, DRLSE. The serial version works fine. With mpi statements added to the program, it hangs when the call drlse statement is included, runs fine without it. The call statement is:

call drlse(nob,v,n,x,nob,1,coef,sst,sse)

The parallel compile and run statements I use are listed below.

$MPIF90 $F90FLAGS test.f $LINK_MPI
mpirun -np 4 -nolocal a.out

The serial compile statement is

pgf90 $F90FLAGS test.f $LINK_F90

I call another IMSL routine: call rnset(iseed), and use imsl routines to generate random numbers. These do not cause any problem in the parallel version.

Any idea what could be causing this?


I guess the infinitely could come from nob.

Is it possible for you to make a copy of nob to some variable, say, nop2? Then call drlse like:

call drlse(nob, v,n,x,nob2,1,coef, sst,sse).

You are passing nob twice, in Fortran arguments are passed by reference, if the value of the second nob gets changed, then it could get infinite loop if nob is used as a loop count.


My mistake. The call statement is actually

call drlse(nob,v,n,x,nind,1,coef,sst,sse)

So nob is not passed twice.


Is it possible for you to debug the code and tell us where it hangs? Try running just 2 processes and attach to both processes to see stack frames(“where” should be enough).

Which version of compilers and IMSL do you use? I assume you use IMSL compile with PGI compilers? What are your F90FLAGS and LINK_F90 flags.