- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
!$omp atomic read x=x_g(num) !$omp end atomic
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
jimdempseyatthecove wrote:
!$omp atomic read x=x_g(num) !$omp end atomicJim Dempsey
I get the same exact error... And according to the OpenMP standard, it shouldn't require an end directive...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page