Medial Code Documentation
Loading...
Searching...
No Matches
Data Structures | Static Public Member Functions
xgboost::common::Transform< CompiledWithCuda > Class Template Reference

Do Transformation on HostDeviceVectors. More...

#include <transform.h>

Static Public Member Functions

template<typename Functor >
static Evaluator< Functor > Init (Functor func, Range const range, int32_t n_threads, int32_t device_idx)
 Initialize a Transform object.
 

Detailed Description

template<bool CompiledWithCuda = WITH_CUDA()>
class xgboost::common::Transform< CompiledWithCuda >

Do Transformation on HostDeviceVectors.

Template Parameters
CompiledWithCudaA bool parameter used to distinguish compilation trajectories, users do not need to use it.

Note: Using Transform is a VERY tricky thing to do. Transform uses template argument to duplicate itself into two different types, one for CPU, another for CUDA. The trick is not without its flaw:

If you use it in a function that can be compiled by both nvcc and host compiler, the behaviour is un-defined! Because your function is NOT duplicated by CompiledWithCuda. At link time, CUDA compiler resolution will merge functions with same signature.

Member Function Documentation

◆ Init()

template<bool CompiledWithCuda = WITH_CUDA()>
template<typename Functor >
static Evaluator< Functor > xgboost::common::Transform< CompiledWithCuda >::Init ( Functor  func,
Range const  range,
int32_t  n_threads,
int32_t  device_idx 
)
inlinestatic

Initialize a Transform object.

Template Parameters
FunctorA callable object type.
Returns
A Evaluator having one method Eval.
Parameters
funcA callable object, accepting a size_t thread index, followed by a set of Span classes.
rangeRange object specifying parallel threads index range.
n_threadsNumber of CPU threads
device_idxGPU device ordinal

The documentation for this class was generated from the following file: