Index: /palm/trunk/SOURCE/poisfft_mod.f90
===================================================================
--- /palm/trunk/SOURCE/poisfft_mod.f90	(revision 3689)
+++ /palm/trunk/SOURCE/poisfft_mod.f90	(revision 3690)
@@ -253,5 +253,9 @@
        REAL(wp), DIMENSION(1:nz,nys:nyn,nxl:nxr) ::  ar      !<
        REAL(wp), DIMENSION(nys:nyn,nxl:nxr,1:nz) ::  ar_inv  !<
+
+#define __acc_fft_device ( defined( _OPENACC ) && ( defined ( __cuda_fft ) ) )
+#if __acc_fft_device
        !$ACC DECLARE CREATE(ar_inv)
+#endif
 
        REAL(wp), DIMENSION(:,:,:),   ALLOCATABLE ::  ar1      !<
@@ -265,4 +269,8 @@
 
        IF ( .NOT. poisfft_initialized )  CALL poisfft_init
+
+#if !__acc_fft_device
+       !$ACC UPDATE HOST(ar)
+#endif
 
 #ifndef _OPENACC
@@ -705,4 +713,8 @@
 
        ENDIF
+#endif
+
+#if !__acc_fft_device
+       !$ACC UPDATE DEVICE(ar)
 #endif
 
Index: /palm/trunk/SOURCE/transpose.f90
===================================================================
--- /palm/trunk/SOURCE/transpose.f90	(revision 3689)
+++ /palm/trunk/SOURCE/transpose.f90	(revision 3690)
@@ -91,4 +91,7 @@
 ! Initial revision
 !
+
+#define __acc_fft_device ( defined( _OPENACC ) && ( defined ( __cuda_fft ) ) )
+
 !------------------------------------------------------------------------------!
 ! Description:
@@ -122,6 +125,8 @@
     !$OMP  PARALLEL PRIVATE ( i, j, k )
     !$OMP  DO
+#if __acc_fft_device
      !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
      !$ACC PRESENT(f_inv, f_in)
+#endif
      DO  i = 0, nx
          DO  k = nzb_x, nzt_x
@@ -171,5 +176,7 @@
 
     REAL(wp), DIMENSION(nyn_x-nys_x+1,nzb_y:nzt_y,nxl_y:nxr_y,0:pdims(2)-1) ::  work !< 
+#if __acc_fft_device
     !$ACC DECLARE CREATE(work)
+#endif
 
 
@@ -180,4 +187,6 @@
 !--    Transpose array
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'start', cpu_log_nowait )
+
+#if __acc_fft_device
 #ifndef __cuda_aware_mpi
        !$ACC UPDATE HOST(f_inv)
@@ -185,8 +194,12 @@
        !$ACC HOST_DATA USE_DEVICE(work, f_inv)
 #endif
+#endif
+
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
        CALL MPI_ALLTOALL( f_inv(nys_x,nzb_x,0),  sendrecvcount_xy, MPI_REAL, &
                           work(1,nzb_y,nxl_y,0), sendrecvcount_xy, MPI_REAL, &
                           comm1dy, ierr )
+
+#if __acc_fft_device
 #ifndef __cuda_aware_mpi
        !$ACC UPDATE DEVICE(work)
@@ -194,4 +207,6 @@
        !$ACC END HOST_DATA
 #endif
+#endif
+
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'stop' )
 
@@ -202,6 +217,8 @@
        DO  l = 0, pdims(2) - 1
           ys = 0 + l * ( nyn_x - nys_x + 1 )
+#if __acc_fft_device
           !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
           !$ACC PRESENT(f_out, work)
+#endif
           DO  i = nxl_y, nxr_y
              DO  k = nzb_y, nzt_y
@@ -221,6 +238,8 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k )
 !$OMP  DO
+#if __acc_fft_device
        !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
        !$ACC PRESENT(f_out, f_inv)
+#endif
        DO  k = nzb_y, nzt_y
           DO  i = nxl_y, nxr_y
@@ -266,6 +285,8 @@
     !$OMP  PARALLEL PRIVATE ( i, j, k )
     !$OMP  DO
+#if __acc_fft_device
      !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
      !$ACC PRESENT(f_out, f_inv)
