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