[3634] | 1 | !> @file cuda_fft_interfaces.f90 |
---|
[4559] | 2 | !--------------------------------------------------------------------------------------------------! |
---|
| 3 | ! This file is part of the PALM model system. |
---|
[3634] | 4 | ! |
---|
[4559] | 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. |
---|
[3634] | 8 | ! |
---|
[4559] | 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. |
---|
[3634] | 12 | ! |
---|
[4559] | 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/>. |
---|
[3634] | 15 | ! |
---|
[4828] | 16 | ! Copyright 1997-2021 Leibniz Universitaet Hannover |
---|
[4559] | 17 | !--------------------------------------------------------------------------------------------------! |
---|
[3634] | 18 | ! |
---|
| 19 | ! Current revisions: |
---|
| 20 | ! ----------------- |
---|
| 21 | ! |
---|
| 22 | ! |
---|
| 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: cuda_fft_interfaces.f90 4828 2021-01-05 11:21:41Z suehring $ |
---|
[4559] | 26 | ! file re-formatted to follow the PALM coding standard |
---|
| 27 | ! |
---|
| 28 | ! 4360 2020-01-07 11:25:50Z suehring |
---|
[4182] | 29 | ! Corrected "Former revisions" section |
---|
[4559] | 30 | ! |
---|
[4182] | 31 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
| 32 | ! 1683 2015-10-07 23:57:51Z knoop |
---|
[3634] | 33 | ! |
---|
[4182] | 34 | ! |
---|
[3634] | 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 |
---|
[4559] | 39 | !--------------------------------------------------------------------------------------------------! |
---|
[3634] | 40 | MODULE cuda_fft_interfaces |
---|
| 41 | |
---|
[4559] | 42 | |
---|
[3634] | 43 | #if defined ( __cuda_fft ) |
---|
| 44 | |
---|
| 45 | USE kinds |
---|
| 46 | |
---|
[4559] | 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 |
---|
[3634] | 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 | |
---|
[4559] | 63 | !--------------------------------------------------------------------------------------------------! |
---|
[3634] | 64 | ! Description: |
---|
| 65 | ! ------------ |
---|
| 66 | !> @todo Missing subroutine description. |
---|
[4559] | 67 | !--------------------------------------------------------------------------------------------------! |
---|
| 68 | SUBROUTINE CUFFTPLAN1D( plan, nx, type, batch ) BIND( C, name='cufftPlan1d' ) |
---|
[3634] | 69 | |
---|
| 70 | USE ISO_C_BINDING |
---|
| 71 | |
---|
[4559] | 72 | INTEGER(C_INT) :: plan !< |
---|
| 73 | INTEGER(C_INT), VALUE :: batch !< |
---|
| 74 | INTEGER(C_INT), VALUE :: nx !< |
---|
| 75 | INTEGER(C_INT), VALUE :: type !< |
---|
[3634] | 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 | |
---|
[4559] | 84 | !--------------------------------------------------------------------------------------------------! |
---|
[3634] | 85 | ! Description: |
---|
| 86 | ! ------------ |
---|
| 87 | !> @todo Missing subroutine description. |
---|
[4559] | 88 | !--------------------------------------------------------------------------------------------------! |
---|
| 89 | SUBROUTINE CUFFTDESTROY( plan ) BIND( C, name='cufftDestroy' ) |
---|
[3634] | 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 | |
---|
[4559] | 102 | !--------------------------------------------------------------------------------------------------! |
---|
[3634] | 103 | ! Description: |
---|
| 104 | ! ------------ |
---|
| 105 | !> @todo Missing subroutine description. |
---|
[4559] | 106 | !--------------------------------------------------------------------------------------------------! |
---|
| 107 | SUBROUTINE CUFFTEXECZ2D( plan, idata, odata ) BIND( C, name='cufftExecZ2D' ) |
---|
[3634] | 108 | |
---|
| 109 | USE ISO_C_BINDING |
---|
| 110 | USE kinds |
---|
| 111 | |
---|
[4559] | 112 | COMPLEX(dp), DEVICE :: idata(:,:,:) !< |
---|
| 113 | |
---|
[3634] | 114 | INTEGER(C_INT), VALUE :: plan !< |
---|
[4559] | 115 | |
---|
[3634] | 116 | REAL(dp), DEVICE :: odata(:,:,:) !< |
---|
| 117 | |
---|
| 118 | END SUBROUTINE CUFFTEXECZ2D |
---|
| 119 | |
---|
| 120 | END INTERFACE CUFFTEXECZ2D |
---|
| 121 | |
---|
| 122 | |
---|
| 123 | INTERFACE CUFFTEXECD2Z |
---|
| 124 | |
---|
[4559] | 125 | !--------------------------------------------------------------------------------------------------! |
---|
[3634] | 126 | ! Description: |
---|
| 127 | ! ------------ |
---|
| 128 | !> @todo Missing subroutine description. |
---|
[4559] | 129 | !--------------------------------------------------------------------------------------------------! |
---|
[3634] | 130 | SUBROUTINE CUFFTEXECD2Z( plan, idata, odata ) bind( C, name='cufftExecD2Z' ) |
---|
| 131 | |
---|
| 132 | USE ISO_C_BINDING |
---|
[4559] | 133 | |
---|
[3634] | 134 | USE kinds |
---|
| 135 | |
---|
[4559] | 136 | COMPLEX(dp), DEVICE :: odata(:,:,:) !< |
---|
| 137 | |
---|
[3634] | 138 | INTEGER(C_INT), VALUE :: plan !< |
---|
[4559] | 139 | |
---|
[3634] | 140 | REAL(dp), DEVICE :: idata(:,:,:) !< |
---|
| 141 | |
---|
| 142 | END SUBROUTINE CUFFTEXECD2Z |
---|
| 143 | |
---|
| 144 | END INTERFACE CUFFTEXECD2Z |
---|
| 145 | |
---|
| 146 | #else |
---|
| 147 | |
---|
| 148 | INTERFACE CUFFTdummy |
---|
| 149 | |
---|
[4559] | 150 | !--------------------------------------------------------------------------------------------------! |
---|
[3634] | 151 | ! Description: |
---|
| 152 | ! ------------ |
---|
[4559] | 153 | !> Dummy interface to avoid compiler warnings in case of no bublic objects declared. |
---|
| 154 | !--------------------------------------------------------------------------------------------------! |
---|
[3634] | 155 | SUBROUTINE CUFFTdummy( dummy ) |
---|
[4559] | 156 | |
---|
[3634] | 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 |
---|