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