i am using the routine tqli from the book Numerical Recipes (www.physics.sdsu.edu/~johnson/phys580/tqli.c) since several years without any problems on different processors and different compilers. I have a new computer with i7-4790K.
Now this routine hangs somtimes. With same input values sometime it works and sometimes it hangs in an infinite loop.(the while lopp nerver ends)
The code is compiled with intel c++ compiler v14 but it also happens with the newest v15.
This are compiler options: /Zi /nologo /W1 /MP /O3 /Ot /EHsc /MD /Zp16 /GS- /fp:precise /Zc:wchar_t /Zc:forScope /Qopenmp /Qstd=c++11
I have replaced tqli with dsteqr from MKL. But this routine also sometimes works and somtimes fails.(with same input datas)
dstevd from MKL works fine. I do not have any problems yet.
Any idea what causes the problems on a i7-4790? The computer is not overclocked.All components of the computer(includeding RAM) are tested and work fine.
The problem could be in the way you define the arrays passed into the function. In particular, if you are calling it in an OpenMP parallel region, you must assure that each thread has its own non-overlapping copy of each array, so as not to create a race condition.
The source file on the link you posted has some serious problems with respect to syntax (as opposed to algorithmic, which I am not commenting on).
First there is no line breaks in the source, second it is either missing pieces or has a rather unusual syntax requirement:
... #include #define NRANSI #include "nrutil.h" #include using std::cout; ...
I am not quite sure to make of this.
Can you post what you are actually using for code?
I did a paste into MS VS, I will paste into NotePad....
That didn't work either. It may be the browser (IE) window is trashing the text.
Mozilla does it right.
Yes, I see the problem with IE11. Similar problems may occur with other browsers if the remote file being viewed has inconsistent line termination (e.g., a mix of CR for some, CR+LF for other lines).
The Cygwin utility wget is a good tool to use in order to step around such problems. See, for example, https://github.com/bmatzelle/gow .
Thanks for your comments.
The tqli-routine is not called in parallel region. So i think a rat race is not the reason. If it hangs i can set a breakpoint in the routine and i see that the while loop is working but it never finds the ending condition. Some loop variables have crazy values but i don't know if the shown values are real or if the are the result of /O3 and /Zi. I have not checked it in pure debug mode.
There is still the question why it hangs on a i7-4790/4790K and on no other processors.
I use exactly this code but without NRANSI/nrutil.h and the integers are int instead of register int and i use double instead of float.
I use 64-bit
There could be any number of reasons for an old program not working as of yore on a new computer. However, in this case I have not seen anything yet to cause me to conclude that the CPU model no. is the only or even a significant player. Different OS versions, compiler runtime, etc. come to mind as other factors that may be important.
We need to see the actual code used, in full, along with any data files needed to run the code, for a case that causes a hang up.
Does it hang when you use float? Does the code run in debug build?
I note that your if(iter++ == 30) is not triggered. So, if your program is caught in and infinite look, this indicates that m==l (lower case L) at the first test, and m != l at the second test. This is contradictory. Are you sure you minor edits didn't remove or add something else?
Verify that you did not insert digit 1 for where original code had lower case L.