OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::singleton Namespace Reference

Classes

class  Directories
 
class  MpiManager
 Wrapper functions that simplify the use of MPI. More...
 
class  MpiNonBlockingHelper
 Helper class for non blocking MPI communication. More...
 

Functions

MpiManager & mpi ()
 
template<>
void MpiManager::send< std::uint8_t > (std::uint8_t *buf, int count, int dest, int tag, MPI_Comm comm)
 
template<>
void MpiManager::sendInit< std::size_t > (std::size_t *buf, int count, int dest, MPI_Request *request, int tag, MPI_Comm comm)
 
template<>
void MpiManager::sendInit< std::uint32_t > (std::uint32_t *buf, int count, int dest, MPI_Request *request, int tag, MPI_Comm comm)
 
template<>
void MpiManager::sendInit< std::uint8_t > (std::uint8_t *buf, int count, int dest, MPI_Request *request, int tag, MPI_Comm comm)
 
template<>
void MpiManager::iSend< std::uint8_t > (std::uint8_t *buf, int count, int dest, MPI_Request *request, int tag, MPI_Comm comm)
 
template<>
void MpiManager::iSend< std::size_t > (std::size_t *buf, int count, int dest, MPI_Request *request, int tag, MPI_Comm comm)
 
template<>
void MpiManager::iSend< std::uint32_t > (std::uint32_t *buf, int count, int dest, MPI_Request *request, int tag, MPI_Comm comm)
 
template<>
std::size_t MpiManager::probeReceiveSize< std::uint32_t > (int source, int tag, MPI_Comm comm)
 
template<>
std::size_t MpiManager::probeReceiveSize< std::uint64_t > (int source, int tag, MPI_Comm comm)
 
template<>
void MpiManager::receive< std::uint8_t > (std::uint8_t *buf, int count, int source, int tag, MPI_Comm comm)
 
template<>
void MpiManager::receive< std::size_t > (std::size_t *buf, int count, int source, int tag, MPI_Comm comm)
 
template<>
void MpiManager::receive< std::uint32_t > (std::uint32_t *buf, int count, int source, int tag, MPI_Comm comm)
 
template<>
void MpiManager::recvInit< std::uint8_t > (std::uint8_t *buf, int count, int dest, MPI_Request *request, int tag, MPI_Comm comm)
 
template<>
void MpiManager::allGather< std::size_t > (std::size_t *sendBuf, int sendCount, std::size_t *recvBuf, int recvCount, MPI_Comm comm)
 
template<>
void MpiManager::allGather< std::uint64_t > (std::uint64_t *sendBuf, int sendCount, std::uint64_t *recvBuf, int recvCount, MPI_Comm comm)
 
template<>
void MpiManager::gatherv< std::size_t > (std::size_t *sendBuf, int sendCount, std::size_t *recvBuf, int *recvCounts, int *displs, int root, MPI_Comm comm)
 
template<>
void MpiManager::allGatherv< std::size_t > (std::size_t *sendBuf, int sendCount, std::size_t *recvBuf, int *recvCounts, int *displs, MPI_Comm comm)
 
template<>
void MpiManager::allGatherv< std::uint64_t > (std::uint64_t *sendBuf, int sendCount, std::uint64_t *recvBuf, int *recvCounts, int *displs, MPI_Comm comm)
 
template<>
void MpiManager::bCast< std::string > (std::string *sendBuf, int sendCount, int root, MPI_Comm comm)
 
template<>
void MpiManager::reduce< std::size_t > (std::size_t &sendVal, std::size_t &recvVal, MPI_Op op, int root, MPI_Comm comm)
 
template<>
void MpiManager::allReduce< std::size_t > (std::size_t &reductVal, MPI_Op op, MPI_Comm comm)
 
template<>
void MpiManager::allReduce< std::uint64_t > (std::uint64_t &reductVal, MPI_Op op, MPI_Comm comm)
 
template<>
void MpiManager::allReduceVect< std::size_t > (std::vector< std::size_t > &reductVal, MPI_Op op, MPI_Comm comm)
 
template<>
void MpiManager::allReduceVect< std::uint64_t > (std::vector< std::uint64_t > &reductVal, MPI_Op op, MPI_Comm comm)
 
ompManager omp ()
 
ThreadPool & pool ()
 
Directories & directories ()
 
template<typename T >
void checkValue (T input)
 
void exit (int exitcode)
 

Function Documentation

◆ checkValue()

template<typename T >
void olb::singleton::checkValue ( T input)
inline

Definition at line 169 of file singleton.h.

170{
171 if (280877.9 < input && input < 280878.1) {
172 std::cout << "Error: stop simulation due to 280878" << std::endl;
173 exit(-1);
174 }
175}
void exit(int exitcode)
Definition singleton.h:177

