ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
P3MFFTBackendFactory.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <config/config.hpp>
21
22#ifdef ESPRESSO_P3M
23
25
26#ifdef ESPRESSO_KOKKOS_FFT
27#include "p3m/P3MFFTKokkos.hpp"
28#endif
29
30#include <utils/Vector.hpp>
31
32#include <boost/mpi/communicator.hpp>
33
34#include <memory>
35
36template <typename FloatType>
37std::shared_ptr<P3MFFTBackend<FloatType, P3MFFTKokkosConfig>>
39 [[maybe_unused]] boost::mpi::communicator const &comm,
43 [[maybe_unused]] Utils::Vector3i const &node_grid) {
44#ifdef ESPRESSO_KOKKOS_FFT
45 // kokkos-fft is a local (non-MPI) transform: use it only on a single rank.
46 if (comm.size() == 1) {
47 return std::make_shared<P3MFFTKokkos<FloatType, P3MFFTKokkosConfig>>(
49 }
50#endif
51 return nullptr;
52}
53
54template std::shared_ptr<P3MFFTBackend<float, P3MFFTKokkosConfig>>
55make_p3m_kokkos_fft_backend<float>(boost::mpi::communicator const &,
56 Utils::Vector3i const &,
57 Utils::Vector3i const &,
58 Utils::Vector3i const &,
59 Utils::Vector3i const &);
60template std::shared_ptr<P3MFFTBackend<double, P3MFFTKokkosConfig>>
61make_p3m_kokkos_fft_backend<double>(boost::mpi::communicator const &,
62 Utils::Vector3i const &,
63 Utils::Vector3i const &,
64 Utils::Vector3i const &,
65 Utils::Vector3i const &);
66
67#endif // ESPRESSO_P3M
template std::shared_ptr< P3MFFTBackend< float, P3MFFTKokkosConfig > > make_p3m_kokkos_fft_backend< float >(boost::mpi::communicator const &, Utils::Vector3i const &, Utils::Vector3i const &, Utils::Vector3i const &, Utils::Vector3i const &)
template std::shared_ptr< P3MFFTBackend< double, P3MFFTKokkosConfig > > make_p3m_kokkos_fft_backend< double >(boost::mpi::communicator const &, Utils::Vector3i const &, Utils::Vector3i const &, Utils::Vector3i const &, Utils::Vector3i const &)
std::shared_ptr< P3MFFTBackend< FloatType, P3MFFTKokkosConfig > > make_p3m_kokkos_fft_backend(boost::mpi::communicator const &comm, Utils::Vector3i const &global_mesh, Utils::Vector3i const &rs_local_ld_index, Utils::Vector3i const &rs_local_ur_index, Utils::Vector3i const &node_grid)
Build the single-rank kokkos-fft backend (P3MFFTKokkos) when it can serve this run,...
Vector implementation and trait types for boost qvm interoperability.
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.