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