Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
RunCommandEnumerate.h File Reference

Types and macros to manage enumerations of entities on accelerators. More...

#include "arccore/common/accelerator/RunCommand.h"
#include "arcane/accelerator/KernelLauncher.h"
#include "arcane/core/ItemTypes.h"
#include "arcane/core/ItemGroup.h"
#include "arcane/core/Concurrency.h"
#include "arccore/common/HostKernelRemainingArgsHelper.h"
#include <concepts>
Include dependency graph for RunCommandEnumerate.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Arcane::Accelerator::Impl::ItemLocalIdsLoopRanges< TraitsType_ >
 Information for the accelerator loop over entities. More...
class  Arcane::IteratorWithIndexBase
class  Arcane::IteratorWithIndex< T >
 Base class for an iterator that preserves the iteration index. More...
class  Arcane::impl::IterBuilderWithIndex< T >
class  Arcane::impl::IterBuilderNoIndex< T >
class  Arcane::Accelerator::impl::RunCommandItemEnumeratorSubTraitsT< T >
 Template to know the entity type associated with T. More...
class  Arcane::Accelerator::impl::RunCommandItemEnumeratorSubTraitsT< ItemLocalIdT< T > >
 Specialization for ItemLocalIdT. More...
class  Arcane::Accelerator::impl::RunCommandItemEnumeratorSubTraitsT< IteratorWithIndex< T > >
 Specialization for IteratorWithIndex<T>. More...
class  Arcane::Accelerator::impl::RunCommandItemContainer< ItemType >
 Container for RunCommandEnumerate. More...
class  Arcane::Accelerator::impl::RunCommandItemEnumeratorTraitsT< IteratorValueType_ >
 Characteristics of an enumerator for a command on entities. More...
class  Arcane::Accelerator::impl::ItemRunCommandArgs< TraitsType, RemainingArgs >
class  Arcane::Accelerator::ItemRunCommand< TraitsType, RemainingArgs >

Namespaces

namespace  Arcane
 -- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
namespace  Arcane::Accelerator
 Namespace for accelerator usage.

Concepts

concept  Arcane::Accelerator::impl::RunCommandEnumerateIteratorConcept
 Concept to constrain values in RUNCOMMAND_ENUMERATE.

Macros

#define RUNCOMMAND_ENUMERATE(ItemTypeName, iter_name, item_group, ...)
 Macro to iterate over an accelerator on a group of entities.

Functions

template<typename TraitsType, typename ContainerType, typename Lambda, typename... RemainingArgs>
void Arcane::Accelerator::impl::_doItemsLambda (Int32 base_index, ContainerType sub_items, const Lambda &func, RemainingArgs... remaining_args)
template<typename TraitsType, typename Lambda, typename... RemainingArgs>
void Arcane::Accelerator::impl::_applyItems (RunCommand &command, typename TraitsType::ContainerType items, const Lambda &func, const RemainingArgs &... remaining_args)
 Applies the enumeration func on the entity list items.
template<typename TraitsType, typename Lambda>
void Arcane::Accelerator::run (RunCommand &command, const TraitsType &traits, const Lambda &func)
template<typename ItemType>
auto Arcane::Accelerator::operator<< (RunCommand &command, const impl::RunCommandItemEnumeratorTraitsT< ItemType > &traits)
template<typename ItemType>
auto Arcane::Accelerator::operator<< (RunCommand &command, const ItemVectorViewT< ItemType > &items)
template<typename ItemType>
auto Arcane::Accelerator::operator<< (RunCommand &command, const ItemGroupT< ItemType > &items)
template<typename TraitsType, typename Lambda>
void Arcane::Accelerator::operator<< (ItemRunCommand< TraitsType > &nr, const Lambda &f)
template<typename TraitsType, typename... RemainingArgs>
auto Arcane::Accelerator::operator<< (RunCommand &command, const impl::ItemRunCommandArgs< TraitsType, RemainingArgs... > &args)
template<typename TraitsType, typename Lambda, typename... RemainingArgs>
void Arcane::Accelerator::operator<< (ItemRunCommand< TraitsType, RemainingArgs... > &&nr, const Lambda &f)
template<typename ItemTypeName, typename ItemContainerType, typename... RemainingArgs>
auto Arcane::Accelerator::impl::makeExtendedItemEnumeratorLoop (const ItemContainerType &container_type, const RemainingArgs &... remaining_args)

Detailed Description

Types and macros to manage enumerations of entities on accelerators.

Definition in file RunCommandEnumerate.h.

Macro Definition Documentation

◆ RUNCOMMAND_ENUMERATE

#define RUNCOMMAND_ENUMERATE ( ItemTypeName,
iter_name,
item_group,
... )
Value:
A_FUNCINFO << ::Arcane::Accelerator::impl::makeExtendedItemEnumeratorLoop<ItemTypeName>(item_group __VA_OPT__(, __VA_ARGS__)) \
<< [=] ARCCORE_HOST_DEVICE(::Arcane::Accelerator::impl::RunCommandItemEnumeratorTraitsT<ItemTypeName>::ValueType iter_name \
__VA_OPT__(ARCCORE_RUNCOMMAND_REMAINING_FOR_EACH(__VA_ARGS__)))

Macro to iterate over an accelerator on a group of entities.

Conceptually, this is equivalent to the following loop:

for( ItemTypeName iter_name : item_group ){
...
}

ItemTypeName must be a local ID type (CellLocalId, NodeLocalId). Using the entity type name (Cell, Node, ...) is possible but is obsolete and is equivalent to using the local ID type (for example, you must replace Cell with CellLocalId). iter_name is the name of the variable containing the current iterator value. item_group is the name of the ItemGroup or ItemVectorView associated Additional arguments are used to specify potential reductions

Definition at line 626 of file RunCommandEnumerate.h.

Function Documentation

◆ _applyItems()

template<typename TraitsType, typename Lambda, typename... RemainingArgs>
void Arcane::Accelerator::impl::_applyItems ( RunCommand & command,
typename TraitsType::ContainerType items,
const Lambda & func,
const RemainingArgs &... remaining_args )

◆ _doItemsLambda()

template<typename TraitsType, typename ContainerType, typename Lambda, typename... RemainingArgs>
void Arcane::Accelerator::impl::_doItemsLambda ( Int32 base_index,
ContainerType sub_items,
const Lambda & func,
RemainingArgs... remaining_args )

Definition at line 386 of file RunCommandEnumerate.h.

◆ makeExtendedItemEnumeratorLoop()

template<typename ItemTypeName, typename ItemContainerType, typename... RemainingArgs>
auto Arcane::Accelerator::impl::makeExtendedItemEnumeratorLoop ( const ItemContainerType & container_type,
const RemainingArgs &... remaining_args )

Definition at line 592 of file RunCommandEnumerate.h.