## Example A.22.1c and A.22.1f differences

Discuss the OpenMP 3.1 API Specifications with the OpenMP Arch. Review Board. (Read Only)
Forum rules
The OpenMP Forums are now closed to new posts. Please visit Stack Overflow if you are in need of help: https://stackoverflow.com/questions/tagged/openmp
nathanweeks
Posts: 41
Joined: Sun May 17, 2009 6:19 am
Location: Iowa State University
Contact:

### Example A.22.1c and A.22.1f differences

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/

hhj
Posts: 17
Joined: Thu May 01, 2008 11:59 am

### Re: Example A.22.1c and A.22.1f differences

Thanks Nathan for your comment. We will include your suggestion into the next release of the spec.
-Henry Jin