+#endif
      DO  k = 1, nz
          DO  i = nxl, nxr
@@ -315,5 +336,7 @@
 
     REAL(wp), DIMENSION(nys_x:nyn_x,nnx,nzb_x:nzt_x,0:pdims(1)-1) ::  work !< 
+#if __acc_fft_device
     !$ACC DECLARE CREATE(work)
+#endif
 
 
@@ -330,6 +353,8 @@
        DO  l = 0, pdims(1) - 1
           xs = 0 + l * nnx
+#if __acc_fft_device
           !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
           !$ACC PRESENT(work, f_in)
+#endif
           DO  k = nzb_x, nzt_x
              DO  i = xs, xs + nnx - 1
@@ -345,4 +370,6 @@
 !--    Transpose array
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'start', cpu_log_nowait )
+
+#if __acc_fft_device
 #ifndef __cuda_aware_mpi
        !$ACC UPDATE HOST(work)
@@ -350,8 +377,12 @@
        !$ACC HOST_DATA USE_DEVICE(work, f_inv)
 #endif
+#endif
+
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
        CALL MPI_ALLTOALL( work(nys_x,1,nzb_x,0), sendrecvcount_zx, MPI_REAL, &
                           f_inv(nys,nxl,1),      sendrecvcount_zx, MPI_REAL, &
                           comm1dx, ierr )
+
+#if __acc_fft_device
 #ifndef __cuda_aware_mpi
        !$ACC UPDATE DEVICE(f_inv)
@@ -361,4 +392,5 @@
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'stop' )
 #endif
+#endif
 
     ELSE
@@ -368,6 +400,8 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k )
 !$OMP  DO
+#if __acc_fft_device
        !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
        !$ACC PRESENT(f_inv, f_in)
+#endif
        DO  i = nxl, nxr
           DO  j = nys, nyn
@@ -415,6 +449,8 @@
     !$OMP  PARALLEL PRIVATE ( i, j, k )
     !$OMP  DO
+#if __acc_fft_device
      !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
      !$ACC PRESENT(f_out, f_inv)
+#endif
      DO  i = 0, nx
          DO  k = nzb_x, nzt_x
@@ -464,5 +500,7 @@
 
     REAL(wp), DIMENSION(nyn_x-nys_x+1,nzb_y:nzt_y,nxl_y:nxr_y,0:pdims(2)-1) ::  work !< 
+#if __acc_fft_device
     !$ACC DECLARE CREATE(work)
+#endif
 
 
@@ -476,6 +514,8 @@
        DO  l = 0, pdims(2) - 1
           ys = 0 + l * ( nyn_x - nys_x + 1 )
+#if __acc_fft_device
           !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
           !$ACC PRESENT(work, f_in)
+#endif
           DO  i = nxl_y, nxr_y
              DO  k = nzb_y, nzt_y
@@ -491,4 +531,6 @@
 !--    Transpose array
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'start', cpu_log_nowait )
+
+#if __acc_fft_device
 #ifndef __cuda_aware_mpi
        !$ACC UPDATE HOST(work)
@@ -496,8 +538,12 @@
        !$ACC HOST_DATA USE_DEVICE(work, f_inv)
 #endif
+#endif
+
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
        CALL MPI_ALLTOALL( work(1,nzb_y,nxl_y,0), sendrecvcount_xy, MPI_REAL, &
                           f_inv(nys_x,nzb_x,0),  sendrecvcount_xy, MPI_REAL, &
                           comm1dy, ierr )
+
+#if __acc_fft_device
 #ifndef __cuda_aware_mpi
        !$ACC UPDATE DEVICE(f_inv)
@@ -505,4 +551,6 @@
        !$ACC END HOST_DATA
 #endif
+#endif
+
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'stop' )
 #endif
@@ -514,6 +562,8 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k )
 !$OMP  DO
+#if __acc_fft_device
        !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
        !$ACC PRESENT(f_inv, f_in)
+#endif
        DO  i = nxl_y, nxr_y
           DO  k = nzb_y, nzt_y
@@ -641,6 +691,8 @@
     !$OMP  PARALLEL PRIVATE ( i, j, k )
     !$OMP  DO
