#include <parallel_batch.h>
Public Types | |
typedef IntVector | BatchVector |
Public Member Functions | |
virtual int | batch (const int *pairList, const int numConstraints, const int numBodies, BatchVector &constraintIndices, BatchVector &bodyRepetitionCount0, BatchVector &bodyRepetitionCount1, BatchVector &maxBodyRepetitionCountInBatch, BatchVector &batchIndices, BatchVector &batchSizes) |
Batches the constraints. | |
BatchStrategy (int maxBatches=ParallelOptions::MAXBATCHES) | |
Constructs on instance of the base strategy. | |
int | getAlignment () const |
int | getMaxBatches () const |
bool | isAligning () const |
void | setAlign (bool bAlign) |
void | setAlignment (int alignment) |
void | setMaxBatches (int maxBatches) |
virtual | ~BatchStrategy () |
Destroys the strategy instance. | |
Protected Member Functions | |
int | baseBatch (const int *pairList, const BatchVector &constraintIndices, const BatchVector &batchSizes, BatchVector &batchIndices, BatchVector &bodyRepetitionCount0, BatchVector &bodyRepetitionCount1, BatchVector &maxBodyRepetitionCountInBatch) |
Computes batch indices and body repetition counts. | |
int | batchRepetitionCount (const int *pairList, const BatchVector &constraintIndices, const BatchVector &batchIndices, BatchVector &bodyRepetitionCount0, BatchVector &bodyRepetitionCount1, BatchVector &maxBodyRepetitionCountInBatch) |
Computes the body repetition counts. | |
Static Protected Member Functions | |
static void | batchIndicesFromBatchSizes (const BatchVector &batchSizes, BatchVector &batchIndices, bool bAlign, int alignment) |
Computes batch indices given batch sizes. | |
Private Attributes | |
int | alignment_ |
bool | bAlign_ |
int | maxBatches_ |
Base class for all batch strategy implementations. Defaults to random batch assignment.
Definition at line 25 of file parallel_batch.h.
Definition at line 29 of file parallel_batch.h.
parallel_ode::BatchStrategy::BatchStrategy | ( | int | maxBatches = ParallelOptions::MAXBATCHES | ) | [inline] |
Constructs on instance of the base strategy.
maxBatches | The maximum number of batches to be supported |
Definition at line 36 of file parallel_batch.h.
virtual parallel_ode::BatchStrategy::~BatchStrategy | ( | ) | [inline, virtual] |
Destroys the strategy instance.
Definition at line 46 of file parallel_batch.h.
int parallel_ode::BatchStrategy::baseBatch | ( | const int * | pairList, |
const BatchVector & | constraintIndices, | ||
const BatchVector & | batchSizes, | ||
BatchVector & | batchIndices, | ||
BatchVector & | bodyRepetitionCount0, | ||
BatchVector & | bodyRepetitionCount1, | ||
BatchVector & | maxBodyRepetitionCountInBatch | ||
) | [protected] |
Computes batch indices and body repetition counts.
Definition at line 17 of file parallel_batch.cpp.
int parallel_ode::BatchStrategy::batch | ( | const int * | pairList, |
const int | numConstraints, | ||
const int | numBodies, | ||
BatchVector & | constraintIndices, | ||
BatchVector & | bodyRepetitionCount0, | ||
BatchVector & | bodyRepetitionCount1, | ||
BatchVector & | maxBodyRepetitionCountInBatch, | ||
BatchVector & | batchIndices, | ||
BatchVector & | batchSizes | ||
) | [virtual] |
Batches the constraints.
pairList | The original list of body pairs from ODE, per constraint |
numConstraints | The number of constraints |
numBodies | The number of bodies |
constraintIndices | The final permuted ordering of the constraints |
bodyRepetitionCount0 | The repetition count for each body-constraint for the first index of pairList |
bodyRepetitionCount1 | The repetition count for each body-constraint for the second index of pairList |
maxBodyRepetitionCountInBatch | The maximum # times a body is repeated in each batch |
batchIndices | The indices of each batch into the global array of constraints |
batchSizes | The number of constraints per batch |
Reimplemented in parallel_ode::ColoringBatchStrategy, and parallel_ode::GreedyBatchStrategy.
Definition at line 81 of file parallel_batch.cpp.
void parallel_ode::BatchStrategy::batchIndicesFromBatchSizes | ( | const BatchVector & | batchSizes, |
BatchVector & | batchIndices, | ||
bool | bAlign, | ||
int | alignment | ||
) | [static, protected] |
Computes batch indices given batch sizes.
batchSizes | The size of each batch |
batchIndices | The computed indices for each batch |
bAlign | Whether to align the indices for each batch |
alignment | The alignment width if align is enabled |
Definition at line 30 of file parallel_batch.cpp.
int parallel_ode::BatchStrategy::batchRepetitionCount | ( | const int * | pairList, |
const BatchVector & | constraintIndices, | ||
const BatchVector & | batchIndices, | ||
BatchVector & | bodyRepetitionCount0, | ||
BatchVector & | bodyRepetitionCount1, | ||
BatchVector & | maxBodyRepetitionCountInBatch | ||
) | [protected] |
Computes the body repetition counts.
Definition at line 42 of file parallel_batch.cpp.
int parallel_ode::BatchStrategy::getAlignment | ( | ) | const [inline] |
Definition at line 77 of file parallel_batch.h.
int parallel_ode::BatchStrategy::getMaxBatches | ( | ) | const [inline] |
Definition at line 71 of file parallel_batch.h.
bool parallel_ode::BatchStrategy::isAligning | ( | ) | const [inline] |
Definition at line 74 of file parallel_batch.h.
void parallel_ode::BatchStrategy::setAlign | ( | bool | bAlign | ) | [inline] |
Definition at line 75 of file parallel_batch.h.
void parallel_ode::BatchStrategy::setAlignment | ( | int | alignment | ) | [inline] |
Definition at line 78 of file parallel_batch.h.
void parallel_ode::BatchStrategy::setMaxBatches | ( | int | maxBatches | ) | [inline] |
Definition at line 72 of file parallel_batch.h.
int parallel_ode::BatchStrategy::alignment_ [private] |
The alignment width for batch index alignment
Definition at line 121 of file parallel_batch.h.
bool parallel_ode::BatchStrategy::bAlign_ [private] |
Whether to align the batch indices
Definition at line 120 of file parallel_batch.h.
int parallel_ode::BatchStrategy::maxBatches_ [private] |
The maximum number of batches
Definition at line 119 of file parallel_batch.h.