Utilities¶
HPPL Base¶
hl_base.h¶
Defines
-
HL_FLOAT_MAX
¶ HPPL data type: real (float or double)
if real == float
HL_FLOAT_MAX: 3.40282347e+38F
HL_FLOAT_MIN: 1.17549435e-38F
-
HL_FLOAT_MIN
¶ if real == double
HL_FLOAT_MAX: 1.7976931348623157e+308
HL_FLOAT_MIN: 2.2250738585072014e-308
-
EXP_MAX_INPUT
¶ The maximum input value for exp, used to avoid overflow problem.
Currently only used for tanh function.
-
DIVUP
(x, y)¶ DIVUP(x, y) is similar to ceil(x / y).
- Note
- For CUDA, DIVUP will be used to specify the size of blockDim.
Typedefs
-
typedef struct _hl_matrix_s *
hl_matrix_s
¶
-
typedef struct _hl_sparse_matrix_s *
hl_sparse_matrix_s
¶
Enums
-
enum
hl_stream_t
¶ HPPL CUDA Stream.
HPPL is an internal high performance parallel computing library for high-level neural network routines, which can support many heterogeneous compute architectures, such as GPU, FPGA, etc.
- Note
- Each thread can use HPPL_STREAM_* after calling hl_init. HPPL_STREAM_DEFAULT is HPPL default stream.
Values:
-
HPPL_STREAM_DEFAULT
= 0¶
-
HPPL_STREAM_1
= 1¶
-
HPPL_STREAM_2
= 2¶
-
HPPL_STREAM_3
= 3¶
-
HPPL_STREAM_4
= 4¶
-
HPPL_THREAD_STREAM_1
= 5¶
-
HPPL_THREAD_STREAM_2
= 6¶
-
HPPL_THREAD_STREAM_3
= 7¶
-
HPPL_THREAD_STREAM_4
= 8¶
-
HPPL_STREAM_END
¶
-
enum
hl_activation_mode_t
¶ HPPL activation mode.
Values:
-
HL_ACTIVATION_SIGMOID
= 0¶
-
HL_ACTIVATION_RELU
= 1¶
-
HL_ACTIVATION_TANH
= 2¶
-
HL_ACTIVATION_LINEAR
= 3¶
-
HL_ACTIVATION_END
¶
-
-
struct
hl_lstm_value
¶ - #include <hl_base.h>
Lstm value.
- Parameters
gateValue
: input value.prevStateValue
: previous state value.stateValue
: state value.stateActiveValue
: state active value.outputValue
: output value.
-
struct
hl_lstm_grad
¶ - #include <hl_base.h>
Lstm gradient.
- Parameters
gateGrad
: input gradient.prevStateGrad
: previous state gradient.stateGrad
: state gradient.stateActiveGrad
: state active gradient.outputGrad
: output gradient.
-
struct
hl_gru_value
¶ - #include <hl_base.h>
Gru value.
- Parameters
gateWeight
: gate weight (updateGate + resetGate).stateWeight
: frame state weight.gateValue
: gate value results.resetOutputValue
: resetOutput value.outputValue
: output value.prevOutValue
: previous output value.
-
struct
hl_gru_grad
¶ - #include <hl_base.h>
Gru gradient.
- Parameters
gateWeightGrad
: gate weight gradient.stateWeightGrad
: frame state weight gradient.gateGrad
: gate gradient results.resetOutputGrad
: resetOutput gradient.outputGrad
: output gradient.prevOutGrad
: previous output gradient.
-
struct
_hl_sparse_matrix_s
¶ - #include <hl_base.h>
HPPL sparse matrix.
- Parameters
matrix
: sparse matrix.format
: matrix format.type
: the type of matrix values.rows
: matrix rows.cols
: matrix columns.nnz
: nonzero values of sparse matrix.
Public Members
-
hl_matrix_s
matrix
¶
-
hl_matrix_format_t
format
¶
-
hl_matrix_value_t
type
¶
-
int
rows
¶
-
int
cols
¶
-
size_t
nnz
¶
Timer¶
Thread Resource¶
hl_thread.ph¶
Defines
-
HL_THREAD_PH_
¶
Typedefs
-
typedef struct _hl_thread_resource *
hl_thread_resource
¶
Functions
-
void
hl_cudnn_init
(cudnnHandle_t *cudnn_handle, cudaStream_t stream)¶ Initialize cudnn.
- Parameters
cudnn_handle
: Cudnn handle.stream
: Cudnn stream.
-
void
hl_cublas_init
(cublasHandle_t *cublas_handle, cudaStream_t stream)¶ Initialize cublas.
- Parameters
cublas_handle
: Cublas handle.stream
: Cuda stream.
-
void
hl_cudnn_desc_init
(cudnnTensorDescriptor_t *cudnn_desc)¶ Initialize cudnn tensor descriptor.
- Parameters
cudnn_desc
: Cudnn tensor descriptor.
Variables
-
__thread _hl_thread_resource t_resource
thread resource.
-
struct
_hl_thread_resource
¶ Thread resource structure.
- Parameters
stream[HPPL_STREAM_END]
: Stream for thread.handle
: Cublas Handle.gen
: Curand Generator.cudnn_handle
: Cudnn handle.cudnn_desc
: Cudnn image descriptor.*gen_mutex
: Gen lock.*gpu_mem
: HPPL GPU Memory.*cpu_mem
: HPPL CPU Memory.event
: gpu_mem event.device
: Thread device context.major
: Compute capability.is_init
: Thread init or not.