+#if __acc_fft_device
      !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
      !$ACC PRESENT(f_inv, f_in)
+#endif
      DO  j = 0, ny
          DO  k = nzb_y, nzt_y
@@ -690,5 +742,7 @@
 
     REAL(wp), DIMENSION(nxl_z:nxr_z,nzt_y-nzb_y+1,nys_z:nyn_z,0:pdims(1)-1) ::  work !< 
+#if __acc_fft_device
     !$ACC DECLARE CREATE(work)
+#endif
 
 
@@ -700,6 +754,8 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k )
 !$OMP  DO
+#if __acc_fft_device
        !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
        !$ACC PRESENT(f_out, f_inv)
+#endif
        DO  j = 0, ny
           DO  k = nzb_y, nzt_y
@@ -717,4 +773,6 @@
 !--    Transpose array
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'start', cpu_log_nowait )
+
+#if __acc_fft_device
 #ifndef __cuda_aware_mpi
        !$ACC UPDATE HOST(f_inv)
@@ -722,8 +780,12 @@
        !$ACC HOST_DATA USE_DEVICE(work, f_inv)
 #endif
+#endif
+
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
        CALL MPI_ALLTOALL( f_inv(nxl_y,nzb_y,0),  sendrecvcount_yz, MPI_REAL, &
                           work(nxl_z,1,nys_z,0), sendrecvcount_yz, MPI_REAL, &
                           comm1dx, ierr )
+
+#if __acc_fft_device
 #ifndef __cuda_aware_mpi
        !$ACC UPDATE DEVICE(work)
@@ -731,4 +793,6 @@
        !$ACC END HOST_DATA
 #endif
+#endif
+
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'stop' )
 
@@ -739,6 +803,8 @@
        DO  l = 0, pdims(1) - 1
           zs = 1 + l * ( nzt_y - nzb_y + 1 )
+#if __acc_fft_device
           !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
           !$ACC PRESENT(f_out, work)
+#endif
           DO  j = nys_z, nyn_z
              DO  k = zs, zs + nzt_y - nzb_y
@@ -785,6 +851,8 @@
     !$OMP  PARALLEL PRIVATE ( i, j, k )
     !$OMP  DO
+#if __acc_fft_device
     !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
     !$ACC PRESENT(f_in, f_inv)
+#endif
      DO  k = 1,nz
          DO  i = nxl, nxr
@@ -834,5 +902,7 @@
 
     REAL(wp), DIMENSION(nys_x:nyn_x,nnx,nzb_x:nzt_x,0:pdims(1)-1) ::  work !< 
+#if __acc_fft_device
     !$ACC DECLARE CREATE(work)
+#endif
 
 
@@ -844,6 +914,8 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k )
 !$OMP  DO
+#if __acc_fft_device
        !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
        !$ACC PRESENT(f_out, f_inv)
+#endif
        DO  k = 1, nz
           DO  i = nxl, nxr
@@ -861,4 +933,6 @@
 !--    Transpose array
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'start', cpu_log_nowait )
+
+#if __acc_fft_device
 #ifndef __cuda_aware_mpi
        !$ACC UPDATE HOST(f_inv)
@@ -866,8 +940,12 @@
        !$ACC HOST_DATA USE_DEVICE(work, f_inv)
 #endif
+#endif
+
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
        CALL MPI_ALLTOALL( f_inv(nys,nxl,1),      sendrecvcount_zx, MPI_REAL, &
                           work(nys_x,1,nzb_x,0), sendrecvcount_zx, MPI_REAL, &
                           comm1dx, ierr )
+
+#if __acc_fft_device
 #ifndef __cuda_aware_mpi
        !$ACC UPDATE DEVICE(work)
@@ -875,4 +953,6 @@
        !$ACC END HOST_DATA
 #endif
+#endif
+
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'stop' )
 
@@ -883,6 +963,8 @@
        DO  l = 0, pdims(1) - 1
           xs = 0 + l * nnx
+#if __acc_fft_device
           !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
           !$ACC PRESENT(f_out, work)
+#endif
           DO  k = nzb_x, nzt_x
              DO  i = xs, xs + nnx - 1
@@ -933,6 +1015,8 @@
     !$OMP  PARALLEL PRIVATE ( i, j, k )
     !$OMP  DO
