-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make in-place FFT optional #155
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,19 +10,35 @@ | |
! | ||
|
||
MODULE FTDIR_MOD | ||
USE BUFFERED_ALLOCATOR_MOD ,ONLY : ALLOCATION_RESERVATION_HANDLE | ||
IMPLICIT NONE | ||
|
||
PRIVATE | ||
PUBLIC :: FTDIR, FTDIR_HANDLE, PREPARE_FTDIR | ||
|
||
TYPE FTDIR_HANDLE | ||
TYPE(ALLOCATION_RESERVATION_HANDLE) :: HREEL_COMPLEX | ||
END TYPE | ||
CONTAINS | ||
|
||
FUNCTION PREPARE_FTDIR() RESULT(HFTDIR) | ||
FUNCTION PREPARE_FTDIR(ALLOCATOR,KF_FS) RESULT(HFTDIR) | ||
USE PARKIND_ECTRANS, ONLY: JPIM, JPRBT | ||
USE TPM_DISTR, ONLY: D | ||
USE BUFFERED_ALLOCATOR_MOD, ONLY: BUFFERED_ALLOCATOR, RESERVE | ||
USE ISO_C_BINDING, ONLY: C_SIZE_T | ||
|
||
IMPLICIT NONE | ||
|
||
TYPE(BUFFERED_ALLOCATOR), INTENT(INOUT) :: ALLOCATOR | ||
INTEGER(KIND=JPIM), INTENT(IN) :: KF_FS | ||
TYPE(FTDIR_HANDLE) :: HFTDIR | ||
END FUNCTION | ||
|
||
REAL(KIND=JPRBT) :: DUMMY | ||
|
||
#ifndef IN_PLACE_FFT | ||
HFTDIR%HREEL_COMPLEX = RESERVE(ALLOCATOR, INT(KF_FS*D%NLENGTF*SIZEOF(DUMMY), KIND=C_SIZE_T)) | ||
#endif | ||
END FUNCTION PREPARE_FTDIR | ||
|
||
SUBROUTINE FTDIR(ALLOCATOR,HFTDIR,PREEL_REAL,PREEL_COMPLEX,KFIELD) | ||
!**** *FTDIR - Direct Fourier transform | ||
|
@@ -60,12 +76,13 @@ SUBROUTINE FTDIR(ALLOCATOR,HFTDIR,PREEL_REAL,PREEL_COMPLEX,KFIELD) | |
USE TPM_GEN, ONLY: LSYNC_TRANS | ||
USE PARKIND_ECTRANS, ONLY: JPIM, JPRBT | ||
USE TPM_DISTR, ONLY: MYSETW, MYPROC, NPROC, D_NSTAGT0B, D_NSTAGTF,D_NPTRLS, & | ||
& D_NPNTGTB0, D_NPROCM, D_NDGL_FS | ||
& D_NPNTGTB0, D_NPROCM, D_NDGL_FS, D | ||
USE TPM_GEOMETRY, ONLY: G_NMEN, G_NLOEN | ||
USE BUFFERED_ALLOCATOR_MOD, ONLY: BUFFERED_ALLOCATOR | ||
USE BUFFERED_ALLOCATOR_MOD, ONLY: BUFFERED_ALLOCATOR, ASSIGN_PTR, GET_ALLOCATION | ||
USE TPM_HICFFT, ONLY: EXECUTE_DIR_FFT | ||
USE MPL_MODULE, ONLY: MPL_BARRIER,MPL_ALL_MS_COMM | ||
USE TPM_STATS, ONLY: GSTATS => GSTATS_NVTX | ||
USE ISO_C_BINDING, ONLY: C_SIZE_T | ||
|
||
IMPLICIT NONE | ||
|
||
|
@@ -77,7 +94,12 @@ SUBROUTINE FTDIR(ALLOCATOR,HFTDIR,PREEL_REAL,PREEL_COMPLEX,KFIELD) | |
|
||
INTEGER(KIND=JPIM) :: KGL | ||
|
||
#ifdef IN_PLACE_FFT | ||
PREEL_COMPLEX => PREEL_REAL | ||
#else | ||
CALL ASSIGN_PTR(PREEL_COMPLEX, GET_ALLOCATION(ALLOCATOR, HFTDIR%HREEL_COMPLEX),& | ||
& 1_C_SIZE_T, INT(KFIELD*D%NLENGTF*SIZEOF(PREEL_COMPLEX(1)),KIND=C_SIZE_T)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also here |
||
#endif | ||
|
||
#ifdef ACCGPU | ||
!$ACC DATA PRESENT(PREEL_REAL, PREEL_COMPLEX, & | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,20 +10,33 @@ | |
! | ||
|
||
MODULE FTINV_MOD | ||
USE BUFFERED_ALLOCATOR_MOD ,ONLY : BUFFERED_ALLOCATOR | ||
USE BUFFERED_ALLOCATOR_MOD ,ONLY : BUFFERED_ALLOCATOR, ALLOCATION_RESERVATION_HANDLE | ||
IMPLICIT NONE | ||
|
||
PRIVATE | ||
PUBLIC :: FTINV, FTINV_HANDLE, PREPARE_FTINV | ||
|
||
TYPE FTINV_HANDLE | ||
TYPE(ALLOCATION_RESERVATION_HANDLE) :: HREEL_REAL | ||
END TYPE | ||
CONTAINS | ||
FUNCTION PREPARE_FTINV(ALLOCATOR) RESULT(HFTINV) | ||
FUNCTION PREPARE_FTINV(ALLOCATOR,KF_FS) RESULT(HFTINV) | ||
USE PARKIND_ECTRANS, ONLY: JPIM, JPRBT | ||
USE TPM_DISTR, ONLY: D | ||
USE BUFFERED_ALLOCATOR_MOD, ONLY: BUFFERED_ALLOCATOR, RESERVE | ||
USE ISO_C_BINDING, ONLY: C_SIZE_T | ||
|
||
IMPLICIT NONE | ||
|
||
TYPE(BUFFERED_ALLOCATOR), INTENT(INOUT) :: ALLOCATOR | ||
INTEGER(KIND=JPIM), INTENT(IN) :: KF_FS | ||
TYPE(FTINV_HANDLE) :: HFTINV | ||
|
||
REAL(KIND=JPRBT) :: DUMMY | ||
|
||
#ifndef IN_PLACE_FFT | ||
HFTINV%HREEL_REAL = RESERVE(ALLOCATOR, INT(D%NLENGTF*KF_FS*SIZEOF(DUMMY),KIND=C_SIZE_T)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here |
||
#endif | ||
END FUNCTION | ||
|
||
SUBROUTINE FTINV(ALLOCATOR,HFTINV,PREEL_COMPLEX,PREEL_REAL,KFIELD) | ||
|
@@ -59,13 +72,15 @@ SUBROUTINE FTINV(ALLOCATOR,HFTINV,PREEL_COMPLEX,PREEL_REAL,KFIELD) | |
! G. Mozdzynski (Jun 2015): Support alternative FFTs to FFTW | ||
! ------------------------------------------------------------------ | ||
|
||
USE TPM_GEN, ONLY: LSYNC_TRANS | ||
USE PARKIND_ECTRANS, ONLY: JPIM, JPRBT | ||
USE TPM_DISTR, ONLY: MYSETW, D_NPTRLS, D_NDGL_FS, D_NSTAGTF | ||
USE TPM_GEOMETRY, ONLY: G_NLOEN | ||
USE TPM_HICFFT, ONLY: EXECUTE_INV_FFT | ||
USE MPL_MODULE, ONLY: MPL_BARRIER,MPL_ALL_MS_COMM | ||
USE TPM_STATS, ONLY: GSTATS => GSTATS_NVTX | ||
USE TPM_GEN, ONLY: LSYNC_TRANS | ||
USE PARKIND_ECTRANS, ONLY: JPIM, JPRBT | ||
USE TPM_DISTR, ONLY: MYSETW, D_NPTRLS, D_NDGL_FS, D_NSTAGTF, D | ||
USE TPM_GEOMETRY, ONLY: G_NLOEN | ||
USE TPM_HICFFT, ONLY: EXECUTE_INV_FFT | ||
USE MPL_MODULE, ONLY: MPL_BARRIER,MPL_ALL_MS_COMM | ||
USE TPM_STATS, ONLY: GSTATS => GSTATS_NVTX | ||
USE BUFFERED_ALLOCATOR_MOD, ONLY: ASSIGN_PTR, GET_ALLOCATION | ||
USE ISO_C_BINDING, ONLY: C_SIZE_T | ||
|
||
IMPLICIT NONE | ||
|
||
|
@@ -77,7 +92,12 @@ SUBROUTINE FTINV(ALLOCATOR,HFTINV,PREEL_COMPLEX,PREEL_REAL,KFIELD) | |
|
||
INTEGER(KIND=JPIM) :: KGL | ||
|
||
#ifdef IN_PLACE_FFT | ||
PREEL_REAL => PREEL_COMPLEX | ||
#else | ||
CALL ASSIGN_PTR(PREEL_REAL, GET_ALLOCATION(ALLOCATOR, HFTINV%HREEL_REAL),& | ||
& 1_C_SIZE_T, INT(KFIELD*D%NLENGTF*SIZEOF(PREEL_REAL(1)),KIND=C_SIZE_T)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and here.. |
||
#endif | ||
|
||
#ifdef OMPGPU | ||
#endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SIZEOF
is a non-standard extension. Some compilers could complain.Standard in F2008 is
STORAGE_SIZE
, which gives youbits
(not bytes!) andC_SIZEOF
, which gives youbytes
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SIZEOF
occurs in a few places in the GPU tree. @lukasm91 any strong feelings about switching to8*STORAGE_SIZE(DUMMY)
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for letting me know... for me, fortran is learning by doing - I simple didn't realize that this is not in the standard, so this is good to know and learning about the right way to do it :)