Peano 4
Loading...
Searching...
No Matches
tarch Namespace Reference

Have to include this header, as I need access to the SYCL_EXTERNAL keyword. More...

Namespaces

namespace  accelerator
 
namespace  internal
 
namespace  la
 My collection of tiny vector operations.
 
namespace  logging
 
namespace  mpi
 
namespace  multicore
 This page describes Peano 4's multithreading layer.
 
namespace  plotter
 
namespace  services
 
namespace  tests
 
namespace  timing
 

Data Structures

class  Enumerator
 Simple rank-global enumerator. More...
 

Enumerations

enum class  MemoryLocation { Heap , ManagedSharedAcceleratorDeviceMemory }
 
enum class  MemoryUsageFormat { MByte }
 

Functions

void gpuAbort ()
 Delegates to std::abort() if no GPU offloading is active.
 
std::string toString (MemoryLocation value)
 
template<class T = double>
T * allocateMemory (int size, MemoryLocation location, int device=-1)
 
void freeMemory (void *data, MemoryLocation location)
 
int padSizeToAlignment (int size, int aligment)
 
double * memset (double *dest, double ch, size_t byteCount)
 Alternative GPU-ready version of memset.
 
void shutdownNonCriticalAssertionEnvironment ()
 peano4::shutdownParallelEnvironment().
 
void initNonCriticalAssertionEnvironment ()
 Register the assertion tag from the global communicator.
 
void enableNonCriticalAssertions (bool value)
 Switch noncritical assertions on/off.
 
void triggerNonCriticalAssertion (std::string file, int line, std::string expression, std::string parameterValuePairs)
 Trigger a non-critical assertion.
 
bool hasNonCriticalAssertionBeenViolated ()
 
int getMemoryUsage (MemoryUsageFormat format)
 Method for getting the application's memory footprint.
 
int getTotalMemory (MemoryUsageFormat format)
 
int getFreeMemory (MemoryUsageFormat format)
 
tarch::tests::TestCasegetUnitTests ()
 Please destroy after usage.
 

Detailed Description

Have to include this header, as I need access to the SYCL_EXTERNAL keyword.

tarch denotes the Technical Architectures.

It is used within Peano, but it is designed in a way that it is more or less independent of Peano, i.e. Peano uses the tarch but not the other way round.

Please note that the tarch in the Peano4 repository/branch is not the same as the tarch in previous Peano versions. I've cleaned it up quite a lot and old features that are not used anymore are removed.

level

  • PeanoDebug = 1: Enable tracing
  • PeanoDebug = 2: Enable assertions (includes level 1)
  • PeanoDebug = 4: Enable debug messages (includes level 2)

libraries

By default, Peano 4 builds all core libraries in three different versions:

  • A debug variant which holds a compile with PeanoDebug=4
  • A trace variant which holds a compile with PeanoDebug=1
  • A production variants with PeanoDebug=0

Note: The trace variant does not contain any assertions, as assertions are typically expensive and slow down the code considerably.

Enumeration Type Documentation

◆ MemoryLocation

enum class tarch::MemoryLocation
strong
Enumerator
Heap 

Create data on the heap of the local device.

That is, if you run on an accelerator, use the accelerator's heap. If you invoke it on the host, use the host's accelerator.

The alignment of this routine can be controlled via the compile time constant AlignmentOnHeap. It is typically set (to a default) within the corresponding compiler-specific header-file in tarch/compiler.

ManagedSharedAcceleratorDeviceMemory 

To be used on host only.

Definition at line 56 of file accelerator.h.

◆ MemoryUsageFormat

enum class tarch::MemoryUsageFormat
strong
Enumerator
MByte 

Definition at line 35 of file tarch.h.

Function Documentation

◆ allocateMemory()

template<class T = double>
T * tarch::allocateMemory ( int size,
MemoryLocation location,
int device = -1 )

Definition at line 82 of file accelerator.h.

References tarch::internal::allocateRawData().

Referenced by peano4::stacks::STDVectorStackOverSmartPointers< T >::prepareMetaDataBuffers(), runBenchmarks(), and exahype2::fv::musclhancock::timeStepWithMusclHancock_patchwise_heap_functors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enableNonCriticalAssertions()

