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