Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with llapack and DGELS

Status
Not open for further replies.

FloatingFeather

Programmer
Apr 17, 2017
18
0
0
AR
Hi. I don't know what is causing this. I have written two different codes, and I wanted to use a subroutine I wrote, in both codes. The thing is that this subroutine calls DGELS to do some computations. But in one code it works fine, and in the other gives a wrong result. I don't really know what could be causing this, I have tried almost everything. I thought that maybe some array was ill defined or something, but the subroutine should be doing all the calculations internally, with the arrays defined inside the subroutine. Moreover, I have checked that the matrix and vectors I define to call dgels are just equally defined in both programs just before calling DGELS.

Both programs should be performing exactly the same task. I call DGELS this way:

CALL DGELS( 'N',2*totang,maxcol,1,A,2*totang,BB,maxcol,work,lwork,info)

The two subroutines are exactly equal, and I think there shouldn't be any issue with the modules I am using. However, when I print the vector BB in both programs, they give different results:

In one program it gives the correct array:

-0.383305771911842
-1.707704987396421E-002
2.265606036888344E-002
3.045356540705808E-002
3.318346674669321E-002
...


But the other gives something totally wrong:

2.414855226838399E+120
-3.551108555014026E+121
-1.463416206213795E+119
1.610216121107897E+118
9.975041298589036E+117
7.225310830463566E+117
...


But both, the matrix A, and the vector BB that I provide to DGELS are exactly the same when I print them before calling DGELS in both programs.

Any idea of what could be going on with this?
 
I have found that if I delete one subroutine in the program that is working wrong, then DGELS gives the correct result. Even if I don't call this subroutine (which is a big code which I have inserted inside my code to call), the problem occurs. The thing is that I actually need to call this subroutine at some point, any ideas on what could be originating this problem? it is very crazy that even if I don't call this subroutine I have the problem. I have compiled the code with gfortran and with ifort, and the same problem occurs with both compillers.

I don't understand how this two subroutines are interacting, and in particular how is it that LAPACK is interacting with this subroutine, being supposed to work as independent calls. This subroutines are called on different parts of the program in a very independent way, and I think I'm not sharing anything relevant in the modules that could be interfering. Actually, the subroutine that causes the problem (the big code that wasn't written by me) doesn't have any share modules with the subroutine I call where DGELS is called.
 
Ok. I have just solved the issue. There was a function call that had the same name as an internal function of llapack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top