Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

ABS() Error in ifort

jackosullivan2
606 Views

Having no need for GPU computing, we are using ifort to maintain and enhance engineering code that dates from the 1960s.  It has been very well behaved, very fast, and just what we need … until we encountered the following ERROR in ABS() that has appeared only recently – perhaps within the past year.

 

      DO 301 IP=1,NUMPIP

      DUMY = 0.

 

      XNF = NF(IP)

      PDX = SL(IP)/XNF

      AVC = PDX/DT

      DUMY=ABS(AVC-AV(IP))/AV(IP)    

      AV(IP)=AVC

 

At this point in the computation debug hovering in Visual Studio shows:

              AVC = 3118.20822518093

              AV(IP) = 3118.20822518093

              AVC-AV(IP) = 0.000000000000000D+000

     BUT      DUMY = 0.151695862418249 

        Which fails the following test, and kills the run

ANY IDEAS ON WHAT COULD BE GOING WRONG?

 

      IF(DUMY.LE.0.1) GO TO 301

 

         Otherwise ….<Abort the run>….

 

 301  CONTINUE

 

 

Fortran Command Line is:

/nologo /debug:full /Od /I".\lib\\" /I".\rc\\" /fpscomp:filesfromcmd /fpscomp:ioformat /fpscomp:logicals /fpscomp:general /warn:errors /warn:unused /warn:interfaces /real-size:64 /Qsave /align:rec8byte /align:dcommons /assume:dummy_aliases /Qinit:zero /fpe:0 /Qftz /iface:cvf /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc170.pdb" /FAs /Fa"Debug\\" /list:"Debug\YCE099.lst" /traceback /check:bounds /check:format /libs:qwin /c

Runing in the following Visual Studio Environment:

Microsoft Visual Studio Professional 2022

Version 17.11.5

VisualStudio.17.  Release/17.11.5+35327.3

Intel® Fortran Compiler   2023.2

Intel® oneAPI DPC++ Compiler   2023.2

Intel® oneAPI Menu & Samples   10.10.392.9731

Intel® oneAPI Visual Studio Menu & Samples Extension

 

Microsoft JVM Debugger   1.0

0 Kudos
1 Solution
jackosullivan2
344 Views

Thank you, Steve.  Excellent advice, which indeed solved my problem.  I may turn that into a screensaver!  

While recomposing for a reproduce, (after a good night's sleep) I discovered that I was unintentionally redefining the AV(IP) before my debug breakpoint, which resulted in the erroneous hover values.  That corrected, all is now fine.

Thank you and Andrew so much indeed for your incredibly valuable ongoing (eternal? : -) attention to and care for the Fortran community!!

God bless!!!

View solution in original post

4 Replies
andrew_4619
Honored Contributor III
536 Views

From the description this looks baffling however such things always omit the key pieces of information, if you knew what those were  you wouldn't be asking! Some things  stand out:

1] from the limited snippet AVC and AV(IP) seems to result from different floating point calculations, it seems strange that they should have identical values to 15 significant figures , that seems suspicious. Do you have any equivalence or aliasing of arrays?

2] You have an array of obscure  options, FPF really? Powerstation departed more than 20 years ago. Qsave, Qinit etc suggested you have lots of bad things in your code.

I think you need to create a small but complete reproducer code that show the problem so that other can look at it. Small code fragments and narrative doesn't give much for anyone to realistically go on.

 

0 Kudos
jackosullivan2
464 Views

Thank you very much, Andrew, for your assessment.  There are, no doubt, "lots of bad things" in the code, which as indicated has morphed over the past 60 years, even PowerStation being one of those disruptive upgrade "improvements" 

No EQUIVALENCE or ALIAS statements in the entire solution.  AVC and AV(IP) have identical values because they have both been calculated the same way from the same values at different points in the algorithm.

I'll attempt to create a freestanding sample. Meanwhile ...

I seem to recall from long-ago discussions that there might perhaps be some form of computational anticipation involved.  Might that be the case?  And If so, is there a way to force all prior calculation to be finished before proceeding to the ABS() statement?

Thanks again for your time and attention!  And of course ...

God bless!!!

0 Kudos
Steve_Lionel
Honored Contributor III
364 Views

Don't try to guess what the problem is - come up with a reproducer. My experience is that often the task of doing that leads to a recognition of what is wrong in the code.

0 Kudos
jackosullivan2
345 Views

Thank you, Steve.  Excellent advice, which indeed solved my problem.  I may turn that into a screensaver!  

While recomposing for a reproduce, (after a good night's sleep) I discovered that I was unintentionally redefining the AV(IP) before my debug breakpoint, which resulted in the erroneous hover values.  That corrected, all is now fine.

Thank you and Andrew so much indeed for your incredibly valuable ongoing (eternal? : -) attention to and care for the Fortran community!!

God bless!!!

Reply