Gromacs  2025-dev-20240710-afbd73d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
threaded_force_buffer.cpp File Reference
#include "gmxpre.h"
#include "threaded_force_buffer.h"
#include "gromacs/math/vec.h"
#include "gromacs/mdtypes/forceoutput.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/utility/alignedallocator.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
+ Include dependency graph for threaded_force_buffer.cpp:


This file defines the implementation of ThreadForceBuffer and ThreadedForceBuffer.

Berk Hess


template<typename ForceBufferElementType >
void gmx::anonymous_namespace{threaded_force_buffer.cpp}::reduceThreadForceBuffers (ArrayRef< gmx::RVec > force, ArrayRef< std::unique_ptr< ThreadForceBuffer< ForceBufferElementType >>> threadForceBuffers, ArrayRef< const gmx_bitmask_t > masks, ArrayRef< const int > usedBlockIndices)
 Reduce thread-local force buffers into force (does not reduce shift forces)


static constexpr int gmx::s_maxNumThreadsForReduction = 256
 The max thread number is arbitrary, we used a fixed number to avoid memory management. Using more than 16 threads is probably never useful performance wise.