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