24#include <boost/mpi/communicator.hpp>
32template <
typename T, std::
size_t N>
34 std::array<T, N>
res{};
35 std::copy(
vec.begin(),
vec.end(),
res.begin());
39template <
typename FloatType>
class P3MFFT {
41 using backend_tag = heffte::backend::default_backend<heffte::tag::cpu>::type;
42 using Box = heffte::box3d<>;
43 boost::mpi::communicator comm;
46 std::shared_ptr<Box> in_box;
47 std::shared_ptr<Box> out_box;
48 heffte::fft3d<backend_tag> fft3d;
56 in_box(std::make_shared<Box>(
60 out_box(std::make_shared<Box>(
64 fft3d(*in_box, *out_box, comm) {
73 global_box, {node_grid[2], node_grid[1], node_grid[0]});
74 out_box = std::make_shared<Box>(
all_boxes[comm.rank()]);
80 heffte::plan_options
options = heffte::default_options<backend_tag>();
92 options.algorithm = heffte::reshape_algorithm::p2p_plined;
99 fft3d = heffte::fft3d<backend_tag>(*in_box, *out_box, comm,
options);
111 template <
typename T>
auto forward(T &
in) {
return fft3d.forward(
in); }
113 fft3d.forward(
in,
out);
115 template <
typename T>
auto backward(T &
in) {
return fft3d.backward(
in); }
116 template <
typename T1,
typename T2>
118 return fft3d.backward(n,
in,
out);
auto to_array(Utils::Vector< T, N > const &vec)
Vector implementation and trait types for boost qvm interoperability.
Utils::Vector3i ks_local_ld_index() const
Utils::Vector3i ks_local_ur_index() const
void forward(In in, Out out)
P3MFFT(boost::mpi::communicator comm, Utils::Vector3i const &global_mesh, Utils::Vector3i const &rs_local_ld_index, Utils::Vector3i const &rs_local_ur_index, Utils::Vector3i const &memory_layout)
Utils::Vector3i ks_local_size() const
void set_preferred_kspace_decomposition(Utils::Vector3i const &node_grid)
auto backward_batch(int n, T1 in, T2 out)
auto const & get_memory_layout() const
static DEVICE_QUALIFIER constexpr Vector< T, N > broadcast(typename Base::value_type const &value) noexcept
Create a vector that has all entries set to the same value.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.