问题描述
引入了一个名为OMP SIMD的新结构。什么是使用这种构造在旧的并行的好处?当每一个是比其他更好的选择?
OpenMP 4.0 introduces a new construct called "omp simd". What is the benefit of using this construct over the old "parallel for"? When would each be a better choice over the other?
编辑:
这里是相关的SIMD指令的有趣。
SIMD
is a sub-thread thing. To make it more concrete, on a CPU you could imagine using simd
directives to specifically request vectorization of chunks of loop iterations that individually belong to the same thread. It's exposing the multiple levels of parallelism that exist within a single multicore processor, in a platform-independent way. See for instance the discussion (along with the accelerator stuff) on this intel blog post.
所以基本上,你要使用 OMP并行
来分配工作到不同的线程,然后可以迁移到多核;你会想使用 OMP SIMD
来充分利用每个核心内的矢量管线(说)的。通常 OMP并行
会去外处理工作的粗粒度并行分布和 OMP SIMD
会绕到紧循环里面利用细粒度并行。
So basically, you'll want to use omp parallel
to distribute work onto different threads, which can then migrate to multiple cores; and you'll want to use omp simd
to make use of vector pipelines (say) within each core. Normally omp parallel
would go on the "outside" to deal with coarser-grained parallel distribution of work and omp simd
would go around tight loops inside of that to exploit fine-grained parallelism.
这篇关于对于并行VS OMP SIMD:当使用的呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!