1 | !> @file cuda_fft_interfaces.f90 |
---|
2 | !--------------------------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General |
---|
6 | ! Public License as published by the Free Software Foundation, either version 3 of the License, or |
---|
7 | ! (at your option) any later version. |
---|
8 | ! |
---|
9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
---|
10 | ! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
11 | ! Public License for more details. |
---|
12 | ! |
---|
13 | ! You should have received a copy of the GNU General Public License along with PALM. If not, see |
---|
14 | ! <http://www.gnu.org/licenses/>. |
---|
15 | ! |
---|
16 | ! Copyright 1997-2020 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: cuda_fft_interfaces.f90 4559 2020-06-11 08:51:48Z raasch $ |
---|
26 | ! file re-formatted to follow the PALM coding standard |
---|
27 | ! |
---|
28 | ! 4360 2020-01-07 11:25:50Z suehring |
---|
29 | ! Corrected "Former revisions" section |
---|
30 | ! |
---|
31 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
32 | ! 1683 2015-10-07 23:57:51Z knoop |
---|
33 | ! |
---|
34 | ! |
---|
35 | ! Description: |
---|
36 | ! ------------ |
---|
37 | !> FORTRAN interfaces for the CUDA fft |
---|
38 | !> Routines for the fft along x and y (forward/backward) using the CUDA fft |
---|
39 | !--------------------------------------------------------------------------------------------------! |
---|
40 | MODULE cuda_fft_interfaces |
---|
41 | |
---|
42 | |
---|
43 | #if defined ( __cuda_fft ) |
---|
44 | |
---|
45 | USE kinds |
---|
46 | |
---|
47 | INTEGER(iwp) :: CUFFT_C2C = Z'29' !< Complex to Complex, interleaved |
---|
48 | INTEGER(iwp) :: CUFFT_C2R = Z'2c' !< Complex (interleaved) to Real |
---|
49 | INTEGER(iwp) :: CUFFT_D2Z = Z'6a' !< Double to Double-Complex |
---|
50 | INTEGER(iwp) :: CUFFT_FORWARD = -1 !< |
---|
51 | INTEGER(iwp) :: CUFFT_INVERSE = 1 !< |
---|
52 | INTEGER(iwp) :: CUFFT_R2C = Z'2a' !< Real to Complex (interleaved) |
---|
53 | INTEGER(iwp) :: CUFFT_Z2D = Z'6c' !< Double-Complex to Double |
---|
54 | INTEGER(iwp) :: CUFFT_Z2Z = Z'69' !< Double-Complex to Double-Complex |
---|
55 | |
---|
56 | PUBLIC |
---|
57 | |
---|
58 | |
---|
59 | ! |
---|
60 | !-- cufftPlan1d( cufftHandle *plan, int nx, cufftType type, int batch ) |
---|
61 | INTERFACE CUFFTPLAN1D |
---|
62 | |
---|
63 | !--------------------------------------------------------------------------------------------------! |
---|
64 | ! Description: |
---|
65 | ! ------------ |
---|
66 | !> @todo Missing subroutine description. |
---|
67 | !--------------------------------------------------------------------------------------------------! |
---|
68 | SUBROUTINE CUFFTPLAN1D( plan, nx, type, batch ) BIND( C, name='cufftPlan1d' ) |
---|
69 | |
---|
70 | USE ISO_C_BINDING |
---|
71 | |
---|
72 | INTEGER(C_INT) :: plan !< |
---|
73 | INTEGER(C_INT), VALUE :: batch !< |
---|
74 | INTEGER(C_INT), VALUE :: nx !< |
---|
75 | INTEGER(C_INT), VALUE :: type !< |
---|
76 | END SUBROUTINE CUFFTPLAN1D |
---|
77 | |
---|
78 | END INTERFACE CUFFTPLAN1D |
---|
79 | |
---|
80 | ! |
---|
81 | !-- cufftDestroy( cufftHandle plan ) !!! remove later if not really needed !!! |
---|
82 | INTERFACE CUFFTDESTROY |
---|
83 | |
---|
84 | !--------------------------------------------------------------------------------------------------! |
---|
85 | ! Description: |
---|
86 | ! ------------ |
---|
87 | !> @todo Missing subroutine description. |
---|
88 | !--------------------------------------------------------------------------------------------------! |
---|
89 | SUBROUTINE CUFFTDESTROY( plan ) BIND( C, name='cufftDestroy' ) |
---|
90 | |
---|
91 | USE ISO_C_BINDING |
---|
92 | |
---|
93 | INTEGER(C_INT), VALUE :: plan |
---|
94 | |
---|
95 | END SUBROUTINE CUFFTDESTROY |
---|
96 | |
---|
97 | END INTERFACE CUFFTDESTROY |
---|
98 | |
---|
99 | |
---|
100 | INTERFACE CUFFTEXECZ2D |
---|
101 | |
---|
102 | !--------------------------------------------------------------------------------------------------! |
---|
103 | ! Description: |
---|
104 | ! ------------ |
---|
105 | !> @todo Missing subroutine description. |
---|
106 | !--------------------------------------------------------------------------------------------------! |
---|
107 | SUBROUTINE CUFFTEXECZ2D( plan, idata, odata ) BIND( C, name='cufftExecZ2D' ) |
---|
108 | |
---|
109 | USE ISO_C_BINDING |
---|
110 | USE kinds |
---|
111 | |
---|
112 | COMPLEX(dp), DEVICE :: idata(:,:,:) !< |
---|
113 | |
---|
114 | INTEGER(C_INT), VALUE :: plan !< |
---|
115 | |
---|
116 | REAL(dp), DEVICE :: odata(:,:,:) !< |
---|
117 | |
---|
118 | END SUBROUTINE CUFFTEXECZ2D |
---|
119 | |
---|
120 | END INTERFACE CUFFTEXECZ2D |
---|
121 | |
---|
122 | |
---|
123 | INTERFACE CUFFTEXECD2Z |
---|
124 | |
---|
125 | !--------------------------------------------------------------------------------------------------! |
---|
126 | ! Description: |
---|
127 | ! ------------ |
---|
128 | !> @todo Missing subroutine description. |
---|
129 | !--------------------------------------------------------------------------------------------------! |
---|
130 | SUBROUTINE CUFFTEXECD2Z( plan, idata, odata ) bind( C, name='cufftExecD2Z' ) |
---|
131 | |
---|
132 | USE ISO_C_BINDING |
---|
133 | |
---|
134 | USE kinds |
---|
135 | |
---|
136 | COMPLEX(dp), DEVICE :: odata(:,:,:) !< |
---|
137 | |
---|
138 | INTEGER(C_INT), VALUE :: plan !< |
---|
139 | |
---|
140 | REAL(dp), DEVICE :: idata(:,:,:) !< |
---|
141 | |
---|
142 | END SUBROUTINE CUFFTEXECD2Z |
---|
143 | |
---|
144 | END INTERFACE CUFFTEXECD2Z |
---|
145 | |
---|
146 | #else |
---|
147 | |
---|
148 | INTERFACE CUFFTdummy |
---|
149 | |
---|
150 | !--------------------------------------------------------------------------------------------------! |
---|
151 | ! Description: |
---|
152 | ! ------------ |
---|
153 | !> Dummy interface to avoid compiler warnings in case of no bublic objects declared. |
---|
154 | !--------------------------------------------------------------------------------------------------! |
---|
155 | SUBROUTINE CUFFTdummy( dummy ) |
---|
156 | |
---|
157 | USE kinds |
---|
158 | |
---|
159 | REAL(wp) :: dummy !< |
---|
160 | |
---|
161 | END SUBROUTINE CUFFTdummy |
---|
162 | |
---|
163 | END INTERFACE CUFFTdummy |
---|
164 | |
---|
165 | #endif |
---|
166 | |
---|
167 | END MODULE cuda_fft_interfaces |
---|