Example A.22.1c and A.22.1f differences

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

Example A.22.1c and A.22.1f differences

Postby nathanweeks » Sun Dec 11, 2011 9:34 am

The resulting values of the x and y arrays are different between examples A.22.1c and A.22.1f. It's probably no big deal, as the OpenMP concepts are implemented correctly, though it could result in some confusion for someone who attempts to run both programs and compare the results. The former example results in:

x[0] == 45000.0, x[1] == 45010.0, ... x[999] == 54990.0
and
y[0] == 0.0 y[1] == 2.0, ..., y[9999] == 19998.0

while the latter results in

X(1) == 55000.0, X(2) == 45010.0, X(3) == 45020.0, ..., X(1000) == 54990.0
and
Y(1) == 2.0, Y(2) == 4.0, ..., Y(10000) == 20000.0.

The Fortran version could be made consistent with the C/C++ version by changing lines 23-24 from
Code: Select all
   X(INDEX(I)) = X(INDEX(I)) + WORK1(I)
Y(I) = Y(I) + WORK2(I)

to
Code: Select all
   X(INDEX(I)) = X(INDEX(I)) + WORK1(I-1)
Y(I) = Y(I) + WORK2(I-1)


and line 35 from
Code: Select all
INDEX(I) = MOD(I, 1000) + 1

to
Code: Select all
INDEX(I) = MOD(I-1, 1000) + 1
--
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: Example A.22.1c and A.22.1f differences

Postby hhj » Tue Jan 03, 2012 12:41 pm

Thanks Nathan for your comment. We will include your suggestion into the next release of the spec.
-Henry Jin
hhj
 
Posts: 16
Joined: Thu May 01, 2008 11:59 am


Return to OpenMP 3.1 API Specifications

Who is online

Users browsing this forum: No registered users and 3 guests