void tarch::enableNonCriticalAssertions ( bool value)

Switch noncritical assertions on/off.

Definition at line 39 of file NonCriticalAssertions.cpp.

◆ freeMemory()

void tarch::freeMemory ( void * data,
MemoryLocation location )

Definition at line 27 of file accelerator.cpp.

Referenced by exahype2::fd::applySommerfeldConditions(), exahype2::EnclaveBookkeeping::cancelTask(), tarch::la::DynamicMatrix::insertEmptyColumns(), tarch::la::DynamicMatrix::insertEmptyRows(), toolbox::blockstructured::interpolateHaloLayer_AoS_linear_with_constant_extrapolation(), toolbox::blockstructured::interpolateHaloLayer_AoS_linear_with_constant_extrapolation_and_linear_normal_interpolation(), toolbox::blockstructured::interpolateHaloLayer_AoS_linear_with_linear_extrapolation(), toolbox::blockstructured::interpolateHaloLayer_AoS_linear_with_linear_extrapolation_and_linear_normal_interpolation(), toolbox::blockstructured::interpolateHaloLayer_AoS_piecewise_constant(), tarch::la::DynamicMatrix::removeColumn(), tarch::la::DynamicMatrix::replicateCols(), tarch::la::DynamicMatrix::replicateRows(), runBenchmarks(), toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::scatter(), toolbox::particles::memorypool::VertexWiseContinuousMemoryPool< T >::scatter(), toolbox::particles::memorypool::GlobalContinuousMemoryPool< T >::scatterAndUpdateIterator(), toolbox::particles::memorypool::VertexWiseContinuousMemoryPool< T >::scatterAndUpdateIterator(), tarch::la::DynamicMatrix::shiftColumnsRight(), tarch::la::DynamicMatrix::shiftRowsDown(), exahype2::fv::rusanov::tests::ApplySplit1DRiemannToPatchTest::testIterateGrid(), exahype2::fd::fd4::timeStep_patchwise_heap_functors(), exahype2::fv::musclhancock::timeStepWithMusclHancock_patchwise_heap_functors(), exahype2::fv::riemann::timeStepWithRiemann_patchwise_heap_functors(), peano4::stacks::STDVectorStackOverSmartPointers< T >::tryToFinishSendOrReceive(), exahype2::EnclaveBookkeeping::waitForTaskAndDiscardResult(), exahype2::EnclaveBookkeeping::waitForTaskToTerminateAndCopyResultOver(), exahype2::CellData::~CellData(), and tarch::la::DynamicMatrix::~DynamicMatrix().

Here is the caller graph for this function:

◆ getFreeMemory()

int tarch::getFreeMemory ( MemoryUsageFormat format)

Definition at line 83 of file tarch.cpp.

References getTotalMemory(), and MByte.

Referenced by toolbox::loadbalancing::AbstractLoadBalancing::fitsIntoMemory(), and toolbox::loadbalancing::strategies::SpreadOutHierarchically::getNumberOfSplitsOnLocalRank().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMemoryUsage()

int tarch::getMemoryUsage ( MemoryUsageFormat format)

Method for getting the application's memory footprint.

We use the exact version of KiloByte with 1024 bytes.

The implementation is based on C-version of Michael Moltenbrey.

Definition at line 95 of file tarch.cpp.

References _log, f(), and logError.

Referenced by toolbox::loadbalancing::AbstractLoadBalancing::fitsIntoMemory(), toolbox::loadbalancing::strategies::SpreadOutHierarchically::getNumberOfSplitsOnLocalRank(), and peano4::parallel::SpacetreeSet::split().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTotalMemory()

int tarch::getTotalMemory ( MemoryUsageFormat format)

Definition at line 72 of file tarch.cpp.

Referenced by getFreeMemory(), and peano4::parallel::SpacetreeSet::split().

Here is the caller graph for this function:

◆ getUnitTests()

tarch::tests::TestCase * tarch::getUnitTests ( )

