How to globally set the default clause to none?

前端 未结 1 767
天涯浪人
天涯浪人 2020-12-20 17:30

I know I can tell OpenMP not to share variables by default within a parallel region by using

#pragma omp parallel default none

But is there

相关标签:
1条回答
  • 2020-12-20 18:04

    All variables in OpenMP are shared by default. If you want a set of private variables you will need to specify these variables in a parallel pragma directive in a private clause. If you use

    #pragma omp parallel default none
    

    You need to specify the private variables and shared variables. For instance:

    #pragma omp parallel default(none) private(i,j) shared(a,b) 
    

    References:

    [1] http://en.wikipedia.org/wiki/OpenMP#OpenMP_clauses

    [2] https://computing.llnl.gov/tutorials/openMP/#ClausesDirectives

    0 讨论(0)
提交回复
热议问题