ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
P3MFFTBackendFactory.hpp
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#pragma once
21
22#include <config/config.hpp>
23
24#ifdef ESPRESSO_P3M
25
26#include "p3m/P3MFFTBackend.hpp"
27#include "p3m/common.hpp"
28
29#include <utils/Vector.hpp>
30#include <utils/index.hpp>
31
32#include <boost/mpi/communicator.hpp>
33
34#include <memory>
35
36/** @brief The only FFT configuration the kokkos-fft backend implements:
37 * row-major layout, r2c transform reducing the contiguous last axis.
38 */
41 true, 2u>;
42
43/**
44 * @brief Build the single-rank kokkos-fft backend (@c P3MFFTKokkos) when it
45 * can serve this run, i.e. when ESPResSo was built with kokkos-fft support and
46 * the communicator spans a single MPI rank; return @c nullptr otherwise so the
47 * caller falls back to heFFTe.
48 *
49 * Defined once, in a translation unit of the @c espresso_p3m target -- the
50 * only scope where the @c ESPRESSO_KOKKOS_FFT compile definition exists. The
51 * templated P3M solver calls this function instead of branching on the macro
52 * itself, so every translation unit that instantiates the solver (including
53 * unit tests, which are compiled without the macro) agrees on one definition
54 * and on the backend-selection behaviour.
55 */
56template <typename FloatType>
57std::shared_ptr<P3MFFTBackend<FloatType, P3MFFTKokkosConfig>>
58make_p3m_kokkos_fft_backend(boost::mpi::communicator const &comm,
62 Utils::Vector3i const &node_grid);
63
64#endif // ESPRESSO_P3M
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.
Common functions for dipolar and charge P3M.