英特尔的pragma simd与OpenMP的pragma omp simd [英] Intel's pragma simd vs OpenMP's pragma omp simd
问题描述
英特尔编译器允许我们通过以下方式对循环进行矢量化处理
The Intel compiler allows us to vectorize loops via
#pragma simd
for ( ... )
但是,您也可以选择使用OpenMP 4的指令执行此操作:
However, you also have the option to do this with OpenMP 4's directive:
#pragma omp simd
for ( ... )
两者之间有区别吗?
推荐答案
出于所有意图和目的,它们应该相同.区别在于OpenMP 4.0 #pragma omp simd
指令是可移植的,并且可以与其他支持OpenMP 4.0以及Intel的编译器一起使用.
For all intents and purposes they should be identical. The difference is that the OpenMP 4.0 #pragma omp simd
directive is portable and should work with other compilers that support OpenMP 4.0 as well as Intel's.
此外,OpenMP版本中有几个子句,可让您以更可靠的方式对指令进行矢量化(想到了safelen()
,linear()
,aligned()
,reduction()
和collapse()
).
Furthemore, there are several clauses in the OpenMP version which allow you to vectorize instructions in a more robust manner (safelen()
, linear()
, aligned()
, reduction()
, and collapse()
come to mind).
这篇关于英特尔的pragma simd与OpenMP的pragma omp simd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!