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

error #8550: An OpenMP* ATOMIC capture-statement is expected

Petros_A_1
Beginner
558 Views

Hi,

I am trying to get an atomic read out of a global module variable to be returned by the function. A small example is:

integer(c_int) function get_mag(mag) bind(C, name="get_mag")
#ifdef DLL
!DEC$ ATTRIBUTES DLLEXPORT :: get_mag
#endif
use VOL, only: x_g, y_g

implicit none
real(c_double), intent(inout) :: mag
doubleprecision :: x, y
integer :: num 

num = 1
!$omp atomic read
x=x_g(num)
!$omp atomic read
y=y_g(num)
mag=hypot(x, y)

get_mag=0
end function get_mag

I get an error "error #8550: An OpenMP* ATOMIC capture-statement is expected" on both atomic reads. I don't know what I'm doing wrong. 

Module VOL has simply:

double precision ::  x_g(10000), y_g(10000) 

I have the ifort version "Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.2.181 Build 20160204"

Thanks in advance

0 Kudos
8 Replies
jimdempseyatthecove
Honored Contributor III
558 Views
!$omp atomic read
x=x_g(num)
!$omp end atomic

Jim Dempsey

0 Kudos
Petros_A_1
Beginner
558 Views

jimdempseyatthecove wrote:

!$omp atomic read
x=x_g(num)
!$omp end atomic

Jim Dempsey

I get the same exact error... And according to the OpenMP standard, it shouldn't require an end directive...

0 Kudos
jimdempseyatthecove
Honored Contributor III
558 Views

As shown above, it would appear that you found a compiler error.

As an alternative, use !$omp flush(x_g(num)) before the read (same with y_g(num)).

Jim Dempsey

0 Kudos
Petros_A_1
Beginner
558 Views

Flush didn't seem to work either. It only accepts !$omp flush(x_g) and it gives the same error. For now, I have converter it into a critical section.

Just for complete information, I tried also with v15.0.0.090 and v13.1.3.192, both give the same error.

0 Kudos
Xiaoping_D_Intel
Employee
558 Views

Can't reproduce the error with your code. Which compiler options are you using? I am using "ifort -c -qopenmp -fpp test.f90".

Thanks,

Xiaoping Duan

Intel Customer Support

0 Kudos
Petros_A_1
Beginner
558 Views

Xiaoping D. (Intel) wrote:

Can't reproduce the error with your code. Which compiler options are you using? I am using "ifort -c -qopenmp -fpp test.f90".

Thanks,

Xiaoping Duan

Intel Customer Support

I use:

ifort -align -zero -fpp -openmp -O3 -traceback -implicitnone -fPIC

I have also tried with

ifort -fpp -openmp -traceback -implicitnone

Same error. I think under Linux it's -openmp, not -qopenmp.

0 Kudos
Xiaoping_D_Intel
Employee
558 Views

Still can't reproduce the error using the same command line. If you are using 16.0 compiler there must be message like:

ifort: command line remark #10411: option '-openmp' is deprecated and will be removed in a future release. Please use the replacement option '-qopenmp'

 

Would you please attach a complete test case including module source and the function source which can be compiled to reproduce the error, or submit it through Intel Premier Support?

Thanks,

Xiaoping Duan

Intel Customer Support

 

0 Kudos
Petros_A_1
Beginner
558 Views

Xiaoping D. (Intel) wrote:

Still can't reproduce the error using the same command line. If you are using 16.0 compiler there must be message like:

ifort: command line remark #10411: option '-openmp' is deprecated and will be removed in a future release. Please use the replacement option '-qopenmp'

Would you please attach a complete test case including module source and the function source which can be compiled to reproduce the error, or submit it through Intel Premier Support?

Thanks,

Xiaoping Duan

Intel Customer Support

Dear Xiaoping, you are right. I was compiling with version 13 all the time. when I actually switched to v16 the error was removed and I got the warning about the deprecated option (which I fixed). Thanks!

0 Kudos
Reply