+#if __acc_fft_device
     !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
     !$ACC PRESENT(f_out, f_inv)
+#endif
      DO  k = nzb_y, nzt_y
          DO  j = 0, ny
@@ -982,5 +1066,7 @@
 
     REAL(wp), DIMENSION(nxl_z:nxr_z,nzt_y-nzb_y+1,nys_z:nyn_z,0:pdims(1)-1) ::  work !<
+#if __acc_fft_device
     !$ACC DECLARE CREATE(work)
+#endif
 
 !
@@ -996,6 +1082,8 @@
        DO  l = 0, pdims(1) - 1
           zs = 1 + l * ( nzt_y - nzb_y + 1 )
+#if __acc_fft_device
           !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
           !$ACC PRESENT(work, f_in)
+#endif
           DO  j = nys_z, nyn_z
              DO  k = zs, zs + nzt_y - nzb_y
@@ -1011,4 +1099,6 @@
 !--    Transpose array
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'start', cpu_log_nowait )
+
+#if __acc_fft_device
 #ifndef __cuda_aware_mpi
        !$ACC UPDATE HOST(work)
@@ -1016,8 +1106,12 @@
        !$ACC HOST_DATA USE_DEVICE(work, f_inv)
 #endif
+#endif
+
        IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
        CALL MPI_ALLTOALL( work(nxl_z,1,nys_z,0), sendrecvcount_yz, MPI_REAL, &
                           f_inv(nxl_y,nzb_y,0),  sendrecvcount_yz, MPI_REAL, &
                           comm1dx, ierr )
+
+#if __acc_fft_device
 #ifndef __cuda_aware_mpi
        !$ACC UPDATE DEVICE(f_inv)
@@ -1025,4 +1119,6 @@
        !$ACC END HOST_DATA
 #endif
+#endif
+
        CALL cpu_log( log_point_s(32), 'mpi_alltoall', 'stop' )
 #endif
@@ -1033,6 +1129,8 @@
 !$OMP  PARALLEL PRIVATE ( i, j, k )
 !$OMP  DO
+#if __acc_fft_device
        !$ACC PARALLEL LOOP COLLAPSE(3) PRIVATE(i,j,k) &
        !$ACC PRESENT(f_inv, f_in)
+#endif
        DO  k = nzb_y, nzt_y
           DO  j = 0, ny
Index: /palm/trunk/SOURCE/tridia_solver_mod.f90
===================================================================
--- /palm/trunk/SOURCE/tridia_solver_mod.f90	(revision 3689)
+++ /palm/trunk/SOURCE/tridia_solver_mod.f90	(revision 3690)
@@ -101,4 +101,7 @@
 ! the beginning, i.e. routine split is called within tridia_init.
 !
+
+#define __acc_fft_device ( defined( _OPENACC ) && ( defined ( __cuda_fft ) ) )
+
 !
 ! Description:
@@ -173,7 +176,9 @@
        CALL split
 
+#if __acc_fft_device
        !$ACC ENTER DATA &
        !$ACC COPYIN(ddzuw(0:nz-1,1:3)) &
        !$ACC COPYIN(tri(nxl_z:nxr_z,nys_z:nyn_z,0:nz-1,1:2))
+#endif
 
     END SUBROUTINE tridia_init
@@ -297,11 +302,17 @@
 
           REAL(wp), DIMENSION(nxl_z:nxr_z,nys_z:nyn_z,0:nz-1)   ::  ar1 !< 
+#if __acc_fft_device
           !$ACC DECLARE CREATE(ar1)
+#endif
 
 !
 !--       Forward substitution
+#if __acc_fft_device
           !$ACC PARALLEL PRESENT(ar, ar1, tri) PRIVATE(i,j,k)
+#endif
           DO  k = 0, nz - 1
+#if __acc_fft_device
              !$ACC LOOP COLLAPSE(2)
+#endif
              DO  j = nys_z, nyn_z
                 DO  i = nxl_z, nxr_z
@@ -316,5 +327,7 @@
              ENDDO
           ENDDO
+#if __acc_fft_device
           !$ACC END PARALLEL
+#endif
 
 !
