[1682] | 1 | !> @file cuda_fft_interfaces.f90 |
---|
[1106] | 2 | !--------------------------------------------------------------------------------! |
---|
| 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
| 5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 7 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 8 | ! |
---|
| 9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 12 | ! |
---|
| 13 | ! You should have received a copy of the GNU General Public License along with |
---|
| 14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 15 | ! |
---|
[1310] | 16 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1106] | 17 | !--------------------------------------------------------------------------------! |
---|
| 18 | ! |
---|
| 19 | ! Current revisions: |
---|
| 20 | ! ----------------- |
---|
[1682] | 21 | ! Code annotations made doxygen readable |
---|
[1375] | 22 | ! |
---|
[1321] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: cuda_fft_interfaces.f90 1682 2015-10-07 23:56:08Z knoop $ |
---|
| 26 | ! |
---|
[1375] | 27 | ! 1374 2014-04-25 12:55:07Z raasch |
---|
| 28 | ! bugfix: missing module kinds added |
---|
| 29 | ! |
---|
[1321] | 30 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
| 31 | ! Kind-parameters added to all INTEGER and REAL declaration statements, |
---|
[1320] | 32 | ! kinds are defined in new module kinds, |
---|
| 33 | ! old module precision_kind is removed, |
---|
| 34 | ! revision history before 2012 removed, |
---|
| 35 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 36 | ! all variable declaration statements |
---|
[1106] | 37 | ! |
---|
[1225] | 38 | ! 1224 2013-09-16 07:27:23Z raasch |
---|
| 39 | ! dummy interface added to avoid compiler warnings |
---|
| 40 | ! |
---|
[1167] | 41 | ! 1166 2013-05-24 13:55:44Z raasch |
---|
| 42 | ! C_DOUBLE/COMPLEX reset to dpk, |
---|
| 43 | ! DEVICE attribut added to idata/odata arguments |
---|
| 44 | ! |
---|
[1154] | 45 | ! 1153 2013-05-10 14:33:08Z raasch |
---|
| 46 | ! code adjustment of data types for CUDA fft required by PGI 12.3 / CUDA 5.0 |
---|
| 47 | ! |
---|
[1112] | 48 | ! 1111 2013-03-08 23:54:10Z raasch |
---|
| 49 | ! idata and odata changed from 1d- to 3d-arrays |
---|
| 50 | ! |
---|
[1107] | 51 | ! 1106 2013-03-04 05:31:38Z raasch |
---|
| 52 | ! Initial revision |
---|
[1106] | 53 | ! |
---|
| 54 | ! Description: |
---|
| 55 | ! ------------ |
---|
[1682] | 56 | !> FORTRAN interfaces for the CUDA fft |
---|
| 57 | !> Routines for the fft along x and y (forward/backward) using the CUDA fft |
---|
[1106] | 58 | !--------------------------------------------------------------------------------! |
---|
[1682] | 59 | MODULE cuda_fft_interfaces |
---|
| 60 | |
---|
[1106] | 61 | |
---|
| 62 | #if defined ( __cuda_fft ) |
---|
| 63 | |
---|
[1374] | 64 | USE kinds |
---|
| 65 | |
---|
[1682] | 66 | INTEGER(iwp) :: CUFFT_FORWARD = -1 !< |
---|
| 67 | INTEGER(iwp) :: CUFFT_INVERSE = 1 !< |
---|
| 68 | INTEGER(iwp) :: CUFFT_R2C = Z'2a' !< Real to Complex (interleaved) |
---|
| 69 | INTEGER(iwp) :: CUFFT_C2R = Z'2c' !< Complex (interleaved) to Real |
---|
| 70 | INTEGER(iwp) :: CUFFT_C2C = Z'29' !< Complex to Complex, interleaved |
---|
| 71 | INTEGER(iwp) :: CUFFT_D2Z = Z'6a' !< Double to Double-Complex |
---|
| 72 | INTEGER(iwp) :: CUFFT_Z2D = Z'6c' !< Double-Complex to Double |
---|
| 73 | INTEGER(iwp) :: CUFFT_Z2Z = Z'69' !< Double-Complex to Double-Complex |
---|
[1106] | 74 | |
---|
| 75 | PUBLIC |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | ! |
---|
| 79 | !-- cufftPlan1d( cufftHandle *plan, int nx, cufftType type, int batch ) |
---|
| 80 | INTERFACE CUFFTPLAN1D |
---|
| 81 | |
---|
[1682] | 82 | !------------------------------------------------------------------------------! |
---|
| 83 | ! Description: |
---|
| 84 | ! ------------ |
---|
| 85 | !> @todo Missing subroutine description. |
---|
| 86 | !------------------------------------------------------------------------------! |
---|
[1106] | 87 | SUBROUTINE CUFFTPLAN1D( plan, nx, type, batch ) bind( C, name='cufftPlan1d' ) |
---|
| 88 | |
---|
| 89 | USE ISO_C_BINDING |
---|
| 90 | |
---|
[1682] | 91 | INTEGER(C_INT) :: plan !< |
---|
| 92 | INTEGER(C_INT), value :: batch !< |
---|
| 93 | INTEGER(C_INT), value :: nx !< |
---|
| 94 | INTEGER(C_INT), value :: type !< |
---|
[1106] | 95 | END SUBROUTINE CUFFTPLAN1D |
---|
| 96 | |
---|
| 97 | END INTERFACE CUFFTPLAN1D |
---|
| 98 | |
---|
| 99 | ! |
---|
| 100 | !-- cufftDestroy( cufftHandle plan ) !!! remove later if not really needed !!! |
---|
| 101 | INTERFACE CUFFTDESTROY |
---|
| 102 | |
---|
[1682] | 103 | !------------------------------------------------------------------------------! |
---|
| 104 | ! Description: |
---|
| 105 | ! ------------ |
---|
| 106 | !> @todo Missing subroutine description. |
---|
| 107 | !------------------------------------------------------------------------------! |
---|
[1106] | 108 | SUBROUTINE CUFFTDESTROY( plan ) bind( C, name='cufftDestroy' ) |
---|
| 109 | |
---|
| 110 | USE ISO_C_BINDING |
---|
| 111 | |
---|
[1166] | 112 | INTEGER(C_INT), VALUE :: plan |
---|
[1106] | 113 | |
---|
| 114 | END SUBROUTINE CUFFTDESTROY |
---|
| 115 | |
---|
| 116 | END INTERFACE CUFFTDESTROY |
---|
| 117 | |
---|
| 118 | |
---|
| 119 | INTERFACE CUFFTEXECZ2D |
---|
| 120 | |
---|
[1682] | 121 | !------------------------------------------------------------------------------! |
---|
| 122 | ! Description: |
---|
| 123 | ! ------------ |
---|
| 124 | !> @todo Missing subroutine description. |
---|
| 125 | !------------------------------------------------------------------------------! |
---|
[1106] | 126 | SUBROUTINE CUFFTEXECZ2D( plan, idata, odata ) bind( C, name='cufftExecZ2D' ) |
---|
| 127 | |
---|
| 128 | USE ISO_C_BINDING |
---|
[1320] | 129 | USE kinds |
---|
[1106] | 130 | |
---|
[1682] | 131 | INTEGER(C_INT), VALUE :: plan !< |
---|
| 132 | COMPLEX(dp), DEVICE :: idata(:,:,:) !< |
---|
| 133 | REAL(dp), DEVICE :: odata(:,:,:) !< |
---|
[1106] | 134 | |
---|
| 135 | END SUBROUTINE CUFFTEXECZ2D |
---|
| 136 | |
---|
| 137 | END INTERFACE CUFFTEXECZ2D |
---|
| 138 | |
---|
| 139 | |
---|
| 140 | INTERFACE CUFFTEXECD2Z |
---|
| 141 | |
---|
[1682] | 142 | !------------------------------------------------------------------------------! |
---|
| 143 | ! Description: |
---|
| 144 | ! ------------ |
---|
| 145 | !> @todo Missing subroutine description. |
---|
| 146 | !------------------------------------------------------------------------------! |
---|
[1106] | 147 | SUBROUTINE CUFFTEXECD2Z( plan, idata, odata ) bind( C, name='cufftExecD2Z' ) |
---|
| 148 | |
---|
| 149 | USE ISO_C_BINDING |
---|
[1320] | 150 | |
---|
| 151 | USE kinds |
---|
[1106] | 152 | |
---|
[1682] | 153 | INTEGER(C_INT), VALUE :: plan !< |
---|
| 154 | REAL(dp), DEVICE :: idata(:,:,:) !< |
---|
| 155 | COMPLEX(dp), DEVICE :: odata(:,:,:) !< |
---|
[1106] | 156 | |
---|
| 157 | END SUBROUTINE CUFFTEXECD2Z |
---|
| 158 | |
---|
| 159 | END INTERFACE CUFFTEXECD2Z |
---|
| 160 | |
---|
[1224] | 161 | #else |
---|
| 162 | |
---|
| 163 | INTERFACE CUFFTdummy |
---|
| 164 | |
---|
[1682] | 165 | !------------------------------------------------------------------------------! |
---|
| 166 | ! Description: |
---|
| 167 | ! ------------ |
---|
| 168 | !> Dummy interface to avoid compiler warnings in case of no bublic objects |
---|
| 169 | !> declared. |
---|
| 170 | !------------------------------------------------------------------------------! |
---|
[1224] | 171 | SUBROUTINE CUFFTdummy( dummy ) |
---|
[1320] | 172 | |
---|
| 173 | USE kinds |
---|
[1224] | 174 | |
---|
[1682] | 175 | REAL(wp) :: dummy !< |
---|
[1224] | 176 | |
---|
| 177 | END SUBROUTINE CUFFTdummy |
---|
| 178 | |
---|
| 179 | END INTERFACE CUFFTdummy |
---|
| 180 | |
---|
[1106] | 181 | #endif |
---|
[1224] | 182 | |
---|
[1106] | 183 | END MODULE cuda_fft_interfaces |
---|