Problem with OpenMP

I have a Fortran program running well if it is compiled with PGI’s PVF 15.3 with default setting, or with Auto-parallelization, or with Optimization. But it does not work with OpenMP directives enabled, even there is no OpenMP directive in the source code.

If it is compiled with OpenMP directives and Runtime | check stack bounds enabled, it runs fine (writing results out to files) before crashes, without any warning, at one subroutine. It writes outputs to file just before calling the subroutine, but does not write outputs to file at very earliest part of the subroutine.

If Runtime | check stack is not enabled, it shows a popup window with message
“Fexe.exe has stopped working. A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available. Debug or close program”
(Fexe.exe is my executable program)
When Debug is clicked, with Microsoft Visual Studio debugger, it shows
“Unhandled exception at 0x0F4812A7 (pgc.dll) in Fexe.exe: 0xC0000005: Access violation writing location 0xFFBD6B94.”


Is there something implied in OpenMP compilataion? There is no OpenMP directive in the code.

Hi Jingyu Shi,

Is there something implied in OpenMP compilataion?

Yes, automatic arrays are allocated on the stack instead of the heap.

writes outputs to file just before calling the subroutine, but does not write outputs to file at very earliest part of the subroutine.

This is indicative of a stack overflow. Try increasing the stack size. On Windows the stack size is set at link time and can be adjusted by setting the reserve and commit sizes under “Properties->Linker->General”. I’d start with large values, such as “72000000”, and then adjust as needed.

Another possibility is that you have an un-initialized variable being used to size your automatic arrays.

Hope this helps,
Mat

Thanks very much, Mat.

It seems that integer dummy argument cannot be used to define size of local arrays when OpenMP is enabled.

Jingyu

You should be able to use a dummy argument to size automatic arrays. The difference is that that those arrays are put on the stack when you add the “-mp” flag.

I’d double check what value is being used is being use for the argument and if it’s initialized.

  • Mat