[Omp] Passing private arrays to subroutines

Meadows, Lawrence F lawrence.f.meadows at intel.com
Wed Jan 10 00:14:00 PST 2007


Can you be more specific? Fortran pointers? Real (f90-style) fortran pointers or cray-style pointers? Do you have a simple example that fails?

Private allocatables must be unallocated on entry to a parallel region (2.8.3.3 of the 2.5 specification).
Pointers need to be associated within the parallel region, just like any private variable. Also note the restrictions on firstprivate for pointers (2.8.3.4).

So really, you need to allocate and/or associate any pointer-based private objects after entering the parallel region, and deallocate them before exiting the region (assuming they were allocated) to avoid memory leaks.

OpenMP doesn't change any of the rules about when interfaces are required.

Good Fortran style is to put everything in modules and use them; then you don't need interface blocks.

Hope this helps. As I say, send us an example and we can tell you what is wrong.

-- Larry
 

-----Original Message-----
From: omp-bounces at openmp.org [mailto:omp-bounces at openmp.org] On Behalf Of Håkan Lane
Sent: Tuesday, January 09, 2007 2:40 PM
To: omp at openmp.org
Subject: [Omp] Passing private arrays to subroutines


I have tried for several days now to pass a set of pointers made private by !$OMP parallel private from a do-loop in a calling routine in one module to a subroutine in another. No matter how I do it, I seem to get a segmentation fault sooner or later. I can not see the logic as to where they occur.

I would be grateful if someone could provide the rules for this. I have tried both with pointers and allocatable, but it does not work. 

Please let me know what I need to in terms of interfaces (not necessary in the serial version), allocation and deallocation and directives.

Håkan Lane


-- 
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com

Powered by Outblaze
_______________________________________________
Omp mailing list
Omp at openmp.org
http://openmp.org/mailman/listinfo/omp


More information about the Omp mailing list