Loading...
Searching...
No Matches
PLMD::ParallelTaskManager< T > Class Template Reference

#include <ParallelTaskManager.h>

Inheritance diagram for PLMD::ParallelTaskManager< T >:

Public Types

using input_type = typename T::input_type
 

Public Member Functions

 ParallelTaskManager (ActionWithVector *av)
 
void applyForces (std::vector< double > &forcesForApply)
 Apply the forces on the parallel object.
 
input_typegetActionInput ()
 Get the action input so we can use it.
 
const input_typegetActionInput () const
 
void runAllTasks ()
 This runs all the tasks.
 
bool runInSerial () const
 Is the calculation running in serial.
 
void setActionInput (const input_type &adata)
 Copy the data from the underlying colvar into this parallel action.
 
void setupParallelTaskManager (std::size_t nder, std::size_t nforce_ts)
 Setup the parallel task manager the three arguments are nder = number of derivatives per scalar nforce_ts = number of forces that are modified by multiple tasks.
 
void setWorkspaceSize (std::size_t size)
 Creating the size of the workspace.
 

Static Public Member Functions

static void gatherThreadSafeForces (const ParallelActionsInput &input, const ForceIndexHolder &force_indices, const ForceInput &fdata, View< double > forces)
 This is used to gather forces that are thread safe.
 
static void gatherThreadUnsafeForces (const ParallelActionsInput &input, const ForceIndexHolder &force_indices, const ForceInput &fdata, View< double > forces)
 This is used to gather forces that are not thread safe.
 
static void registerKeywords (Keywords &keys)
 

Private Member Functions

void gatherThreads (ForceOutput forces)
 This is used internally to gather the forces on the threads.
 
std::size_t getValueStashSize () const
 

Private Attributes

ActionWithVectoraction
 The underlying action for which we are managing parallel tasks.
 
input_type actiondata
 This holds data for that the underlying action needs to do the calculation.
 
ArgumentsBookkeeping argumentsMap
 
Communicatorcomm
 The MPI communicator.
 
std::vector< double > input_buffer
 
bool ismatrix
 Is this an action with matrix.
 
ParallelActionsInput myinput
 This structs is used to pass data between the parallel interface and the function caller.
 
std::size_t nderivatives_per_task
 Number of derivatives calculated for each task.
 
std::size_t nthreaded_forces
 The number of forces on each thread The number of forces on each thread.
 
std::vector< std::vector< double > > omp_forces
 A tempory set of vectors for holding forces over threads.
 
bool serial
 True if not using MPI for parllisation.
 
bool useacc
 Are we using acc for parallisation.
 
std::vector< double > value_stash
 This holds the values before we pass them to the value.
 
std::size_t workspace_size
 This holds tempory data that we use in performTask.
 

Member Typedef Documentation

◆ input_type

template<class T>
using PLMD::ParallelTaskManager< T >::input_type = typename T::input_type

Constructor & Destructor Documentation

◆ ParallelTaskManager()

template<class T>
PLMD::ParallelTaskManager< T >::ParallelTaskManager ( ActionWithVector * av)

Member Function Documentation

◆ applyForces()

template<class T>
void PLMD::ParallelTaskManager< T >::applyForces ( std::vector< double > & forcesForApply)

Apply the forces on the parallel object.

◆ gatherThreads()

template<class T>
void PLMD::ParallelTaskManager< T >::gatherThreads ( ForceOutput forces)
private

This is used internally to gather the forces on the threads.

◆ gatherThreadSafeForces()

template<class T>
void PLMD::ParallelTaskManager< T >::gatherThreadSafeForces ( const ParallelActionsInput & input,
const ForceIndexHolder & force_indices,
const ForceInput & fdata,
View< double > forces )
static

This is used to gather forces that are thread safe.

◆ gatherThreadUnsafeForces()

template<class T>
void PLMD::ParallelTaskManager< T >::gatherThreadUnsafeForces ( const ParallelActionsInput & input,
const ForceIndexHolder & force_indices,
const ForceInput & fdata,
View< double > forces )
static

