PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Course

Floating Point Errors

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
BillR



Joined: 19 May 2006
Posts: 9

PostPosted: Tue Jan 12, 2010 7:42 am    Post subject: Floating Point Errors Reply with quote

I'm getting these errors when I try to run an old code on a 64-bit machine with the 64-bit PGI compiler:

Line 673--> chi1 = 8.0*sqrt(pi/elmass)*avg*charge**4/(3.*(2.*boltz)**1.5)
Line 674--> chi2 = log(boltz**3/(pi*avg*charge**6))

pgf77 -c -g -C -O npchemin.f
PGFTN-W-0130-Floating point underflow. Check constants and constant expressions (npchemin.f: 673)
PGFTN-W-0130-Floating point underflow. Check constants and constant expressions (npchemin.f: 674)
PGFTN-W-0132-Floating pt. invalid oprnd. Check constants and constant expressions (npchemin.f: 674)
0 inform, 3 warnings, 0 severes, 0 fatal for npchemin
PGFTN/x86-64 Linux 7.1-6: compilation completed with warnings

These are defined in a file name npcomon:

BOLTZ=1.380622D-23
PI=3.1415926536
AVG=6.022169D+26
BOLTZ=1.380622D-23

I tried changing from "E" to "D" in the constants.

This code has run fine in the past on a 32-bit SGI machine. I get the same errors using the 32-bit PGI compiler.

I get a "floating exception" error. If I add the -Ktrap=inv,unf,fp flags, I get a NaN followed by a segmentation fault.
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6636
Location: The Portland Group Inc.

PostPosted: Tue Jan 12, 2010 5:33 pm    Post subject: Reply with quote

Hi Bill,

The compiler will attempt to optimize constant expressions by calculating the expressions at compile time. Given that the code is attempting divide a very large number by a very small number (and vice-versa), the underflow is not unexpected. You might try setting the default kind for REAL constants to 8 by adding the flag "-r8". Though given the large delta, you may still get an underflow.

Quote:
I get a "floating exception" error. If I add the -Ktrap=inv,unf,fp flags, I get a NaN followed by a segmentation fault.
I think the floating point exception would be expected here since you're most liking getting an "INF" value. Again, try "-r8" to see it it helps.

- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group