OpenMP and pointers

OpenMP and pointers

I'm having some problems with OpenMP. I tried to compile a code with OpenMP support and it crashes.

In my code there are these lines

if(associated(concurrent_list%element_id)) then
end if


type concurrent_elements_list_type
integer,dimension(:),pointer :: element_id
integer,dimension(:),pointer :: local_node
end type concurrent_elements_list_type

When I compile with OpenMP support and run the code, it tries to deallocate concurrent_list%element_id even if the pointer is not associated, thus giving an error:

Deallocate error 493: Array was not created by ALLOCATE

I use the following compiler/linker flags:

-O3 -tpp7 -cm -w -xW -ipo -openmp

The error appears on a completely serial code (still no OpenMP directives). The code works well with

-O3 -tpp7 -cm -w -xW -ipo

Does anyobody have a similar problem?

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

It's hard to analyze without a complete test case. However, the primary difference when you recompile a serial program (without OpenMP directives) with -openmp is that the default memory allocation for locally declared arrays changes from static to automatic (on the stack). This is done, so that thread private copies of arrays can be generated on the thread stack if necessary. To verify if this is the cause, you could recompile with -auto instead of -openmp.
You should make sure that you have a large enough stacksize.
You can use the SAVE statement to keep static any arrays that you know will only be accessed in shared mode, or you can compile with -save if all arrays are shared. (But if you SAVE an array which needs to be thread private, you may get runtime errors).
If you can't find an inconsistency in your program when the arrays are allocated on the stack, you can submit an issue with a complete (ie, buildable and executable) test case to Intel Premier Support.


Leave a Comment

Please sign in to add a comment. Not a member? Join today