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 >:

## 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. More...

## Detailed Description

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

Do Transformation on HostDeviceVectors.

Template Parameters

  CompiledWithCuda | A 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
| ) |  |
| inline static

Initialize a Transform object.

Template Parameters

  Functor | A callable object type.

Returns
  A Evaluator having one method Eval.

Parameters

  func | A callable object, accepting a size_t thread index, followed by a set of Span classes.
  range | Range object specifying parallel threads index range.
  n_threads | Number of CPU threads
  device_idx | GPU device ordinal

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

- /home/runner/work/xgboost/xgboost/src/common/transform.h