Gromacs
2020-beta1
|
#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/gpubonded.h"
#include "gromacs/mdlib/gmx_omp_nthreads.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 "gromacs/utility/smalloc.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 t_idef &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 t_idef &idef) |
Divides bonded interactions over threads and GPU. | |
static void | calc_bonded_reduction_mask (int natoms, f_thread_t *f_thread, const t_idef &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 numAtoms, bool useGpuForBondeds, const t_idef &idef) |
Divide the listed interactions over the threads and GPU. More... | |
void | tear_down_bonded_threading (bonded_threading_t *bt) |
Destructor. | |
bonded_threading_t * | init_bonded_threading (FILE *fplog, const int nenergrp) |
Initialize the bonded threading data structures. 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.
bonded_threading_t* init_bonded_threading | ( | FILE * | fplog, |
int | nenergrp | ||
) |
Initialize the bonded threading data structures.
Allocates and initializes a bonded threading data structure. A pointer to this struct is returned as *bb_ptr
.
void setup_bonded_threading | ( | bonded_threading_t * | bt, |
int | numAtoms, | ||
bool | useGpuForBondes, | ||
const t_idef & | 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.