Quantcast
Viewing all articles
Browse latest Browse all 3270

Using !$omp declare simd in an elemental subroutine

Quite recently (in May), I decided to update some of my codebase to use OpenMP 4.0 and, in particular, try out the "!$omp declare simd" directive. After a few teething troubles documented in a question I asked here, I got it working well and it has been running smoothly ever since. As it's such a short subroutine, I'll reproduce it here for convenience:

elemental subroutine Calculate_Sines(normal_x, normal_y, normal_z, &
                                     rzero_x, rzero_y, rzero_z,    &
                                     es_x, es_y, es_z, sin_theta)

!$omp declare simd(Calculate_Sines) uniform(normal_x, normal_y, normal_z)
    real(kind(1d0)), intent(in) :: normal_x, normal_y, normal_z
    real(kind(1d0)), intent(in) :: rzero_x, rzero_y, rzero_z
    real(kind(1d0)), intent(out) :: es_x, es_y, es_z, sin_theta

    es_x = normal_z * rzero_y - normal_y * rzero_z
    es_y = normal_x * rzero_z - normal_z * rzero_x
    es_z = normal_y * rzero_x - normal_x * rzero_y

    sin_theta = sqrt( es_x**2 + es_y**2 + es_z**2 )

end subroutine Calculate_Sines

However, I've just installed Parallel Studio XE 16.0 and everything has come to a juddering halt. The same piece of code now fails to compile, with the error message:

error #8807: An OpenMP* directive may not appear in a PURE procedure.

I assume that an elemental subroutine is pure by implication. My basic syntax isn't at all original, as it very closely follows an example given in the Intel documentation here, so I can't really figure out what I should do. Is the example in the documentation, which dates from May 2014 no longer valid? Or am I just doing something really dumb?


Viewing all articles
Browse latest Browse all 3270


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>