xgboost
Classes | Static Public Member Functions | List of all members
xgboost::common::Transform< CompiledWithCuda > Class Template Reference

Do Transformation on HostDeviceVectors. More...

#include <transform.h>

Collaboration diagram for xgboost::common::Transform< CompiledWithCuda >:
Collaboration graph

Static Public Member Functions

template<typename Functor >
static Evaluator< Functor > Init (Functor func, Range const range, int device, bool const shard=true)
 Initialize a Transform object. More...
 

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,
int  device,
bool const  shard = true 
)
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.
deviceSpecify GPU to use.
shardWhether Shard for HostDeviceVector is needed.

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