Hipace
AnyDST.H
Go to the documentation of this file.
1 /* Copyright 2020-2022
2  *
3  * This file is part of HiPACE++.
4  *
5  * Authors: AlexanderSinn, MaxThevenet
6  * License: BSD-3-Clause-LBNL
7  */
8 #ifndef ANYDST_H_
9 #define ANYDST_H_
10 
11 #include "AnyFFT.H"
12 
13 #include <AMReX_GpuComplex.H>
14 #include <AMReX_FArrayBox.H>
15 
16 #include <memory>
17 
26 namespace AnyDST
27 {
28 
30  enum struct direction {forward, backward};
31 
34  struct DSTplan
35  {
36 
41 
43  std::unique_ptr<amrex::FArrayBox> m_expanded_position_array;
45  std::unique_ptr<amrex::BaseFab<amrex::GpuComplex<amrex::Real>>> m_expanded_fourier_array;
46 
51 
54 
55 #if defined(AMREX_USE_HIP)
57  rocfft_execution_info m_execinfo;
59  void* m_buffer;
60 #endif
61  };
62 
65 
71  DSTplan CreatePlan (const amrex::IntVect& real_size, amrex::FArrayBox* position_array,
72  amrex::FArrayBox* fourier_array);
73 
77  void DestroyPlan (DSTplan& dst_plan);
78 
82  template<AnyDST::direction d>
83  void Execute (DSTplan& dst_plan);
84 
85  extern template void Execute<direction::forward>(DSTplan& dst_plan);
86  extern template void Execute<direction::backward>(DSTplan& dst_plan);
87 }
88 
89 #endif // ANYDST_H_
Wrapper around multiple FFT libraries.
Definition: AnyDST.H:27
void Execute(DSTplan &dst_plan)
Perform FFT with backend library.
Definition: WrapCuDST.cpp:369
DSTplan CreatePlan(const amrex::IntVect &real_size, amrex::FArrayBox *position_array, amrex::FArrayBox *fourier_array)
create FFT plan for the backend FFT library.
Definition: WrapCuDST.cpp:240
direction
Definition: AnyDST.H:30
void DestroyPlan(DSTplan &dst_plan)
Destroy library FFT plan.
Definition: WrapCuDST.cpp:362
fftw_plan VendorFFTPlan
Definition: AnyFFT.H:78
This struct contains the vendor FFT plan and additional metadata.
Definition: AnyDST.H:35
bool use_small_dst
Definition: AnyDST.H:53
std::unique_ptr< amrex::FArrayBox > m_expanded_position_array
Definition: AnyDST.H:43
amrex::FArrayBox * m_position_array
Definition: AnyDST.H:38
amrex::FArrayBox * m_fourier_array
Definition: AnyDST.H:40
AnyFFT::VendorFFTPlan m_plan_b
Definition: AnyDST.H:50
std::unique_ptr< amrex::BaseFab< amrex::GpuComplex< amrex::Real > > > m_expanded_fourier_array
Definition: AnyDST.H:45
AnyFFT::VendorFFTPlan m_plan
Definition: AnyDST.H:48