# OpenACC on GPU help

**URL:** <https://forums.developer.nvidia.com/t/openacc-on-gpu-help/135676>\
**Category:** Legacy PGI Compilers (archived)\
**Created:** [April 18, 2018, 8:45pm UTC](https://forums.developer.nvidia.com/t/openacc-on-gpu-help/135676 "2018-04-18T20:45:43Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![GR4EM](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@GR4EM](https://forums.developer.nvidia.com/u/GR4EM)\
**Post date:** [April 18, 2018, 8:45pm UTC](https://forums.developer.nvidia.com/t/openacc-on-gpu-help/135676/1 "2018-04-18T20:45:43Z")

</div>

Hi All,

I’m trying to run several loops using openACC.

Here is one of them

```nohighlight
DO J = 0, N2 - 1
	DO K = 0, N3 - 1
		TEMP1(1:N1) = DP(K,J,0:N1 - 1)
		CALL COSFFT(TEMP1, N1, -1)
	   DP(K,J,0:N1 - 1) = TEMP1(1:N1)
	END DO
END DO

```

I have created memory for DP array and i want array TEMP1 to be private for each thread. As I understood I should not use data clause in this case.

Subroutine COSFFT is described as

```nohighlight
!$acc routine(cosfft) seq

```

All other subroutines that are called in COSFFT subroutine also have this description. COSFFT subroutine performs 1D Fourier transform of vector TEMP1 and return result to the same array.

The problem is that when I do something like this

```nohighlight
!$acc parallel loop private(temp1) independent vector_length(N3)
		DO J = 0, N2 - 1
!$acc loop vector
			DO K = 0, N3 - 1
				TEMP1(1:N1) = DP(K,J,0:N1 - 1)
				CALL COSFFT(TEMP1, N1, -1)
				DP(K,J,0:N1 - 1) = TEMP1(1:N1)
			END DO
		END DO

```

it works fine on CPU, but GPU results are incorrect. What am I doing wrong?

---

_[View the full topic](https://forums.developer.nvidia.com/t/openacc-on-gpu-help/135676)._
