Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Novice
62 Views

OpenMP and module: how copy a whole module in each thread

Good morning.

I am trying to parallelize my code through OpenMP.
This code is chock full of variables contained in modules shared with each other via the USE command.
Reading on the forum, I realized that I should use the Threadprivate command and put the variable name in round brackets.
However, this system is impractical, because there are a lot of variables.
Is there a way to use a copy of the whole module in each thread, without having to specify one variable at a time?
Each thread does not need to exchange the module variables with another (also because it would not be parallelizable), but each thread needs all the variables inside the modules

0 Kudos
1 Reply
Highlighted
53 Views

Place those variables in a user defined type, then instantiate a single variable of that type attributed with threadprivate. For example, you could name the variable "tls" and prefix the references to those variables with "tls%", e.g. tls%ABC

Jim Dempsey

0 Kudos