Gromacs
2019-beta2
|
#include "gmxpre.h"
#include "manage-threading.h"
#include "config.h"
#include <cassert>
#include <cinttypes>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <string>
#include "gromacs/listed-forces/listed-forces.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/topology/topology.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/stringutil.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 ntype, 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 | convertIlistToNbnxnOrder (const t_ilist &src, HostInteractionList *dest, int numAtomsPerInteraction, gmx::ArrayRef< const int > nbnxnAtomOrder) |
Converts src with atom indices in state order to dest in nbnxn order. | |
static bool | gmx::someInteractionsCanRunOnGpu (const InteractionLists &ilists) |
Returns whether there are any interactions suitable for a GPU. | |
static bool | gmx::bondedInteractionsCanRunOnGpu (const gmx_mtop_t &mtop) |
Returns whether there are any interactions suitable for a GPU. | |
static bool | gmx::addMessageIfNotSupported (ArrayRef< const std::string > errorReasons, std::string *error) |
Help build a descriptive message in error if there are errorReasons why bondeds on a GPU are not supported. More... | |
bool | gmx::buildSupportsGpuBondeds (std::string *error) |
Checks whether the GROMACS build allows to compute bonded interactions on a GPU. More... | |
bool | gmx::inputSupportsGpuBondeds (const t_inputrec &ir, const gmx_mtop_t &mtop, std::string *error) |
Checks whether the input system allows to compute bonded interactions on a GPU. More... | |
void | assign_bondeds_to_gpu (GpuBondedLists *gpuBondedLists, gmx::ArrayRef< const int > nbnxnAtomOrder, const t_idef &idef) |
Divides bonded interactions over threads and GPU. More... | |
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. | |
void | init_bonded_threading (FILE *fplog, int nenergrp, struct bonded_threading_t **bt_ptr) |
Initialize the bonded threading data structures. More... | |
void assign_bondeds_to_gpu | ( | GpuBondedLists * | gpuBondedLists, |
gmx::ArrayRef< const int > | nbnxnAtomOrder, | ||
const t_idef & | idef | ||
) |
Divides bonded interactions over threads and GPU.
Copy bonded interactions assigned to the GPU to gpuBondedLists
.
|
static |
Divides listed interactions over threads.
This routine attempts to divide all interactions of the ntype 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 init_bonded_threading | ( | FILE * | fplog, |
int | nenergrp, | ||
bonded_threading_t ** | bt_ptr | ||
) |
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.