Please destroy after usage.

Definition at line 17 of file UnitTests.cpp.

References tarch::tests::TreeTestCaseCollection::addTestCase().

Referenced by main(), and runTests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gpuAbort()

void tarch::gpuAbort ( )

Delegates to std::abort() if no GPU offloading is active.

Otherwise is degenerates to nop, as there is no abort on an accelerator. The vanilla implementation can be found in accelerator.cpp. The vendor-specific implementations are hold within their accelerator.cpp file.

Definition at line 29 of file accelerator.cpp.

◆ hasNonCriticalAssertionBeenViolated()

bool tarch::hasNonCriticalAssertionBeenViolated ( )

Definition at line 91 of file NonCriticalAssertions.cpp.

References _log, tarch::mpi::Rank::getCommunicator(), tarch::mpi::Rank::getInstance(), tarch::mpi::IntegerMessage::getValue(), logError, and tarch::mpi::IntegerMessage::receive().

Referenced by selectNextAlgorithmicStep().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initNonCriticalAssertionEnvironment()

void tarch::initNonCriticalAssertionEnvironment ( )

Register the assertion tag from the global communicator.

Definition at line 51 of file NonCriticalAssertions.cpp.

References tarch::mpi::Rank::reserveFreeTag().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ memset()

double * tarch::memset ( double * dest,
double ch,
size_t byteCount )

Alternative GPU-ready version of memset.

AMD's standard library hasn't annotated the memset call with target offload for OpenMP. So we have to provide a GPU-ready version ourselves. We do so if and only if the OpenMPManuallyOffloadMemset macro is set. It is typically set in the CompilerSpecificSettings.h. If that macro is not defined, we fall back to std::memset.

The signature here is compatible with std::memset. The original interface is

char* memset(char* dest, int ch, size_t count);
double * memset(double *dest, double ch, size_t byteCount)
Alternative GPU-ready version of memset.

which is just not nice. It should be

double* memset(double* dest, double ch, size_t countNumberOfDoubles);

but that's not what the C++ standard gives us. So we pick the nicest interface we could think of, but is still compatible.

Parameters
countByte count.

Definition at line 44 of file accelerator.cpp.

References assertion2.

Referenced by applications::exahype2::ccz4::admconstraints(), applications::exahype2::ccz4::diagonal_gaugeWave(), applications::exahype2::ccz4::flat(), applications::exahype2::ccz4::gaugeWave(), applications::exahype2::ccz4::linearWave(), applications::exahype2::ccz4::CCZ4::sourceTerm(), and applications::exahype2::ccz4::TestingOutput().

Here is the caller graph for this function:

◆ padSizeToAlignment()

int tarch::padSizeToAlignment ( int size,
int aligment )

Definition at line 33 of file accelerator.cpp.

Referenced by tarch::internal::allocateRawData().

Here is the caller graph for this function:

◆ shutdownNonCriticalAssertionEnvironment()

void tarch::shutdownNonCriticalAssertionEnvironment ( )

peano4::shutdownParallelEnvironment().

Definition at line 44 of file NonCriticalAssertions.cpp.

References tarch::mpi::Rank::releaseTag().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

◆ triggerNonCriticalAssertion()

void tarch::triggerNonCriticalAssertion ( std::string file,
int line,
std::string expression,
std::string parameterValuePairs )

Trigger a non-critical assertion.

You can either use this routine, or you can use the macros. They invoke this routine eventually.

The routine reports only details about the very first non-critical assertion. All follow-up logs on this rank are ignored, i.e. we only get a note and no detail. Once logged locally, we send the assertion message to the global master if we are not working on the global marker ourselves.

Definition at line 58 of file NonCriticalAssertions.cpp.

References _log, tarch::mpi::Rank::getGlobalMasterRank(), tarch::mpi::Rank::getInstance(), tarch::mpi::Rank::getRank(), logDebug, logError, and tarch::mpi::IntegerMessage::send().

Referenced by applications::exahype2::euler::sphericalaccretion::SSInfall::initialCondition().

Here is the call graph for this function:
Here is the caller graph for this function: