1 | !> @file cuda_fft_interfaces_mod.f90 |
---|
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 | ! |
---|
16 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: cuda_fft_interfaces_mod.f90 1851 2016-04-08 13:32:50Z suehring $ |
---|
26 | ! |
---|
27 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
28 | ! Module renamed |
---|
29 | ! |
---|
30 | ! |
---|
31 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
32 | ! Code annotations made doxygen readable |
---|
33 | ! |
---|
34 | ! 1374 2014-04-25 12:55:07Z raasch |
---|
35 | ! bugfix: missing module kinds added |
---|
36 | ! |
---|
37 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
38 | ! Kind-parameters added to all INTEGER and REAL declaration statements, |
---|
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 |
---|
44 | ! |
---|
45 | ! 1224 2013-09-16 07:27:23Z raasch |
---|
46 | ! dummy interface added to avoid compiler warnings |
---|
47 | ! |
---|
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 | ! |
---|
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 | ! |
---|
55 | ! 1111 2013-03-08 23:54:10Z raasch |
---|
56 | ! idata and odata changed from 1d- to 3d-arrays |
---|
57 | ! |
---|
58 | ! 1106 2013-03-04 05:31:38Z raasch |
---|
59 | ! Initial revision |
---|
60 | ! |
---|
61 | ! Description: |
---|
62 | ! ------------ |
---|
63 | !> FORTRAN interfaces for the CUDA fft |
---|
64 | !> Routines for the fft along x and y (forward/backward) using the CUDA fft |
---|
65 | !--------------------------------------------------------------------------------! |
---|
66 | MODULE cuda_fft_interfaces |
---|
67 | |
---|
68 | |
---|
69 | #if defined ( __cuda_fft ) |
---|
70 | |
---|
71 | USE kinds |
---|
72 | |
---|
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 |
---|
81 | |
---|
82 | PUBLIC |
---|
83 | |
---|
84 | |
---|
85 | ! |
---|
86 | !-- cufftPlan1d( cufftHandle *plan, int nx, cufftType type, int batch ) |
---|
87 | INTERFACE CUFFTPLAN1D |
---|
88 | |
---|
89 | !------------------------------------------------------------------------------! |
---|
90 | ! Description: |
---|
91 | ! ------------ |
---|
92 | !> @todo Missing subroutine description. |
---|
93 | !------------------------------------------------------------------------------! |
---|
94 | SUBROUTINE CUFFTPLAN1D( plan, nx, type, batch ) bind( C, name='cufftPlan1d' ) |
---|
95 | |
---|
96 | USE ISO_C_BINDING |
---|
97 | |
---|
98 | INTEGER(C_INT) :: plan !< |
---|
99 | INTEGER(C_INT), value :: batch !< |
---|
100 | INTEGER(C_INT), value :: nx !< |
---|
101 | INTEGER(C_INT), value :: type !< |
---|
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 | |
---|
110 | !------------------------------------------------------------------------------! |
---|
111 | ! Description: |
---|
112 | ! ------------ |
---|
113 | !> @todo Missing subroutine description. |
---|
114 | !------------------------------------------------------------------------------! |
---|
115 | SUBROUTINE CUFFTDESTROY( plan ) bind( C, name='cufftDestroy' ) |
---|
116 | |
---|
117 | USE ISO_C_BINDING |
---|
118 | |
---|
119 | INTEGER(C_INT), VALUE :: plan |
---|
120 | |
---|
121 | END SUBROUTINE CUFFTDESTROY |
---|
122 | |
---|
123 | END INTERFACE CUFFTDESTROY |
---|
124 | |
---|
125 | |
---|
126 | INTERFACE CUFFTEXECZ2D |
---|
127 | |
---|
128 | !------------------------------------------------------------------------------! |
---|
129 | ! Description: |
---|
130 | ! ------------ |
---|
131 | !> @todo Missing subroutine description. |
---|
132 | !------------------------------------------------------------------------------! |
---|
133 | SUBROUTINE CUFFTEXECZ2D( plan, idata, odata ) bind( C, name='cufftExecZ2D' ) |
---|
134 | |
---|
135 | USE ISO_C_BINDING |
---|
136 | USE kinds |
---|
137 | |
---|
138 | INTEGER(C_INT), VALUE :: plan !< |
---|
139 | COMPLEX(dp), DEVICE :: idata(:,:,:) !< |
---|
140 | REAL(dp), DEVICE :: odata(:,:,:) !< |
---|
141 | |
---|
142 | END SUBROUTINE CUFFTEXECZ2D |
---|
143 | |
---|
144 | END INTERFACE CUFFTEXECZ2D |
---|
145 | |
---|
146 | |
---|
147 | INTERFACE CUFFTEXECD2Z |
---|
148 | |
---|
149 | !------------------------------------------------------------------------------! |
---|
150 | ! Description: |
---|
151 | ! ------------ |
---|
152 | !> @todo Missing subroutine description. |
---|
153 | !------------------------------------------------------------------------------! |
---|
154 | SUBROUTINE CUFFTEXECD2Z( plan, idata, odata ) bind( C, name='cufftExecD2Z' ) |
---|
155 | |
---|
156 | USE ISO_C_BINDING |
---|
157 | |
---|
158 | USE kinds |
---|
159 | |
---|
160 | INTEGER(C_INT), VALUE :: plan !< |
---|
161 | REAL(dp), DEVICE :: idata(:,:,:) !< |
---|
162 | COMPLEX(dp), DEVICE :: odata(:,:,:) !< |
---|
163 | |
---|
164 | END SUBROUTINE CUFFTEXECD2Z |
---|
165 | |
---|
166 | END INTERFACE CUFFTEXECD2Z |
---|
167 | |
---|
168 | #else |
---|
169 | |
---|
170 | INTERFACE CUFFTdummy |
---|
171 | |
---|
172 | !------------------------------------------------------------------------------! |
---|
173 | ! Description: |
---|
174 | ! ------------ |
---|
175 | !> Dummy interface to avoid compiler warnings in case of no bublic objects |
---|
176 | !> declared. |
---|
177 | !------------------------------------------------------------------------------! |
---|
178 | SUBROUTINE CUFFTdummy( dummy ) |
---|
179 | |
---|
180 | USE kinds |
---|
181 | |
---|
182 | REAL(wp) :: dummy !< |
---|
183 | |
---|
184 | END SUBROUTINE CUFFTdummy |
---|
185 | |
---|
186 | END INTERFACE CUFFTdummy |
---|
187 | |
---|
188 | #endif |
---|
189 | |
---|
190 | END MODULE cuda_fft_interfaces |
---|