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