For Programmers: Free Programming Magazines  


Home > Archive > Fortran > May 2004 > Re: Module variables in openmp









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Module variables in openmp
Claus Pedersen

2004-05-12, 9:09 pm

On Thu, 6 May 2004, Shriram Ramanathan wrote:

--- 8< 8< 8< ---------

> For some reason, I am trying to openmp parallelize the outer most loops of
> my code. So, the code goes something like :
>
> ****************************************
**
>
> program main
> do i = 1, N (This needs to openmp parallelized)
> call sub1(....)
> call sub2(....)
> call sub3(....) AND SO ON....
> enddo
> end program main
>
>
> module subroutines_module
> contains
> subroutine sub1(....)
> use data_module
> ** Operate on arrays data1, data2 etc. defined in data_module ***
> end subroutine sub1
> end module subroutines_module
>
>
> module data_module
> ** Define arrays data1, data2 etc.
> end module data_module
>
> ****************************************
**
>
> Now, here is the problem - I need to make sure that all the data defined
> in data_module (data1, data2) are actually private.


--- 8< 8< 8< ---------

> Question : Is there any easy way of making sure that all module variables
> defined in data_module end up being private to each thread ?


You may be able to do the following:

Include the line "USE data_module" in you main program and remove it from
your subroutines_module.
Then you should be able to declare your data arrays PRIVATE in your openMP
clauses (notice the difference between the PRIVATE and the FIRSTPRIVATE
clauses and that declaring variables private consumes large amounts of
memory).

Best regards,
Claus Pedersen

--
Stud. Polyt. Claus Pedersen,
Dept. of Communication Technology, Inst. of Electronic Systems,
Aalborg University, Aalborg, Denmark.
E-mail: cped00@kom.aau.dk

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com