[1106] | 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-2012 Leibniz University Hannover |
---|
| 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
| 20 | ! Current revisions: |
---|
| 21 | ! ----------------- |
---|
| 22 | ! |
---|
[1225] | 23 | ! |
---|
[1106] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: cuda_fft_interfaces.f90 1225 2013-09-16 07:33:10Z heinze $ |
---|
| 27 | ! |
---|
[1225] | 28 | ! 1224 2013-09-16 07:27:23Z raasch |
---|
| 29 | ! dummy interface added to avoid compiler warnings |
---|
| 30 | ! |
---|
[1167] | 31 | ! 1166 2013-05-24 13:55:44Z raasch |
---|
| 32 | ! C_DOUBLE/COMPLEX reset to dpk, |
---|
| 33 | ! DEVICE attribut added to idata/odata arguments |
---|
| 34 | ! |
---|
[1154] | 35 | ! 1153 2013-05-10 14:33:08Z raasch |
---|
| 36 | ! code adjustment of data types for CUDA fft required by PGI 12.3 / CUDA 5.0 |
---|
| 37 | ! |
---|
[1112] | 38 | ! 1111 2013-03-08 23:54:10Z raasch |
---|
| 39 | ! idata and odata changed from 1d- to 3d-arrays |
---|
| 40 | ! |
---|
[1107] | 41 | ! 1106 2013-03-04 05:31:38Z raasch |
---|
| 42 | ! Initial revision |
---|
[1106] | 43 | ! |
---|
| 44 | ! Description: |
---|
| 45 | ! ------------ |
---|
| 46 | ! FORTRAN interfaces for the CUDA fft |
---|
| 47 | ! Routines for the fft along x and y (forward/backward) using the CUDA fft |
---|
| 48 | !--------------------------------------------------------------------------------! |
---|
| 49 | |
---|
| 50 | #if defined ( __cuda_fft ) |
---|
| 51 | |
---|
| 52 | INTEGER :: CUFFT_FORWARD = -1, & |
---|
| 53 | CUFFT_INVERSE = 1, & |
---|
| 54 | CUFFT_R2C = Z'2a', & ! Real to Complex (interleaved) |
---|
| 55 | CUFFT_C2R = Z'2c', & ! Complex (interleaved) to Real |
---|
| 56 | CUFFT_C2C = Z'29', & ! Complex to Complex, interleaved |
---|
| 57 | CUFFT_D2Z = Z'6a', & ! Double to Double-Complex |
---|
| 58 | CUFFT_Z2D = Z'6c', & ! Double-Complex to Double |
---|
| 59 | CUFFT_Z2Z = Z'69' ! Double-Complex to Double-Complex |
---|
| 60 | |
---|
| 61 | PUBLIC |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | ! |
---|
| 65 | !-- cufftPlan1d( cufftHandle *plan, int nx, cufftType type, int batch ) |
---|
| 66 | INTERFACE CUFFTPLAN1D |
---|
| 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, nx, type |
---|
| 74 | |
---|
| 75 | END SUBROUTINE CUFFTPLAN1D |
---|
| 76 | |
---|
| 77 | END INTERFACE CUFFTPLAN1D |
---|
| 78 | |
---|
| 79 | ! |
---|
| 80 | !-- cufftDestroy( cufftHandle plan ) !!! remove later if not really needed !!! |
---|
| 81 | INTERFACE CUFFTDESTROY |
---|
| 82 | |
---|
| 83 | SUBROUTINE CUFFTDESTROY( plan ) bind( C, name='cufftDestroy' ) |
---|
| 84 | |
---|
| 85 | USE ISO_C_BINDING |
---|
| 86 | |
---|
[1166] | 87 | INTEGER(C_INT), VALUE :: plan |
---|
[1106] | 88 | |
---|
| 89 | END SUBROUTINE CUFFTDESTROY |
---|
| 90 | |
---|
| 91 | END INTERFACE CUFFTDESTROY |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | INTERFACE CUFFTEXECZ2D |
---|
| 95 | |
---|
| 96 | SUBROUTINE CUFFTEXECZ2D( plan, idata, odata ) bind( C, name='cufftExecZ2D' ) |
---|
| 97 | |
---|
| 98 | USE ISO_C_BINDING |
---|
[1166] | 99 | USE precision_kind |
---|
[1106] | 100 | |
---|
[1166] | 101 | INTEGER(C_INT), VALUE :: plan |
---|
| 102 | COMPLEX(dpk), DEVICE :: idata(:,:,:) |
---|
| 103 | REAL(dpk), DEVICE :: odata(:,:,:) |
---|
[1106] | 104 | |
---|
| 105 | END SUBROUTINE CUFFTEXECZ2D |
---|
| 106 | |
---|
| 107 | END INTERFACE CUFFTEXECZ2D |
---|
| 108 | |
---|
| 109 | |
---|
| 110 | INTERFACE CUFFTEXECD2Z |
---|
| 111 | |
---|
| 112 | SUBROUTINE CUFFTEXECD2Z( plan, idata, odata ) bind( C, name='cufftExecD2Z' ) |
---|
| 113 | |
---|
| 114 | USE ISO_C_BINDING |
---|
[1166] | 115 | USE precision_kind |
---|
[1106] | 116 | |
---|
[1166] | 117 | INTEGER(C_INT), VALUE :: plan |
---|
| 118 | REAL(dpk), DEVICE :: idata(:,:,:) |
---|
| 119 | COMPLEX(dpk), DEVICE :: odata(:,:,:) |
---|
[1106] | 120 | |
---|
| 121 | END SUBROUTINE CUFFTEXECD2Z |
---|
| 122 | |
---|
| 123 | END INTERFACE CUFFTEXECD2Z |
---|
| 124 | |
---|
[1224] | 125 | #else |
---|
| 126 | |
---|
| 127 | ! |
---|
| 128 | !-- Dummy interface to avoid compiler warnings in case of no bublic objects |
---|
| 129 | !-- declared |
---|
| 130 | INTERFACE CUFFTdummy |
---|
| 131 | |
---|
| 132 | SUBROUTINE CUFFTdummy( dummy ) |
---|
| 133 | |
---|
| 134 | REAL :: dummy |
---|
| 135 | |
---|
| 136 | END SUBROUTINE CUFFTdummy |
---|
| 137 | |
---|
| 138 | END INTERFACE CUFFTdummy |
---|
| 139 | |
---|
[1106] | 140 | #endif |
---|
[1224] | 141 | |
---|
[1106] | 142 | END MODULE cuda_fft_interfaces |
---|