Peano
|
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 namespace. | |
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 (std::size_t count, MemoryLocation location, int device=accelerator::Device::HostDevice) |
Allocates memory on the specified memory location. | |
void | freeMemory (void *data, MemoryLocation location, int device=accelerator::Device::HostDevice) |
Free memory. | |
std::size_t | padSizeToAlignment (std::size_t size, std::size_t alignment) |
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::TestCase * | getUnitTests () |
Please destroy after usage. | |
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.
By default, Peano 4 builds all core libraries in three different versions:
Note: The trace variant does not contain any assertions, as assertions are typically expensive and slow down the code considerably.
|
strong |
Definition at line 58 of file accelerator.h.
|
strong |
T * tarch::allocateMemory | ( | std::size_t | count, |
MemoryLocation | location, | ||
int | device = accelerator::Device::HostDevice ) |
Allocates memory on the specified memory location.
The device id is an optional argument that is required for memory allocation on an accelerator. Default is -1 (HostDevice). For memory allocation on accelerators, passing a device id >= 0 is necessary.
count | Number of elements to allocate memory for. |
location | Location on where to allocate the memory. |
device | (Optional) device id for memory allocation on accelerators. |
Definition at line 99 of file accelerator.h.
References tarch::internal::allocateRawData().
Referenced by toolbox::blockstructured::interpolateCellDataAssociatedToVolumesIntoOverlappingCell_secondOrder(), peano4::stacks::STDVectorStackOverSmartPointers< T >::prepareMetaDataBuffers(), toolbox::blockstructured::tests::IandRVolumetricTest::testMatrixInterpolation(), and exahype2::fv::musclhancock::timeStepWithMusclHancock_patchwise_heap_functors().
Switch noncritical assertions on/off.
Definition at line 39 of file NonCriticalAssertions.cpp.
void tarch::freeMemory | ( | void * | data, |
MemoryLocation | location, | ||
int | device = accelerator::Device::HostDevice ) |
Free memory.
This routine is thread-safe in the sense that it checks if data actually point to something that is not nullptr. If data is the nullptr, the operation degenerates to nop. This is important as we use the routine within smart pointers, where we don't want to check manually if data is actually nullptr or not.
Definition at line 30 of file accelerator.cpp.
Referenced by exahype2::fd::applySommerfeldConditions(), exahype2::EnclaveBookkeeping::cancelTask(), toolbox::blockstructured::tests::IandRInMatricesTest::compareInterpolateLinearCaseToTensorProductPatch(), toolbox::blockstructured::tests::IandRInMatricesTest::compareRestrictLinearCaseToTensorProductPatch(), 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(), runBenchmark(), 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(), toolbox::blockstructured::tests::IandRVolumetricTest::testMatrixInterpolation(), exahype2::fd::fd4::timeStep_patchwise_heap_functors(), exahype2::fv::musclhancock::timeStepWithMusclHancock_patchwise_heap_functors(), peano4::stacks::STDVectorStackOverSmartPointers< T >::tryToFinishSendOrReceive(), exahype2::EnclaveBookkeeping::waitForTaskAndDiscardResult(), exahype2::EnclaveBookkeeping::waitForTaskToTerminateAndCopyResultOver(), exahype2::CellData< inType, outType >::~CellData(), and tarch::la::DynamicMatrix::~DynamicMatrix().
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().
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().
int tarch::getTotalMemory | ( | MemoryUsageFormat | format | ) |
Definition at line 72 of file tarch.cpp.
Referenced by getFreeMemory(), and peano4::parallel::SpacetreeSet::split().
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().
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 36 of file accelerator.cpp.
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().
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().
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
which is just not nice. It should be
but that's not what the C++ standard gives us. So we pick the nicest interface we could think of, but is still compatible.
count | Byte count. |
Definition at line 54 of file accelerator.cpp.
References assertion2, and double.
Referenced by applications::exahype2::ccz4::admconstraints(), exahype2::fd::tests::CCZ4KernelTest::AppleWithAppleTest(), applications::exahype2::ccz4::diagonal_gaugeWave(), applications::exahype2::ccz4::flat(), applications::exahype2::ccz4::gaugeWave(), benchmarks::exahype2::ccz4::CCZ4::initialCondition(), applications::exahype2::ccz4::linearWave(), applications::exahype2::ccz4::CCZ4::sourceTerm(), and applications::exahype2::ccz4::TestingOutput().
std::size_t tarch::padSizeToAlignment | ( | std::size_t | size, |
std::size_t | alignment ) |
Definition at line 40 of file accelerator.cpp.
References assertion.
Referenced by tarch::internal::allocateRawData().
void tarch::shutdownNonCriticalAssertionEnvironment | ( | ) |
peano4::shutdownParallelEnvironment().
Definition at line 44 of file NonCriticalAssertions.cpp.
References tarch::mpi::Rank::releaseTag().
Referenced by main().
std::string tarch::toString | ( | MemoryLocation | value | ) |
Definition at line 7 of file accelerator.cpp.
Referenced by tarch::la::DynamicMatrix::insertEmptyColumns(), tarch::la::DynamicMatrix::insertEmptyRows(), tarch::timing::Measurement::max(), tarch::timing::Measurement::min(), tarch::la::Vector< Size, Scalar >::operator()(), tarch::la::Vector< Size, Scalar >::operator()(), tarch::la::Vector< Size, Scalar >::operator[](), tarch::la::Vector< Size, Scalar >::operator[](), tarch::la::tests::VectorTest::testAssignment(), tarch::la::tests::VectorTest::testVectorScalarOperations(), and tarch::la::tests::VectorTest::testWrappedVector().
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().