atomic capture in fortran

General OpenMP discussion

atomic capture in fortran

Postby buttari » Mon Mar 11, 2013 11:39 pm

Hello,
could anyone please tell me if this code is compliant to the 3.1 standard?

Code: Select all
program t

  type b
     integer :: s
  end type b
 
  integer :: v
  type(b) :: x

  !$omp atomic capture
  v = x%s
  x%s = x%s+1
  !$omp end atomic

  stop
end program t


The standard says (page 76, line 6) "x and v (as applicable) are both scalar variables of intrinsic type" (x and v are the two variables referenced in the capture and update statements). As far as I understand it should be compliant since x%s is of intrinsic type even if x is not. This code works well with gfortran 4.7 but the intel ifort compiler refuses to compile it giving the following error:

t.f90(11): error #7926: This statement is not a valid OpenMP* ATOMIC update-statement.
v = x%s
--^
t.f90(12): error #8550: An OpenMP* ATOMIC capture-statement is expected
x%s = x%s+1
--^
t.f90(10): internal error: Please visit 'http://www.intel.com/software/products/support' for assistance.
!$omp atomic capture
^
[ Aborting due to internal error. ]
compilation aborted for t.f90 (code 1)


Thanks in advance,
alfredo
buttari
 
Posts: 11
Joined: Wed Oct 29, 2008 10:41 am

Re: atomic capture in fortran

Postby ftinetti » Tue Mar 12, 2013 4:08 am

Hi Alfredo,

I just have some comments:
  • 1) Independently of the compliant/non-compliant issue, the compiler should not end with
    [ Aborting due to internal error. ]

    so I think you should report the issue to the developers anyway.

  • 2) I'm not an expert on Fortran standard/s, but in F95 (p. xvi, J3/97-007R2):
    Scalar variables include character strings and substrings, structured (derived-type) objects, structure components, and array elements.

    And, later, (p. 73, J3/97-007R2, the original formatting is rather lost):
    Code: Select all
    R601 variable is scalar-variable-name
                  or array-variable-name
                  or subobject
    Constraint: array-variable-name shall be the name of a data object that is an array.
    Constraint: array-variable-name shall not have the PARAMETER attribute.
    Constraint: scalar-variable-name shall not have the PARAMETER attribute.
    Constraint: subobject shall not be a subobject designator (for example, a substring) whose parent is a constant.

    R602 subobject is array-element
                   or array-section
                   or structure-component
                   or substring

    And, taking into account these definitions into account, x%s would be a scalar variable but not a scalar-variable-name. All of this to say I'm lost... I'll wait for some Fortran expert to reply...

HTH,

Fernando.
ftinetti
 
Posts: 582
Joined: Wed Feb 10, 2010 2:44 pm

Re: atomic capture in fortran

Postby RaviNarayanaswamy » Tue Mar 12, 2013 9:18 am

The error reported is a problem with Intel's compiler and will be addressed in the next release.
RaviNarayanaswamy
 
Posts: 2
Joined: Mon Dec 17, 2012 2:11 pm

Re: atomic capture in fortran

Postby buttari » Tue Mar 12, 2013 10:17 am

Fernando, Ravi,
thanks for the prompt reply. Yes, this is an ifort bug as confirmed also by intel sources (Ravi, I suspect you're one of them :-) ):

http://software.intel.com/en-us/comment ... nt-1727761

regards,
alfredo
buttari
 
Posts: 11
Joined: Wed Oct 29, 2008 10:41 am


Return to Using OpenMP

Who is online

Users browsing this forum: Yahoo [Bot] and 12 guests

cron