Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29276 Discussions

Can a private module varialbe be be assinged to threadprivate?

stydofe1
Beginner
443 Views

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.

0 Kudos
2 Replies
Steven_L_Intel1
Employee
443 Views
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.
0 Kudos
jimdempseyatthecove
Honored Contributor III
443 Views
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
0 Kudos
Reply