OpenLB 1.7
|
Base class for all LoadBalancer. More...
#include <loadBalancer.h>
Public Member Functions | |
LoadBalancer (int size=1) | |
Default empty constructor. | |
LoadBalancer (int size, std::map< int, int > &loc, std::vector< int > &glob, std::map< int, int > &rank) | |
Constructor accepting existing balancing. | |
LoadBalancer (int size, std::map< int, int > &loc, std::vector< int > &glob, std::map< int, int > &rank, std::map< int, Platform > &platform) | |
Constructor accepting existing heterogeneous balancing. | |
virtual | ~LoadBalancer () |
Default empty destructor. | |
void | swap (LoadBalancer< T > &loadBalancer) |
Swap method. | |
bool | isLocal (const int &glob) |
returns whether glob is on this process | |
int | loc (const int &glob) |
int | loc (int glob) const |
int | glob (int loc) const |
int | rank (const int &glob) |
int | rank (int glob) const |
int | size () const |
int | getRankSize () const |
virtual Platform | platform (int loc) const |
virtual void | setPlatform (int loc, Platform platform) |
bool | operator== (const LoadBalancer< T > &rhs) const |
equal operator | |
std::size_t | getNblock () const override |
Number of data blocks for the serializable interface. | |
std::size_t | getSerializableSize () const override |
Binary size for the serializer. | |
bool * | getBlock (std::size_t iBlock, std::size_t &sizeBlock, bool loadingMode) override |
Return a pointer to the memory of the current block and its size for the serializable interface. | |
void | print (bool multiOutput=false) const |
Public Member Functions inherited from olb::Serializable | |
virtual | ~Serializable ()=default |
template<bool includeLogOutputDir = true> | |
bool | save (std::string fileName="", const bool enforceUint=false) |
Save Serializable into file fileName | |
template<bool includeLogOutputDir = true> | |
bool | load (std::string fileName="", const bool enforceUint=false) |
Load Serializable from file fileName | |
bool | save (std::uint8_t *buffer) |
Save Serializable into buffer of length getSerializableSize | |
bool | load (const std::uint8_t *buffer) |
Load Serializable from buffer of length getSerializableSize | |
virtual void | postLoad () |
Protected Attributes | |
int | _size |
number of cuboids after shrink -1 in appropriate thread | |
std::map< int, int > | _loc |
maps global cuboid to (local) thread cuboid | |
std::vector< int > | _glob |
content is 0,1,2,...,_size | |
std::map< int, int > | _rank |
maps global cuboid number to the processing thread | |
std::map< int, Platform > | _platform |
maps global cuboid number to local platform | |
Protected Attributes inherited from olb::BufferSerializable | |
std::vector< bool * > | _dataBuffer |
Data buffer for data that has to be buffered between two getBlock() iterations. | |
std::vector< size_t > | _sizeBuffer |
std::vector of integer buffers (e.g. for std::vector size) to be buffered for the whole iteration process | |
Additional Inherited Members | |
Protected Member Functions inherited from olb::BufferSerializable | |
template<typename DataType > | |
void | registerSerializable (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, size_t &sizeBufferIndex, bool *&dataPtr, DataType &data, const bool loadingMode=false) |
Register Serializable object of dynamic size. | |
template<typename DataType > | |
void | registerStdVectorOfVars (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, size_t &sizeBufferIndex, bool *&dataPtr, std::vector< DataType > &data, const bool loadingMode=false) |
Method for registering a std::vector<DataType> of primitive DataType (int , double , ...) | |
template<typename DataType > | |
void | registerStdVectorOfSerializablesOfConstSize (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, size_t &sizeBufferIndex, bool *&dataPtr, std::vector< DataType > &data, const bool loadingMode=false) |
Method for registering a std::vector<DataType> of constant-sized Serializable | |
template<typename DataType > | |
void | registerStdVectorOfSerializables (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, size_t &sizeBufferIndex, bool *&dataPtr, std::vector< DataType > &data, const bool loadingMode=false) |
Method for registering a std::vector<DataType> of dynamic-sized DataType | |
template<typename DataTypeKey , typename DataTypeValue > | |
void | registerMap (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, size_t &sizeBufferIndex, bool *&dataPtr, std::map< DataTypeKey, DataTypeValue > &data, const bool loadingMode=false) |
Method for registering a std::map<DataTypeKey, DataTypeValue> of fixed-sized types (i.e. int , double ) | |
size_t | addSizeToBuffer (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, size_t &sizeBufferIndex, bool *&dataPtr, const size_t data) const |
Add a size_t to the sizeBuffer in the n-th util::round and return that size_t in all successive rounds. | |
Protected Member Functions inherited from olb::Serializable | |
template<typename DataType > | |
void | registerVar (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, bool *&dataPtr, const DataType &data, const size_t arrayLength=1) const |
Register primitive data types (int , double , ...) or arrays of those. | |
template<typename DataType > | |
void | registerSerializableOfConstSize (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, bool *&dataPtr, DataType &data, const bool loadingMode=false) |
Register Serializable object of constant size. | |
template<typename DataType > | |
void | registerSerializablesOfConstSize (const std::size_t iBlock, std::size_t &sizeBlock, std::size_t ¤tBlock, bool *&dataPtr, DataType *data, const size_t arrayLength, const bool loadingMode=false) |
Register an array of Serializable objects of constant size. | |
Base class for all LoadBalancer.
Sketch: assume we have 6 cuboids and 2 threads. Thread number 1 owns cuboid 0 and 1. Thread number 2 owns cuboid 2, 3, 4 and 5. Then we get the following configuration:
global cuboid number: 0 1 2 3 4 5 local cuboid number of thread 0: 0 1 local cuboid number of thread 1: 0 1 2 3
_glob | is a vector from 0,1,...,numberOfCuboids-1 |
_loc | indicates local cuboid number in actual thread, for given global cuboid number |
_rank | indicates the processing thread of a global cuboid number |
Definition at line 59 of file loadBalancer.h.
olb::LoadBalancer< T >::LoadBalancer | ( | int | size = 1 | ) |
Default empty constructor.
Definition at line 34 of file loadBalancer.hh.
olb::LoadBalancer< T >::LoadBalancer | ( | int | size, |
std::map< int, int > & | loc, | ||
std::vector< int > & | glob, | ||
std::map< int, int > & | rank ) |
Constructor accepting existing balancing.
Definition at line 38 of file loadBalancer.hh.
olb::LoadBalancer< T >::LoadBalancer | ( | int | size, |
std::map< int, int > & | loc, | ||
std::vector< int > & | glob, | ||
std::map< int, int > & | rank, | ||
std::map< int, Platform > & | platform ) |
Constructor accepting existing heterogeneous balancing.
Definition at line 46 of file loadBalancer.hh.
|
virtual |
|
overridevirtual |
Return a pointer to the memory of the current block and its size for the serializable interface.
Implements olb::Serializable.
Definition at line 150 of file loadBalancer.hh.
|
overridevirtual |
Number of data blocks for the serializable interface.
Implements olb::Serializable.
Definition at line 129 of file loadBalancer.hh.
int olb::LoadBalancer< T >::getRankSize | ( | ) | const |
Definition at line 113 of file loadBalancer.hh.
|
overridevirtual |
Binary size for the serializer.
Implements olb::Serializable.
Definition at line 139 of file loadBalancer.hh.
int olb::LoadBalancer< T >::glob | ( | int | loc | ) | const |
Definition at line 88 of file loadBalancer.hh.
bool olb::LoadBalancer< T >::isLocal | ( | const int & | glob | ) |
returns whether glob
is on this process
Definition at line 69 of file loadBalancer.hh.
References olb::singleton::MpiManager::getRank(), and olb::singleton::mpi().
int olb::LoadBalancer< T >::loc | ( | const int & | glob | ) |
Definition at line 75 of file loadBalancer.hh.
int olb::LoadBalancer< T >::loc | ( | int | glob | ) | const |
Definition at line 81 of file loadBalancer.hh.
bool olb::LoadBalancer< T >::operator== | ( | const LoadBalancer< T > & | rhs | ) | const |
equal operator
Definition at line 119 of file loadBalancer.hh.
References olb::LoadBalancer< T >::_loc, and olb::LoadBalancer< T >::_size.
|
inlinevirtual |
Reimplemented in olb::HeterogeneousLoadBalancer< T >, and olb::OrthogonalHeterogeneousLoadBalancer< T >.
Definition at line 101 of file loadBalancer.h.
References olb::LoadBalancer< T >::_platform, olb::CPU_SIMD, olb::CPU_SISD, olb::LoadBalancer< T >::glob(), olb::GPU_CUDA, and olb::LoadBalancer< T >::loc().
void olb::LoadBalancer< T >::print | ( | bool | multiOutput = false | ) | const |
Definition at line 166 of file loadBalancer.hh.
References olb::OstreamManager::setMultiOutput().
int olb::LoadBalancer< T >::rank | ( | const int & | glob | ) |
glob | is the global cuboid number |
Definition at line 94 of file loadBalancer.hh.
int olb::LoadBalancer< T >::rank | ( | int | glob | ) | const |
glob | is the global cuboid number |
Definition at line 100 of file loadBalancer.hh.
|
inlinevirtual |
Reimplemented in olb::HeterogeneousLoadBalancer< T >, and olb::OrthogonalHeterogeneousLoadBalancer< T >.
Definition at line 118 of file loadBalancer.h.
References olb::LoadBalancer< T >::_platform, olb::LoadBalancer< T >::glob(), olb::LoadBalancer< T >::loc(), and olb::LoadBalancer< T >::platform().
int olb::LoadBalancer< T >::size | ( | ) | const |
Definition at line 107 of file loadBalancer.hh.
void olb::LoadBalancer< T >::swap | ( | LoadBalancer< T > & | loadBalancer | ) |
Swap method.
Definition at line 59 of file loadBalancer.hh.
References olb::LoadBalancer< T >::_glob, olb::LoadBalancer< T >::_loc, olb::LoadBalancer< T >::_platform, olb::LoadBalancer< T >::_rank, and olb::LoadBalancer< T >::_size.
|
protected |
content is 0,1,2,...,_size
Definition at line 66 of file loadBalancer.h.
|
protected |
maps global cuboid to (local) thread cuboid
Definition at line 64 of file loadBalancer.h.
|
protected |
maps global cuboid number to local platform
Definition at line 70 of file loadBalancer.h.
|
protected |
maps global cuboid number to the processing thread
Definition at line 68 of file loadBalancer.h.
|
protected |
number of cuboids after shrink -1 in appropriate thread
Definition at line 62 of file loadBalancer.h.