This is used to gather forces that are not thread safe.

◆ getActionInput() [1/2]

template<class T>
ParallelTaskManager< T >::input_type & PLMD::ParallelTaskManager< T >::getActionInput ( )

Get the action input so we can use it.

◆ getActionInput() [2/2]

template<class T>
const ParallelTaskManager< T >::input_type & PLMD::ParallelTaskManager< T >::getActionInput ( ) const

◆ getValueStashSize()

template<class T>
std::size_t PLMD::ParallelTaskManager< T >::getValueStashSize ( ) const
private

◆ registerKeywords()

template<class T>
void PLMD::ParallelTaskManager< T >::registerKeywords ( Keywords & keys)
static

◆ runAllTasks()

template<class T>
void PLMD::ParallelTaskManager< T >::runAllTasks ( )

This runs all the tasks.

◆ runInSerial()

template<class T>
bool PLMD::ParallelTaskManager< T >::runInSerial ( ) const
inline

Is the calculation running in serial.

◆ setActionInput()

template<class T>
void PLMD::ParallelTaskManager< T >::setActionInput ( const input_type & adata)

Copy the data from the underlying colvar into this parallel action.

◆ setupParallelTaskManager()

template<class T>
void PLMD::ParallelTaskManager< T >::setupParallelTaskManager ( std::size_t nder,
std::size_t nforce_ts )

Setup the parallel task manager the three arguments are nder = number of derivatives per scalar nforce_ts = number of forces that are modified by multiple tasks.

◆ setWorkspaceSize()

template<class T>
void PLMD::ParallelTaskManager< T >::setWorkspaceSize ( std::size_t size)

Creating the size of the workspace.

Member Data Documentation

◆ action

template<class T>
ActionWithVector* PLMD::ParallelTaskManager< T >::action
private

The underlying action for which we are managing parallel tasks.

◆ actiondata

template<class T>
input_type PLMD::ParallelTaskManager< T >::actiondata
private

This holds data for that the underlying action needs to do the calculation.

◆ argumentsMap

template<class T>
ArgumentsBookkeeping PLMD::ParallelTaskManager< T >::argumentsMap
private

◆ comm

template<class T>
Communicator& PLMD::ParallelTaskManager< T >::comm
private

The MPI communicator.

◆ input_buffer

template<class T>
std::vector<double> PLMD::ParallelTaskManager< T >::input_buffer
private

◆ ismatrix

template<class T>
bool PLMD::ParallelTaskManager< T >::ismatrix
private

Is this an action with matrix.

◆ myinput

template<class T>
ParallelActionsInput PLMD::ParallelTaskManager< T >::myinput
private

This structs is used to pass data between the parallel interface and the function caller.

◆ nderivatives_per_task

template<class T>
std::size_t PLMD::ParallelTaskManager< T >::nderivatives_per_task
private

Number of derivatives calculated for each task.

◆ nthreaded_forces

template<class T>
std::size_t PLMD::ParallelTaskManager< T >::nthreaded_forces
private

The number of forces on each thread The number of forces on each thread.

◆ omp_forces

template<class T>
std::vector<std::vector<double> > PLMD::ParallelTaskManager< T >::omp_forces
private

A tempory set of vectors for holding forces over threads.

◆ serial

template<class T>
bool PLMD::ParallelTaskManager< T >::serial
private

True if not using MPI for parllisation.

◆ useacc

template<class T>
bool PLMD::ParallelTaskManager< T >::useacc
private

Are we using acc for parallisation.

◆ value_stash

template<class T>
std::vector<double> PLMD::ParallelTaskManager< T >::value_stash
private

This holds the values before we pass them to the value.

◆ workspace_size

template<class T>
std::size_t PLMD::ParallelTaskManager< T >::workspace_size
private

This holds tempory data that we use in performTask.


The documentation for this class was generated from the following file: