|
| template<typename OutputStatus> |
| bool | mfront::generic_parallel::gpu::internals::failed (OutputStatus &s, const Error e) noexcept |
| | report an error of the runtime. Only the first error is reported.
|
| template<auto kernel, typename OutputStatus> |
| bool | mfront::generic_parallel::gpu::internals::ensureStackSize (OutputStatus &s, const bool preserve) |
| | increase the stack size of the threads if the given kernel requires it (see mfront::generic_parallel::gpu::ensureStackSize).
|
|
template<typename T> |
| __device__ T | mfront::generic_parallel::gpu::internals::warpSum (T v) |
| | sum of the values of a warp, in the first thread of the warp
|
| __device__ bool | mfront::generic_parallel::gpu::internals::warpAny (const bool p) |
|
__device__ atomic_size_type | mfront::generic_parallel::gpu::internals::warpMin (atomic_size_type v) |
| | minimum of the values of a warp, in the first thread of the warp
|
| template<typename Statistics, typename PointFunction> |
| __global__ void | mfront::generic_parallel::gpu::internals::apply (const MFRONT_GENERIC_PARALLEL_GPU_GRID_CONSTANT PointFunction f, const size_type n, Statistics *const s, const atomic_size_type rdt0) |
| | apply a function at the points of a batch, one thread per point, and update the statistics of the batch. The number of threads per block must be a multiple of the warp size.
|
| template<typename Statistics, typename PointFunction> |
| auto & | mfront::generic_parallel::gpu::internals::getStatisticsBlocks () noexcept |
| template<typename StatisticsHandler, typename PointFunction> |
| int | mfront::generic_parallel::gpu::apply (typename StatisticsHandler::OutputStatus &s, const size_type n, const BatchExecution< typename StatisticsHandler::Statistics > &e, const StatisticsHandler &h, const PointFunction &f, const unsigned int threads_per_block) |
| | apply a function at the points of a batch, one thread per point, and report the statistics of the batch.
|
| auto | mfront::generic_parallel::gpu::makeApply (const unsigned int threads_per_block) |
This file declares the primitive of the cuda and hip backends of the generic-parallel interfaces. This file must be compiled by a CUDA or a HIP compiler. The HIP runtime is used if the hip/hip_runtime.h header has been included before this file or if the HIP language is enabled, the CUDA runtime otherwise. Including the HIP runtime header first is required to use HIP on NVIDIA GPUs, since hipcc then calls nvcc.
- Date
- 05/10/2026
- Copyright
- Copyright (C) 2006-2025 CEA/DEN, EDF R&D. All rights reserved. This project is publicly released under either the GNU GPL Licence with linking exception or the CECILL-A licence. A copy of thoses licences are delivered with the sources of TFEL. CEA or EDF may also distribute this project under specific licensing conditions.
template<typename StatisticsHandler, typename PointFunction>
| int mfront::generic_parallel::gpu::apply |
( |
typename StatisticsHandler::OutputStatus & | s, |
|
|
const size_type | n, |
|
|
const BatchExecution< typename StatisticsHandler::Statistics > & | e, |
|
|
const StatisticsHandler & | h, |
|
|
const PointFunction & | f, |
|
|
const unsigned int | threads_per_block ) |
apply a function at the points of a batch, one thread per point, and report the statistics of the batch.
The kernel is launched on the stream given by the execution policy. If the computations are asynchronous, this function returns once the kernel is launched. Otherwise, it waits for its completion.
Without statistics given by the calling code, the statistics are held by a block of device memory of a pool of blocks (see StatusBlockPool): no memory is allocated per call. Local statistics are initialized on the host, copied to the block just before the launch and copied back once the computations are completed: the host never accesses the block, which the device may not share with the host while kernels run (devices without concurrent access to managed memory). The device only accesses the block if an event occurs at a point.
If the function never reports an event (see the hasEvents method of the handler), the statistics are neither combined nor reported, and no block of the pool is used.
- Template Parameters
-
| StatisticsHandler | handler of the statistics (see MFront/GenericParallel/Batch.hxx) |
| PointFunction | function object taking the index of a point and returning the statistics associated with this point |
- Parameters
-
| [in,out] | s | output status, which must have been initialized |
| [in] | n | number of points |
| [in] | e | execution of the batch. The policy is a CUDABackendExecutionPolicy (HIPBackendExecutionPolicy with HIP), or null for the default stream. |
| [in] | h | handler of the statistics |
| [in] | f | function |
| [in] | threads_per_block | number of threads per block, rounded up to a multiple of the warp size |
- Returns
- the status
template<typename Statistics, typename PointFunction>
| auto & mfront::generic_parallel::gpu::internals::getStatisticsBlocks |
( |
| ) |
|
|
noexcept |
- Returns
- the pool of blocks of device memory holding the statistics of the synchronous computations of a function of the generated library
- Template Parameters
-
| Statistics | statistics updated by the devices |
| PointFunction | function applied at the points, which is specific to a generated function |
The pool depends on the function applied at the points, whose type is declared in an anonymous namespace by the generated code: each generated function, and thus each generated library, has its own pool. A pool shared by several libraries through the dynamic linker would be destroyed when the library which initialized it is unloaded, even if another library still uses it.