PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

"Maximum debug" flags with PGI compiler

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Debugging and Profiling
View previous topic :: View next topic  
Author Message
dcwarren



Joined: 18 Jun 2012
Posts: 29

PostPosted: Tue May 07, 2013 8:06 am    Post subject: "Maximum debug" flags with PGI compiler Reply with quote

Hello,

I'm trying to get some legacy code to *not* crash and burn with the PGI compiler, and I came across a stack overflow post (edit: this one) that recommended a so-called "maximum debug" collection of compiler options for gfortran:
Code:
-O2 -fimplicit-none -Wall -Wline-truncation -Wcharacter-truncation -Wsurprising -Waliasing -Wimplicit-interface -Wunused-parameter -fwhole-file -fcheck=all -fbacktrace

What are the PGI equivalents to most of these?
  • -O2: -O2
  • -fimplicit-none: -Mdclchk?
  • -Wall: -Minform=inform? The gfortran compiler seems to have a lot more specific things it can warn about than the PGI compiler, such as...
  • -Wline-truncation, -Waliasing, -Wimplicit-interface, -Wunused-parameter: ??
  • -fwhole-file: ??
  • -fcheck=all: -Mbounds? (Which is itself equivalent to -C, right?)
  • -fbacktrace: -traceback

I'm already using the PGI-specific flag -Ktrap=fp,unf in my quest to get this code working. Are there any other flags you would suggest for maximum debugging?

While I have you, I'm having trouble getting -traceback to actually give a line number. I have to be using the PGI debugger in order to get the proper trace, which is a bit surprising to me (I am compiling with -g if that makes a difference). Is there a way to have the program write the trace to the display unit? Thanks in advance for the help.
Back to top
View user's profile
mkcolg



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

PostPosted: Tue May 07, 2013 1:46 pm    Post subject: Reply with quote

Hi dcwarren,

Quote:
-O2: -O2
Roughly, but not exactly. Though, I would not compile with optimization at all and use "-O0" instead,

Quote:
-fimplicit-none: -Mdclchk?
-Mdclchk checks that all your variables have been declared, so yes it's equivalent to -fimplicit-none"

Quote:
-Wall: -Minform=inform
Yes, but this can get very verbose.

Quote:
-fwhole-file
This is the default for both gfortran and PGI.

Quote:
-fcheck=all
-Mbounds -Mchkptr -Mchkstk

Quote:
-fbacktrace: -traceback
-traceback is on by default. You just need to set the environment variable PGI_TERM to "trace" or "debug". Though, you may also need to add the link flag "-Meh_frame" in order to get the linker to not throw away the exception handling frame information.

Another useful utility is Valgrind (www.valgrind.org) which is able to find memory issues such as UMRs.

- Mat
Back to top
View user's profile
dcwarren



Joined: 18 Jun 2012
Posts: 29

PostPosted: Wed May 08, 2013 6:55 am    Post subject: Reply with quote

Thanks for this. I'm not sure why the guy on Stack Overflow recommended compiling with -O2, but I don't set any optimization when I do debugging. (I'll be specifying -O0 in the future!)
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Debugging and Profiling 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