Atomic [2.8.5]
The atomic construct ensures that a specific storage location is updated atomically, rather than exposing it to the possibility of multiple, simultaneous writing threads.
atomic结构保证了一个特定存储位置被原子性的更新,而避免多线程同时写访问的可能性。
具体用法:
#pragma omp atomic [read | write | update | capture]
expression-stmt
#pragma omp atomic capture
structured-block
Flush [2.8.6]
The flush construct executes the OpenMP flush operation, which makes a thread’s temporary view of memory consistent with memory, and enforces an order on the memory operations of the variables.
flush结构执行了OpenMP刷出操作,使得线程的内存视图与实际内存一致,并且在变量的内存操作中强加一个顺序。
具体用法:
#pragma omp flush [(list)]
Ordered [2.8.7]
The ordered construct specifies a structured block in a loop region that will be executed in the order of the loop iterations. This sequentializes and orders the code within an ordered region while allowing code outside the region to run in parallel.
ordered结构规定了循环区域中的结构模块,会以循环迭代的顺序来执行。这使得在ordered区域内的代码序列化,同时允许区域外的代码并行运行。
具体用法:
#pragma omp ordered
structured-block
Threadprivate [2.9.2]
The threadprivate directive specifies that variables are replicated, with each thread having its own copy.
threadprivate定义规定了变量被复制而且每一个线程有该变量自己的拷贝。
具体用法:
#pragma omp threadprivate(list)
list:
其中的list可以是如下的:
A comma-separated list of file-scope, namespace-scope, or static block-scope variables that do not have incomplete types.
一个由逗号隔开的文件范围、命名空间范围或者静态块范围变量的序列,序列中没有不完整的类型。
