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

Differences between !$OMP SIMD and !DIR$ SIMD

Fiona_R_
Beginner
1,318 Views

Hi Folks, 

Can anyone explain the difference(s) between !DIR$ SIMD and !$OMP SIMD please or point me towards where I can find this out? I should add, I've already read through the thread at https://software.intel.com/en-us/forums/topic/509157 but this didn't fully explain the differences. 

As I understand !DIR$ SIMD is an Intel specific directive but !$OMP SIMD is part of the OpenMP 4.0 standard, however, many of the clauses that can be added and the use cases appear to be identical for both directives. 

Thanks in advance. 

Fiona

 

0 Kudos
1 Solution
TimP
Honored Contributor III
1,318 Views

Among the apparently gratuitous differences is that !dir$ simd may be used to suppress creation of a temporary array followed by memcpy where !$omp simd has no effect in Ifort although it may do the job with othèr compilers.

!dir$ simd offers firstprivate clause which is not allowed by !$omp Simd thus enabling a few additional cases of vectorization.

Both have the potential pitfall that it is unsafe to assert vectorization without designating all reductions regardless of whether there is syntax to support them.

I prefer !$omp safelen over !dir $ vector length as the latter has to be adjusted according to 128 256 or 512 bit Simd.

 

 

View solution in original post

0 Kudos
3 Replies
Steven_L_Intel1
Employee
1,318 Views

!DIR$ SIMD came first - you're right that there's a lot of overlap, but the Intel version allows some clauses that the OMP version doesn't. I would recommend using the OMP version unless there's a clause needed from the DIR$ version.

0 Kudos
TimP
Honored Contributor III
1,319 Views

Among the apparently gratuitous differences is that !dir$ simd may be used to suppress creation of a temporary array followed by memcpy where !$omp simd has no effect in Ifort although it may do the job with othèr compilers.

!dir$ simd offers firstprivate clause which is not allowed by !$omp Simd thus enabling a few additional cases of vectorization.

Both have the potential pitfall that it is unsafe to assert vectorization without designating all reductions regardless of whether there is syntax to support them.

I prefer !$omp safelen over !dir $ vector length as the latter has to be adjusted according to 128 256 or 512 bit Simd.

 

 

0 Kudos
Fiona_R_
Beginner
1,318 Views

Many thanks Tim and Steve for clarifying this. 

For my application I've found !DIR$ SIMD performs very slightly better than !$OMP SIMD thus I suspect I'm being affected by the extra memcpy.  As !$OMP SIMD is portable to any OpenMP 4.0 compliant compiler I'll most likely stick with it. 

 

 

0 Kudos
Reply