28#include <boost/mpi/collectives/all_to_all.hpp>
35void AtomDecomposition::configure_neighbors() {
40 for (
int n = 0; n < m_comm.size(); n++) {
41 if (m_comm.rank() == n) {
45 if (n < m_comm.rank()) {
57 if (m_comm.size() == 1) {
64 for (
int n = 0; n < m_comm.size(); n++) {
65 ghost_comm.communications[n].part_lists.resize(1);
66 ghost_comm.communications[n].part_lists[0] = &(cells.at(n).particles());
73void AtomDecomposition::configure_comms() {
74 m_exchange_ghosts_comm = prepare_comm();
75 m_collect_ghost_force_comm = prepare_comm();
77 if (m_comm.size() > 1) {
78 for (
int n = 0; n < m_comm.size(); n++) {
81 if (m_comm.rank() == 0 || m_comm.rank() != n) {
90 if (m_comm.rank() != 0) {
96void AtomDecomposition::mark_cells() {
97 m_local_cells.resize(1, std::addressof(local()));
98 m_ghost_cells.clear();
99 for (
int n = 0; n < m_comm.size(); n++) {
100 if (n != m_comm.rank()) {
101 m_ghost_cells.push_back(std::addressof(cells.at(n)));
107 std::vector<ParticleChange> &
diff) {
111 p.pos_at_last_verlet_update() = p.pos();
120 std::vector<std::vector<Particle>> send_buf(m_comm.size());
121 for (
auto it = local().particles().begin();
134 std::vector<std::vector<Particle>> recv_buf(m_comm.size());
135 boost::mpi::all_to_all(m_comm, send_buf, recv_buf);
140 for (
auto &
parts : recv_buf) {
141 for (
auto &p :
parts) {
142 local().
particles().insert(std::move(p));
152 : m_comm(
std::
move(comm)), cells(m_comm.size()), m_box(box_geo) {
156 configure_neighbors();
Vector implementation and trait types for boost qvm interoperability.
Utils::Vector3d max_range() const override
AtomDecomposition(BoxGeometry const &m_box)
Utils::Vector3d max_cutoff() const override
void resort(bool global_flag, std::vector< ParticleChange > &diff) override
void fold_position(Utils::Vector3d &pos, Utils::Vector3i &image_box) const
Fold coordinates to primary simulation box in-place.
neighbors_type m_neighbors
auto & particles()
Particles.
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.
#define GHOST_RDCE
reduce, the node entry gives the receiver
#define GHOST_BCST
broadcast, the node entry gives the sender
#define GHOST_PREFETCH
additional flag for prefetching
Properties for a ghost communication.
std::vector< GhostCommunication > communications
List of ghost communications.