Error in example A.13.4f of OpenMP 3.0 spec

Discuss the OpenMP 3.0 API Specifications with the OpenMP Arch. Review Board. (Read Only)

Error in example A.13.4f of OpenMP 3.0 spec

Postby nathanweeks » Mon May 18, 2009 7:14 pm

There is an error in example A.13.4f (p. 182, line 32) of the OpenMP 3.0 spec:

Code: Select all
!$OMP END TASKWAIT


should be

Code: Select all
!$OMP TASKWAIT


Regarding the Fortran code itself, gfortran 4.4.0 issues the following error when attempting to compile the recursive function as part of a simple program:
Code: Select all
             i = fib( n-1 )
                    1
Error: 'fib' at (1) is the name of a recursive function and so refers to the result variable. Use an explicit RESULT variable for direct recursion (12.5.2.1)


Sun Studio Express 3/09 issues a warning containing a similar message when invoked with "-ansi".

A more portable version of example A.13.4f:
Code: Select all
     
      RECURSIVE INTEGER FUNCTION fib(n) RESULT(res)
      INTEGER n, i, j
      IF ( n .LT. 2) THEN
        res = n
      ELSE
!$OMP TASK SHARED(i)
        i = fib( n-1 )
!$OMP END TASK
!$OMP TASK SHARED(j)
        j = fib( n-2 )
!$OMP END TASK
!$OMP TASKWAIT
        res = i+j
      END IF
      END FUNCTION


--
Nathan Weeks
--
Nathan Weeks
Iowa State University HPC Group
http://weeks.public.iastate.edu/
nathanweeks
 
Posts: 41
Joined: Sun May 17, 2009 6:19 am
Location: Iowa State University

Re: Error in example A.13.4f of OpenMP 3.0 spec

Postby kli » Tue May 19, 2009 7:47 pm

Yes, there is a typo in the example A.13.4f. "END TASKWAIT" should be "TASKWAIT". In addition, as suggested, the example should be changed to be standard conformance that requires RESULT in the function definition.

We will track these two issues and update the specification in the next revision.

Thanks.

Kelvin Li on behalf of OpenMP ARB
kli
 
Posts: 6
Joined: Thu Jan 08, 2009 7:39 pm


Return to OpenMP 3.0 API Specifications

Who is online

Users browsing this forum: No registered users and 1 guest