The Quantum Physicist
The Quantum Physicist

Reputation: 26256

C++: Private static variables in OpenMP

How can I make static variables and functions (from a templatised class) private in OpenMP to have different values in each thread?

Upvotes: 3

Views: 2526

Answers (1)

Reed Copsey
Reed Copsey

Reputation: 564333

Depending on the scenario, you should be able to use:

#pragma omp threadprivate(theVariable) 

For details, see this article on using Thread-local Storage in OpenMP.

Upvotes: 3

Related Questions