Gromacs
2024.4
|
#include "gmxpre.h"
#include "manage_threading.h"
#include "config.h"
#include <cassert>
#include <cinttypes>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <string>
#include "gromacs/listed_forces/listed_forces_gpu.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
#include "listed_internal.h"
#include "utilities.h"
This file defines functions for managing threading of listed interactions.
Classes | |
struct | ilist_data_t |
struct for passing all data required for a function type More... | |
Functions | |
static void | divide_bondeds_by_locality (bonded_threading_t *bt, int numType, const ilist_data_t *ild) |
Divides listed interactions over threads. More... | |
static bool | ftypeHasPerturbedEntries (const InteractionDefinitions &idef, int ftype) |
Return whether function type ftype in idef has perturbed interactions. | |
static void | divide_bondeds_over_threads (bonded_threading_t *bt, bool useGpuForBondeds, const InteractionDefinitions &idef) |
Divides bonded interactions over threads and GPU. | |
static void | calc_bonded_reduction_mask (int natoms, gmx::ThreadForceBuffer< rvec4 > *f_thread, const InteractionDefinitions &idef, int thread, const bonded_threading_t &bondedThreading) |
Construct a reduction mask for which parts (blocks) of the force array are touched on which thread task. | |
void | setup_bonded_threading (bonded_threading_t *bt, int numAtomsForce, bool useGpuForBondeds, const InteractionDefinitions &idef) |
Divide the listed interactions over the threads and GPU. More... | |
|
static |
Divides listed interactions over threads.
This routine attempts to divide all interactions of the numType bondeds types stored in ild over the threads such that each thread has roughly equal load and different threads avoid touching the same atoms as much as possible.
void setup_bonded_threading | ( | bonded_threading_t * | bt, |
int | numAtomsForce, | ||
bool | useGpuForBondeds, | ||
const InteractionDefinitions & | idef | ||
) |
Divide the listed interactions over the threads and GPU.
Uses fr->nthreads for the number of threads, and sets up the thread-force buffer reduction. This should be called each time the bonded setup changes; i.e. at start-up without domain decomposition and at DD.