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