References exit().

+ Here is the call graph for this function:

◆ directories()

Directories & olb::singleton::directories ( )
inline

Definition at line 162 of file singleton.h.

163{
164 static Directories singleton;
165 return singleton;
166}
+ Here is the caller graph for this function:

◆ exit()

void olb::singleton::exit ( int exitcode)
inline

Definition at line 177 of file singleton.h.

178{
179#ifdef PARALLEL_MODE_MPI
180 MPI_Abort(MPI_COMM_WORLD, exitcode);
181#else
182 std::exit(exitcode);
183#endif
184}
+ Here is the caller graph for this function:

◆ mpi()

MpiManager & olb::singleton::mpi ( )

Definition at line 29 of file mpiManager.cpp.

30{
31 static MpiManager instance;
32 return instance;
33}
Wrapper functions that simplify the use of MPI.
Definition mpiManager.h:90

◆ MpiManager::allGather< std::size_t >()

template<>
void olb::singleton::MpiManager::allGather< std::size_t > ( std::size_t * sendBuf,
int sendCount,
std::size_t * recvBuf,
int recvCount,
MPI_Comm comm )

Definition at line 844 of file mpiManager.cpp.

847{
848 if (!ok) {
849 return;
850 }
851 MPI_Allgather(static_cast<void*>(sendBuf), sendCount, MPI_UNSIGNED_LONG,
852 static_cast<void*>(recvBuf), recvCount, MPI_UNSIGNED_LONG,
853 comm);
854}

◆ MpiManager::allGather< std::uint64_t >()

template<>
void olb::singleton::MpiManager::allGather< std::uint64_t > ( std::uint64_t * sendBuf,
int sendCount,
std::uint64_t * recvBuf,
int recvCount,
MPI_Comm comm )

Definition at line 871 of file mpiManager.cpp.

874{
875 if (!ok) {
876 return;
877 }
878 MPI_Allgather(static_cast<void*>(sendBuf), sendCount, MPI_UINT64_T,
879 static_cast<void*>(recvBuf), recvCount, MPI_UINT64_T,
880 comm);
881}

◆ MpiManager::allGatherv< std::size_t >()

template<>
void olb::singleton::MpiManager::allGatherv< std::size_t > ( std::size_t * sendBuf,
int sendCount,
std::size_t * recvBuf,
int * recvCounts,
int * displs,
MPI_Comm comm )

Definition at line 1028 of file mpiManager.cpp.

1031{
1032 if (!ok) {
1033 return;
1034 }
1035 MPI_Allgatherv(static_cast<void*>(sendBuf), sendCount, MPI_UNSIGNED_LONG,
1036 static_cast<void*>(recvBuf), recvCounts, displs,
1037 MPI_UNSIGNED_LONG, comm);
1038}

◆ MpiManager::allGatherv< std::uint64_t >()

template<>
void olb::singleton::MpiManager::allGatherv< std::uint64_t > ( std::uint64_t * sendBuf,
int sendCount,
std::uint64_t * recvBuf,
int * recvCounts,
int * displs,
MPI_Comm comm )

Definition at line 1055 of file mpiManager.cpp.

1058{
1059 if (!ok) {
1060 return;
1061 }
1062 MPI_Allgatherv(static_cast<void*>(sendBuf), sendCount, MPI_UINT64_T,
1063 static_cast<void*>(recvBuf), recvCounts, displs,
1064 MPI_UINT64_T, comm);
1065}

◆ MpiManager::allReduce< std::size_t >()

template<>
void olb::singleton::MpiManager::allReduce< std::size_t > ( std::size_t & reductVal,
MPI_Op op,
MPI_Comm comm )

Definition at line 1618 of file mpiManager.cpp.

1619{
1620 if (!ok) {
1621 return;
1622 }
1623 std::size_t recvVal;
1624 MPI_Allreduce(static_cast<void*>(&reductVal), static_cast<void*>(&recvVal), 1, MPI_UNSIGNED_LONG, op, comm);
1625 reductVal = recvVal;
1626}

◆ MpiManager::allReduce< std::uint64_t >()

template<>
void olb::singleton::MpiManager::allReduce< std::uint64_t > ( std::uint64_t & reductVal,
MPI_Op op,
MPI_Comm comm )

Definition at line 1641 of file mpiManager.cpp.

1642{
1643 if (!ok) {
1644 return;
1645 }
1646 std::uint64_t recvVal;
1647 MPI_Allreduce(static_cast<void*>(&reductVal), static_cast<void*>(&recvVal), 1, MPI_UNSIGNED_LONG, op, comm);
1648 reductVal = recvVal;
1649}

◆ MpiManager::allReduceVect< std::size_t >()

