Celeritas 0.7.0-22+develop.9704a67c5
Loading...
Searching...
No Matches
Classes | Functions
DeviceAlgorithms.device.hh File Reference
#include "corecel/DeviceRuntimeApi.hh"
#include "corecel/Assert.hh"
#include "corecel/Types.hh"
#include "corecel/sys/Device.hh"
#include "corecel/sys/Stream.hh"
#include "corecel/sys/Thrust.device.hh"
#include "Copier.hh"
#include "DeviceAllocation.hh"
#include "ObserverPtr.device.hh"
#include "ObserverPtr.hh"

Classes

struct  celeritas::NotPredicate< Pred >
 Negate a unary predicate. More...
 

Functions

template<class T , class Pred >
void celeritas::select_if_async (ObserverPtr< T, MemSpace::device > data, size_type num_items, ObserverPtr< size_type, MemSpace::device > num_selected, Pred pred, StreamId stream_id)
 Stably compact, in place, the items that satisfy a predicate.
 
template<class InputIt , class T , class Pred >
void celeritas::copy_if_async (InputIt input, ObserverPtr< T, MemSpace::device > output, size_type num_items, ObserverPtr< size_type, MemSpace::device > num_selected, Pred pred, StreamId stream_id)
 Stably copy the input items that satisfy a predicate.
 
template<class InputIt , class T >
void celeritas::reduce_sum_async (InputIt input, ObserverPtr< T, MemSpace::device > result, size_type num_items, StreamId stream_id)
 Calculate the sum of a fixed number of input values.
 
template<class InputIt , class T >
void celeritas::exclusive_sum_async (InputIt input, ObserverPtr< T, MemSpace::device > output, size_type num_items, StreamId stream_id)
 Calculate the exclusive prefix sum of a fixed number of input values.
 
template<class InputIt , class T >
void celeritas::inclusive_sum_async (InputIt input, ObserverPtr< T, MemSpace::device > output, size_type num_items, StreamId stream_id)
 Calculate the inclusive prefix sum of a fixed number of input values.
 

Function Documentation

◆ copy_if_async()

template<class InputIt , class T , class Pred >
void celeritas::copy_if_async ( InputIt  input,
ObserverPtr< T, MemSpace::device >  output,
size_type  num_items,
ObserverPtr< size_type, MemSpace::device >  num_selected,
Pred  pred,
StreamId  stream_id 
)

Stably copy the input items that satisfy a predicate.

The input may be any random-access iterator. The number of selected items is written to num_selected in device memory, so this does not synchronize the stream unless the CUB selection algorithm is unavailable (CELER_USE_THRUST).

◆ exclusive_sum_async()

template<class InputIt , class T >
void celeritas::exclusive_sum_async ( InputIt  input,
ObserverPtr< T, MemSpace::device >  output,
size_type  num_items,
StreamId  stream_id 
)

Calculate the exclusive prefix sum of a fixed number of input values.

The input may be any random-access iterator, including the output itself for an in-place scan. This does not synchronize the stream.

◆ inclusive_sum_async()

template<class InputIt , class T >
void celeritas::inclusive_sum_async ( InputIt  input,
ObserverPtr< T, MemSpace::device >  output,
size_type  num_items,
StreamId  stream_id 
)

Calculate the inclusive prefix sum of a fixed number of input values.

The input may be any random-access iterator (e.g., a transform of a counting iterator whose functor reads a device-side size). This does not synchronize the stream.

◆ reduce_sum_async()

template<class InputIt , class T >
void celeritas::reduce_sum_async ( InputIt  input,
ObserverPtr< T, MemSpace::device >  result,
size_type  num_items,
StreamId  stream_id 
)

Calculate the sum of a fixed number of input values.

The result is written to result in device memory, so this does not synchronize the stream unless the CUB reduction is unavailable (HIP without hipCUB).

◆ select_if_async()

template<class T , class Pred >
void celeritas::select_if_async ( ObserverPtr< T, MemSpace::device >  data,
size_type  num_items,
ObserverPtr< size_type, MemSpace::device >  num_selected,
Pred  pred,
StreamId  stream_id 
)

Stably compact, in place, the items that satisfy a predicate.

The number of selected items is written to num_selected in device memory, so this does not synchronize the stream unless the CUB selection algorithm is unavailable (CELER_USE_THRUST). The items past the selected ones are left in an unspecified state.