@@ -323,7 +336,11 @@
 !--       by zero appearing if the pressure bc is set to neumann at the top of
 !--       the model domain.
+#if __acc_fft_device
           !$ACC PARALLEL PRESENT(ar, ar1, ddzuw, tri) PRIVATE(i,j,k)
+#endif
           DO  k = nz-1, 0, -1
+#if __acc_fft_device
              !$ACC LOOP COLLAPSE(2)
+#endif
              DO  j = nys_z, nyn_z
                 DO  i = nxl_z, nxr_z
@@ -338,5 +355,7 @@
              ENDDO
           ENDDO
+#if __acc_fft_device
           !$ACC END PARALLEL
+#endif
 
 !
@@ -346,5 +365,7 @@
           IF ( ibc_p_b == 1  .AND.  ibc_p_t == 1 )  THEN
              IF ( nys_z == 0  .AND.  nxl_z == 0 )  THEN
+#if __acc_fft_device
                 !$ACC PARALLEL LOOP PRESENT(ar)
+#endif
                 DO  k = 1, nz
                    ar(nxl_z,nys_z,k) = 0.0_wp
Index: /palm/trunk/TESTS/builds/pgi_mpi_openacc/build_config.yml
===================================================================
--- /palm/trunk/TESTS/builds/pgi_mpi_openacc/build_config.yml	(revision 3689)
+++ /palm/trunk/TESTS/builds/pgi_mpi_openacc/build_config.yml	(revision 3690)
@@ -10,5 +10,4 @@
     - "MPI_2REAL=MPI_2DOUBLE_PRECISION"
     - "__parallel"
-    - "__cuda_fft"
   options:
     default:
@@ -20,5 +19,4 @@
       - "-ta=tesla"
       - "-Minfo=accel"
-      - "-Mcuda"
     debug:
       - "-cpp"
@@ -31,5 +29,4 @@
       - "-Mfree"
       - "-ta=tesla"
-      - "-Mcuda"
       - "-Minfo=accel"
   includes: []
@@ -38,4 +35,2 @@
   options:
     - "-ta=tesla"
-    - "-Mcuda"
-    - "-Mcudalib=cufft"
Index: /palm/trunk/TESTS/builds/pgi_mpi_openacc_cufft/build_config.yml
===================================================================
--- /palm/trunk/TESTS/builds/pgi_mpi_openacc_cufft/build_config.yml	(revision 3690)
+++ /palm/trunk/TESTS/builds/pgi_mpi_openacc_cufft/build_config.yml	(revision 3690)
@@ -0,0 +1,41 @@
+---
+# this is a palmtest build configuration file
+
+compiler:
+  id: PGI
+  executable: "{{PGI.executable}}"
+  mpi_wrapper: "{{PGI.mpi_wrapper}}"
+  definitions:
+    - "MPI_REAL=MPI_DOUBLE_PRECISION"
+    - "MPI_2REAL=MPI_2DOUBLE_PRECISION"
+    - "__parallel"
+    - "__cuda_fft"
+  options:
+    default:
+      - "-cpp"
+      - "-w"
+      - "-fast"
+      - "-Mfree"
+      - "-Mfprelaxed"
+      - "-ta=tesla"
+      - "-Minfo=accel"
+      - "-Mcuda"
+    debug:
+      - "-cpp"
+      - "-g"
+      - "-Minform=inform"
+      - "-Mchkfpstk"
+      - "-Mchkstk"
+      - "-Mpgicoff"
+      - "-traceback"
+      - "-Mfree"
+      - "-ta=tesla"
+      - "-Mcuda"
+      - "-Minfo=accel"
+  includes: []
+
+linker:
+  options:
+    - "-ta=tesla"
+    - "-Mcuda"
+    - "-Mcudalib=cufft"
Index: /palm/trunk/TESTS/cases/openacc_test/case_config.yml
===================================================================
--- /palm/trunk/TESTS/cases/openacc_test/case_config.yml	(revision 3689)
+++ /palm/trunk/TESTS/cases/openacc_test/case_config.yml	(revision 3690)
@@ -5,4 +5,5 @@
   - pgi_mpi_only
   - pgi_mpi_openacc
+  - pgi_mpi_openacc_cufft
 
 allowed_number_of_cores:
