PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Best Debugging Compiler Options?

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



Joined: 31 Jul 2008
Posts: 2

PostPosted: Thu Jul 14, 2011 9:49 am    Post subject: Best Debugging Compiler Options? Reply with quote

Hello All
I have what I believe to be a simple question.

I'm compiling a fairly large code using pgf90 and was wondering if there are debugging compiler options that would tell me where in the
code it runs into errors (like FPEs or SegFaults). Right now I am use this
set of options (see below) and I thought -traceback should give me some information about where in the source code I experience issues. Unfortunately it just tells me I have an issue and the job terminates. Am I missing something?

F90FLAGS = -Mbounds -Minfo=all -traceback -Mchkfpstk -Mchkstk -Mdalign
-Mdclchk -Mdepchk -Miomutex -Mrecursive -Msave -Ktrap=fp -O0 -g -byteswapio

Also are there a standard set of debugging options that would be good practice to use for diagnosing runtime errors?
Thanks in advance!

-ABT
Back to top
View user's profile
mkcolg



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

PostPosted: Thu Jul 14, 2011 10:29 am    Post subject: Reply with quote

Hi ABT,

You have them all! The only thing your missing is that you need to set the environment variable PGI_TERM to tell the runtime what to do when it encounters an error. Setting it to "debug" will launch the PGI debugger, PGDBG, in text mode, while "trace" will dump a stack trace. For details please see Chapter 10 of the PGI User's Guide.

In your case, I would recommend running your code directly within PGDBG. The debugger will break on error. You can then set a break point before the error occurs. When you re-run the code, it will stop at the break point allowing you to better diagnose the error. If you are unfamiliar with PGDBG or debuggers in general, please refer to the PGDBG User's Guide.

Another useful utility is Valgrind (www.valgrind.org) which is very helpful in finding memory issues such as uninitialized memory reads (UMR).

Hope this helps,
Mat
Back to top
View user's profile
atawfik



Joined: 31 Jul 2008
Posts: 2

PostPosted: Mon Jul 18, 2011 2:16 pm    Post subject: Reply with quote

Thank you for the quick answer, Mat! It is much appreciated. I am going to try setting the environment variable to debug and see if that gives me any relief from the woes of unclear code crashes.

One last question while I have your ear. Does setting the environment variable to "debug" or "trace" also apply if I am running parallel code or is there something a little extra I need?

Thanks again.

-ABT
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Jul 18, 2011 3:14 pm    Post subject: Reply with quote

Quote:
Does setting the environment variable to "debug" or "trace" also apply if I am running parallel code or is there something a little extra I need?
Nope. PGI_TERM works with OpenMP and MPI. For MPI you just need to make sure the environment variable gets set for each process since your shell environment doesn't get inherited.

- Mat
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