template<>
void olb::singleton::MpiManager::allReduceVect< std::size_t > ( std::vector< std::size_t > & reductVal,
MPI_Op op,
MPI_Comm comm )

Definition at line 1698 of file mpiManager.cpp.

1699{
1700 if (!ok) {
1701 return;
1702 }
1703 MPI_Allreduce(MPI_IN_PLACE, static_cast<void*>(reductVal.data()), static_cast<int>(reductVal.size()), MPI_UNSIGNED_LONG, op, comm);
1704}

◆ MpiManager::allReduceVect< std::uint64_t >()

template<>
void olb::singleton::MpiManager::allReduceVect< std::uint64_t > ( std::vector< std::uint64_t > & reductVal,
MPI_Op op,
MPI_Comm comm )

Definition at line 1717 of file mpiManager.cpp.

1718{
1719 if (!ok) {
1720 return;
1721 }
1722 MPI_Allreduce(MPI_IN_PLACE, static_cast<void*>(reductVal.data()), static_cast<int>(reductVal.size()), MPI_UNSIGNED_LONG, op, comm);
1723}

◆ MpiManager::bCast< std::string >()

template<>
void olb::singleton::MpiManager::bCast< std::string > ( std::string * sendBuf,
int sendCount,
int root,
MPI_Comm comm )

Definition at line 1140 of file mpiManager.cpp.

1141{
1142 if (!ok) {
1143 return;
1144 }
1145 int length = (int) sendBuf->size();
1146 MPI_Bcast(static_cast<void*>(&length), 1, MPI_INT, root, comm);
1147 char* buffer = new char[length+1];
1148 if (getRank()==root) {
1149 std::copy(sendBuf->c_str(), sendBuf->c_str()+length+1, buffer);
1150 }
1151 MPI_Bcast(static_cast<void*>(buffer), length+1, MPI_CHAR, root, comm);
1152 if (getRank()!=root) {
1153 *sendBuf = buffer;
1154 }
1155 delete [] buffer;
1156}

◆ MpiManager::gatherv< std::size_t >()

template<>
void olb::singleton::MpiManager::gatherv< std::size_t > ( std::size_t * sendBuf,
int sendCount,
std::size_t * recvBuf,
int * recvCounts,
int * displs,
int root,
MPI_Comm comm )

Definition at line 950 of file mpiManager.cpp.

953{
954 if (!ok) {
955 return;
956 }
957 MPI_Gatherv(static_cast<void*>(sendBuf), sendCount, MPI_UNSIGNED_LONG,
958 static_cast<void*>(recvBuf), recvCounts, displs, MPI_UNSIGNED_LONG,
959 root, comm);
960}

◆ MpiManager::iSend< std::size_t >()

template<>
void olb::singleton::MpiManager::iSend< std::size_t > ( std::size_t * buf,
int count,
int dest,
MPI_Request * request,
int tag,
MPI_Comm comm )

Definition at line 246 of file mpiManager.cpp.

248{
249 if (ok) {
250 MPI_Isend(static_cast<void*>(buf), count, MPI_UNSIGNED_LONG, dest, tag, comm, request);
251 }
252}

◆ MpiManager::iSend< std::uint32_t >()

template<>
void olb::singleton::MpiManager::iSend< std::uint32_t > ( std::uint32_t * buf,
int count,
int dest,
MPI_Request * request,
int tag,
MPI_Comm comm )

Definition at line 255 of file mpiManager.cpp.

257{
258 if (ok) {
259 MPI_Isend(static_cast<void*>(buf), count, MPI_UNSIGNED, dest, tag, comm, request);
260 }
261}

◆ MpiManager::iSend< std::uint8_t >()

template<>
void olb::singleton::MpiManager::iSend< std::uint8_t > ( std::uint8_t * buf,
int count,
int dest,
MPI_Request * request,
int tag,
MPI_Comm comm )

Definition at line 228 of file mpiManager.cpp.

230{
231 if (ok) {
232 MPI_Isend(static_cast<void*>(buf), count, MPI_BYTE, dest, tag, comm, request);
233 }
234}

◆ MpiManager::probeReceiveSize< std::uint32_t >()

template<>
std::size_t olb::singleton::MpiManager::probeReceiveSize< std::uint32_t > ( int source,
int tag,
MPI_Comm comm )

Definition at line 352 of file mpiManager.cpp.

353{
354 return probeReceiveSize(source, MPI_UNSIGNED, tag, comm);
355}

◆ MpiManager::probeReceiveSize< std::uint64_t >()

template<>
std::size_t olb::singleton::MpiManager::probeReceiveSize< std::uint64_t > ( int source,
int tag,
MPI_Comm comm )

Definition at line 358 of file mpiManager.cpp.

359{
360 return probeReceiveSize(source, MPI_UNSIGNED_LONG, tag, comm);
361}

