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