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