◆ MpiManager::receive< std::size_t >()

template<>
void olb::singleton::MpiManager::receive< std::size_t > ( std::size_t * buf,
int count,
int source,
int tag,
MPI_Comm comm )

Definition at line 405 of file mpiManager.cpp.

406{
407 if (!ok) {
408 return;
409 }
410 MPI_Status status;
411 MPI_Recv(static_cast<void*>(buf), count, MPI_UNSIGNED_LONG, source, tag, comm, &status);
412}

◆ MpiManager::receive< std::uint32_t >()

template<>
void olb::singleton::MpiManager::receive< std::uint32_t > ( std::uint32_t * buf,
int count,
int source,
int tag,
MPI_Comm comm )

Definition at line 415 of file mpiManager.cpp.

416{
417 if (!ok) {
418 return;
419 }
420 MPI_Status status;
421 MPI_Recv(static_cast<void*>(buf), count, MPI_UNSIGNED, source, tag, comm, &status);
422}

◆ MpiManager::receive< std::uint8_t >()

template<>
void olb::singleton::MpiManager::receive< std::uint8_t > ( std::uint8_t * buf,
int count,
int source,
int tag,
MPI_Comm comm )

Definition at line 385 of file mpiManager.cpp.

386{
387 if (!ok) {
388 return;
389 }
390 MPI_Status status;
391 MPI_Recv(static_cast<std::uint8_t*>(buf), count, MPI_BYTE, source, tag, comm, &status);
392}

◆ MpiManager::recvInit< std::uint8_t >()

template<>
void olb::singleton::MpiManager::recvInit< std::uint8_t > ( std::uint8_t * buf,
int count,
int dest,
MPI_Request * request,
int tag,
MPI_Comm comm )

Definition at line 541 of file mpiManager.cpp.

542{
543 if (ok) {
544 MPI_Recv_init(buf, count, MPI_BYTE, dest, tag, comm, request);
545 }
546}

◆ MpiManager::reduce< std::size_t >()

template<>
void olb::singleton::MpiManager::reduce< std::size_t > ( std::size_t & sendVal,
std::size_t & recvVal,
MPI_Op op,
int root,
MPI_Comm comm )

Definition at line 1355 of file mpiManager.cpp.

1356{
1357 if (!ok) {
1358 return;
1359 }
1360 MPI_Reduce(static_cast<void*>(&sendVal),
1361 static_cast<void*>(&recvVal), 1, MPI_UNSIGNED_LONG, op, root, comm);
1362}

◆ MpiManager::send< std::uint8_t >()

template<>
void olb::singleton::MpiManager::send< std::uint8_t > ( std::uint8_t * buf,
int count,
int dest,
int tag,
MPI_Comm comm )

Definition at line 126 of file mpiManager.cpp.

127{
128 if (!ok) {
129 return;
130 }
131 MPI_Send(static_cast<void*>(buf), count, MPI_BYTE, dest, tag, comm);
132}

◆ MpiManager::sendInit< std::size_t >()

template<>
void olb::singleton::MpiManager::sendInit< std::size_t > ( std::size_t * buf,
int count,
int dest,
MPI_Request * request,
int tag,
MPI_Comm comm )

Definition at line 170 of file mpiManager.cpp.

171{
172 if (ok) {
173 MPI_Send_init(buf, count, MPI_UNSIGNED_LONG, dest, tag, comm, request);
174 }
175}

◆ MpiManager::sendInit< std::uint32_t >()

template<>
void olb::singleton::MpiManager::sendInit< std::uint32_t > ( std::uint32_t * buf,
int count,
int dest,
MPI_Request * request,
int tag,
MPI_Comm comm )

Definition at line 178 of file mpiManager.cpp.

179{
180 if (ok) {
181 MPI_Send_init(buf, count, MPI_UNSIGNED, dest, tag, comm, request);
182 }
183}

◆ MpiManager::sendInit< std::uint8_t >()

template<>
void olb::singleton::MpiManager::sendInit< std::uint8_t > ( std::uint8_t * buf,
int count,
int dest,
MPI_Request * request,
int tag,
MPI_Comm comm )

Definition at line 186 of file mpiManager.cpp.

187{
188 if (ok) {
189 MPI_Send_init(buf, count, MPI_BYTE, dest, tag, comm, request);
190 }
191}

◆ omp()

ompManager olb::singleton::omp ( )

Definition at line 56 of file ompManager.cpp.

56 {
57 return ompManager{};
58}
+ Here is the caller graph for this function:

◆ pool()

ThreadPool & olb::singleton::pool ( )

Definition at line 41 of file olbInit.cpp.

42{
43 static ThreadPool instance;
44 return instance;
45}
Pool of threads for CPU-based background processing.
Definition threadPool.h:78
+ Here is the caller graph for this function: