tfel
Loading...
Searching...
No Matches
Batch.hxx File Reference

This file declares the statistics, the execution and the report of the computations on a batch of points, shared by the primitives of the backends of the generic-parallel interfaces. More...

#include <bit>
#include <cerrno>
#include <cstddef>
#include <cstring>
#include <exception>
#include <string_view>
#include "TFEL/Config/TFELConfig.hxx"
#include "MFront/GenericParallel/StatisticsKeys.hxx"
#include "MFront/GenericParallel/BackendExecutionPolicy.h"

Classes

struct  mfront::generic_parallel::BatchStatistics< real >
 statistics of the computations at one point or at a group of points of a batch, combined by parallel reductions. The keys are built by makeKey. More...
struct  mfront::generic_parallel::CombineStatistics
 function object combining two statistics More...
struct  mfront::generic_parallel::BatchExecution< Statistics >
 execution of the computations on a batch, as given by the calling code: the policy, checked by the backend against its own policy (see mfront::generic_parallel::checkBackendExecutionPolicy), and the statistics More...

Namespaces

namespace  mfront
 This namespace contains material used to build the MFront code generator.
namespace  mfront::generic_parallel

Typedefs

using mfront::generic_parallel::size_type = std::size_t
 type of the indices and of the numbers of points

Functions

TFEL_HOST_DEVICE constexpr atomic_size_type mfront::generic_parallel::toOrderedKey (const double v) noexcept
template<typename Atomics, typename Statistics, typename real>
TFEL_HOST_DEVICE void mfront::generic_parallel::updateStatistics (Statistics &s, const BatchStatistics< real > &r, const atomic_size_type rdt0)
 update the statistics shared by the threads with the statistics of a point or of a group of points, by atomic operations. The shared statistics are only accessed if an event occurred: a failure, an unreliable result, or a time step scaling factor lower than the initial one.
template<typename OutputStatus>
int mfront::generic_parallel::report (OutputStatus &s, const int status, const std::string_view msg) noexcept
 set the status and the error message of an output status
template<typename OutputStatus, typename Initialize, typename Function>
int mfront::generic_parallel::handleExceptions (OutputStatus *const s, const Initialize &initialize, Function &&f) noexcept
 call the body of a generated function of batches, so that no exception goes through its C interface: an exception is reported as an error of the backend (status -7). The output status is initialized before the call, and errno is restored on return: it may be modified by the runtimes of the backends and by the computations on the host.

Variables

template<typename Statistics>
constexpr bool mfront::generic_parallel::hasTimeStepScalingFactor
 true if the statistics updated by the devices hold a time step scaling factor, false otherwise, which is the case of the statistics of the material properties

Detailed Description

This file declares the statistics, the execution and the report of the computations on a batch of points, shared by the primitives of the backends of the generic-parallel interfaces.

Date
09/11/2026