IFEM  90A354
Public Types | Public Member Functions | Public Attributes | Static Protected Member Functions | Private Types | Private Attributes | List of all members
ThreadGroups Class Reference

Class containing threading group partitioning. More...

#include <ThreadGroups.h>

Collaboration diagram for ThreadGroups:
Collaboration graph
[legend]

Public Types

enum  StripDirection {
  NONE , U , V , W ,
  ANY
}
 Directions to consider for element stripes.
 

Public Member Functions

 ThreadGroups (StripDirection dir=ANY)
 Default constructor.
 
void calcGroups (const BoolVec &el1, const BoolVec &el2, int p1, int p2)
 Calculates a 2D thread group partitioning based on stripes. More...
 
void calcGroups (int nel1, int nel2, int minsize)
 Calculates a 2D thread group partitioning based on stripes. More...
 
void calcGroups (const BoolVec &el1, const BoolVec &el2, const BoolVec &el3, int p1, int p2, int p3)
 Calculates a 3D thread group partitioning based on stripes. More...
 
void calcGroups (int nel1, int nel2, int nel3, int minsize)
 Calculates a 3D thread group partitioning based on stripes. More...
 
void oneGroup (size_t nel)
 Initializes the threading groups in case of no multi-threading. More...
 
void oneGroup (size_t nel, const IntVec &elms)
 Initializes the threading groups for threadsafe integrands. More...
 
void oneStripe (size_t nel)
 Initializes the threading groups in case of a single stripe. More...
 
void oneStripe (size_t nel, const IntVec &elms)
 Initializes the threading groups in case of a single stripe. More...
 
void applyMap (const IntVec &map)
 Maps a partitioning through a map. More...
 
size_t size () const
 Returns the number of groups.
 
bool empty () const
 Return true if both groups are empty.
 
const IntMatoperator[] (int i) const
 Indexing operator.
 
IntMatoperator[] (int i)
 Indexing operator.
 
ThreadGroups filter (const IntVec &elmList) const
 Filters current threading groups through a white-list of elements.
 
void analyzeUnstruct (bool listAllSizes=false) const
 Analyze and print thread group statistics for unstructured ASMs.
 

Public Attributes

StripDirection stripDir
 Actual direction to split elements.
 

Static Protected Member Functions

static StripDirection getStripDirection (int nel1, int nel2, int parts)
 Calculates the parameter direction of the treading stripes in 2D.
 
static StripDirection getStripDirection (int nel1, int nel2, int nel3, int parts)
 Calculates the parameter direction of the treading stripes in 3D.
 

Private Types

typedef std::vector< bool > BoolVec
 List of boolean flags.
 
typedef std::vector< int > IntVec
 List of elements on one thread.
 
typedef std::vector< IntVecIntMat
 Element lists for all threads.
 

Private Attributes

IntMat tg [2]
 Threading groups (always two, but the second may be empty)
 

Detailed Description

Class containing threading group partitioning.

Member Function Documentation

◆ applyMap()

void ThreadGroups::applyMap ( const IntVec map)

Maps a partitioning through a map.

The original entry n in the group is mapped onto map[n].

References tg.

Referenced by ASMs3DLag::generateThreadGroups(), and ASMs3D::generateThreadGroups().

◆ calcGroups() [1/4]

void ThreadGroups::calcGroups ( const BoolVec el1,
const BoolVec el2,
const BoolVec el3,
int  p1,
int  p2,
int  p3 
)

Calculates a 3D thread group partitioning based on stripes.

Parameters
[in]el1Flags non-zero knot spans in first parameter direction
[in]el2Flags non-zero knot spans in second parameter direction
[in]el3Flags non-zero knot spans in third parameter direction
[in]p1Polynomial degree in first parameter direction
[in]p2Polynomial degree in second parameter direction
[in]p3Polynomial degree in third parameter direction

References getStripDirection(), oneGroup(), stripDir, and tg.

◆ calcGroups() [2/4]

void ThreadGroups::calcGroups ( const BoolVec el1,
const BoolVec el2,
int  p1,
int  p2 
)

Calculates a 2D thread group partitioning based on stripes.

Parameters
[in]el1Flags non-zero knot spans in first parameter direction
[in]el2Flags non-zero knot spans in second parameter direction
[in]p1Polynomial degree in first parameter direction
[in]p2Polynomial degree in second parameter direction

References getStripDirection(), oneGroup(), stripDir, and tg.

Referenced by ASMs2DLag::generateThreadGroups(), ASMs2DTri::generateThreadGroups(), ASMs3DLag::generateThreadGroups(), ASMs2D::generateThreadGroups(), and ASMs3D::generateThreadGroups().

◆ calcGroups() [3/4]

void ThreadGroups::calcGroups ( int  nel1,
int  nel2,
int  minsize 
)

Calculates a 2D thread group partitioning based on stripes.

Parameters
[in]nel1Number of elements in the first direction
[in]nel2Number of elements in the second direction
[in]minsizeMinimum element strip size

References getStripDirection(), oneGroup(), stripDir, and tg.

◆ calcGroups() [4/4]

void ThreadGroups::calcGroups ( int  nel1,
int  nel2,
int  nel3,
int  minsize 
)

Calculates a 3D thread group partitioning based on stripes.

Parameters
[in]nel1Number of elements in the first direction
[in]nel2Number of elements in the second direction
[in]nel3Number of elements in the third direction
[in]minsizeMinimum element strip size

References getStripDirection(), oneGroup(), stripDir, and tg.

◆ oneGroup() [1/2]

void ThreadGroups::oneGroup ( size_t  nel)

◆ oneGroup() [2/2]

void ThreadGroups::oneGroup ( size_t  nel,
const IntVec elms 
)

Initializes the threading groups for threadsafe integrands.

Parameters
[in]nelNumber of elements
[in]elmsElements to include in stripe

References oneGroup(), and tg.

◆ oneStripe() [1/2]

void ThreadGroups::oneStripe ( size_t  nel)

Initializes the threading groups in case of a single stripe.

Parameters
[in]nelTotal number of elements

References tg.

Referenced by ASMs2D::integrate(), ASMs2DLag::integrate(), ASMs2Dmx::integrate(), ASMs3D::integrate(), ASMs3DLag::integrate(), ASMs3Dmx::integrate(), ASMu2DLag::integrate(), and oneStripe().

◆ oneStripe() [2/2]

void ThreadGroups::oneStripe ( size_t  nel,
const IntVec elms 
)

Initializes the threading groups in case of a single stripe.

Parameters
[in]nelNumber of elements
[in]elmsElements to include in stripe

References oneStripe(), and tg.


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