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