I am trying (and failing!) to track down what is probably a bug in some
openmp code, which only materializes at -O3 optimization, running just
fine at O2.
Trying to run the O3 executable with pgdbg yields all sorts of problems
in integer indirect indexing arrays which don’t have right values inside
openmp loops, but which work ok at lower optimisation, including in pgdbg,
and which look correct (I have double-checked data-scoping etc).
Might anyone have a suggestion about a clever way of tracking down my
Thanks for reading
When I encounter these types of issues, I like to do a binary search to determine which file causes the error. i.e. compile half with -O2, the other half with -O3. if it fails, re-compile half of the -O3 at -O2. if it succeeds compile half of the -O2 at -O3. Repeat until you find the file.
Once you’ve isolate the file, you can use the “opt” directive to select the optimization for individual subroutines. In Fortran, “!PGI$ OPT 2” or in C “#pragma opt 2”. Repeat the binary search but on the individual subroutines.
Hopefully you can then use the debugger to pinpoint the error. Note that since it’s an optimization issue, there is a good chance that it’s actually a problem with the compiler. If you suspect this, please send a reproducing example to PGI Customer Support (firstname.lastname@example.org) so we can investigate.
thanks for the answer. I will try what you describe, it sounds like a good way of locating my problem. If it does turn out to look like a compiler optimisation problem, I will do my best to provide a (more simple!) reproducer.
Hi again Mat,
sent an email to trs, as indeed my behaviour is present
in even a fairly simple case.
Thanks for your help,