Can a private module varialbe be be assinged to threadprivate?

Can a private module varialbe be be assinged to threadprivate?

Anyone knows if a module variable with private attribute can be assigned to threadprivate in OMP? I tried this, define several such module variables as threadprivate, the compiler seems to be OK with this but the program crashes for no reason.

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

The PRIVATE attribute would have no effect on OpenMP - all it does is control the visibility of the name to program units that USE the module.

Retired 12/31/2016

A "static" variable/array/user defined typein a module can be thread private
A member variable within a user defined type cannot be thread private without the encapsulating user defined type being itself thread private. If this is not your circumstance, then you have a coding error. The usual errors relating to this is failure to initialize data that ought to have been initialized. I suggest you insert some conditional compiled asserts into your code to assure that what you assume to be true is in fact true.

Jim Dempsey

Leave a Comment

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