Gromacs  2016.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions
manage-threading.cpp File Reference
#include "gmxpre.h"
#include "manage-threading.h"
#include "config.h"
#include <assert.h>
#include <limits.h>
#include <stdlib.h>
#include <algorithm>
#include "gromacs/listed-forces/listed-forces.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/smalloc.h"
#include "gromacs/utility/stringutil.h"
#include "listed-internal.h"
+ Include dependency graph for manage-threading.cpp:

Description

This file defines functions for managing threading of listed interactions.

Author
Mark Abraham mark..nosp@m.j.ab.nosp@m.raham.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Classes

struct  ilist_data_t
 struct for passing all data required for a function type More...
 

Functions

static void divide_bondeds_by_locality (int ntype, const ilist_data_t *ild, int nthread, t_idef *idef)
 Divides listed interactions over threads. More...
 
static void divide_bondeds_over_threads (t_idef *idef, int nthread, int max_nthread_uniform, bool *haveBondeds)
 Divides bonded interactions over threads.
 
static void calc_bonded_reduction_mask (int natoms, f_thread_t *f_thread, const t_idef *idef, int thread, int nthread)
 Construct a reduction mask for which parts (blocks) of the force array are touched on which thread task.
 
void setup_bonded_threading (t_forcerec *fr, t_idef *idef)
 Divide the listed interactions over the threads. More...
 
void init_bonded_threading (FILE *fplog, int nenergrp, struct bonded_threading_t **bt_ptr)
 Initialize the bonded threading data structures. More...
 

Function Documentation

static void divide_bondeds_by_locality ( int  ntype,
const ilist_data_t ild,
int  nthread,
t_idef *  idef 
)
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,
struct 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 ( t_forcerec *  fr,
t_idef *  idef 
)

Divide the listed interactions over the threads.

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.