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

Conditional Shared/Private in OpenMP parallel region?

David_DiLaura1
New Contributor I
446 Views

Steve, Colleagues:

For an OpenMP parallel-do loop, I would like an array to be either private or shared, depending on a determination that includes an assessment of its size and the computational work required to  determine its values. If the amount of work involved is large, I want to determine the array contents before I drop into the parallelized loop. In other circumstances, it's better to have a private copy of the array, and do the work in each loop iteration. Is there a way to make OpenMP clauses conditional?   I could duplicate the code of the entire loop in two if-clauses, the branching depending on the assessment of the array in question, but it seems like poor craftsmanship.

David

0 Kudos
1 Reply
Steven_L_Intel1
Employee
446 Views

OpenMP variable attributes are compile-time constant. You can't make them dependent on a run-time test. It sounds to me as if you'll need two loops.

0 Kudos
Reply