mxnet
Public Member Functions | List of all members
OpResource Class Reference

provide resource APIs memory allocation mechanism to Forward/Backward functions More...

#include <lib_api.h>

Collaboration diagram for OpResource:
Collaboration graph

Public Member Functions

 OpResource (xpu_malloc_t cpu_malloc_fp, void *cpu_alloc_fp, xpu_malloc_t gpu_malloc_fp, void *gpu_alloc_fp, void *stream, sparse_malloc_t sparse_malloc_fp, void *sparse_alloc_fp, void *rng_cpu_states, void *rng_gpu_states)
 
void * alloc_cpu (int size) const
 allocate cpu memory controlled by MXNet More...
 
void * alloc_gpu (int size) const
 allocate gpu memory controlled by MXNet More...
 
mx_stream_t get_cuda_stream () const
 return the cuda stream object with correct type More...
 
void alloc_sparse (MXSparse *sparse, int index, int indices_len, int indptr_len=0) const
 allocate sparse memory controlled by MXNet More...
 
mx_cpu_rand_tget_cpu_rand_states () const
 get pointer to initialized and seeded random number states located on CPU More...
 
mx_gpu_rand_tget_gpu_rand_states () const
 get pointer to initialized and seeded random number states located on GPU More...
 

Detailed Description

provide resource APIs memory allocation mechanism to Forward/Backward functions

Constructor & Destructor Documentation

OpResource::OpResource ( xpu_malloc_t  cpu_malloc_fp,
void *  cpu_alloc_fp,
xpu_malloc_t  gpu_malloc_fp,
void *  gpu_alloc_fp,
void *  stream,
sparse_malloc_t  sparse_malloc_fp,
void *  sparse_alloc_fp,
void *  rng_cpu_states,
void *  rng_gpu_states 
)
inline

Member Function Documentation

void* OpResource::alloc_cpu ( int  size) const
inline

allocate cpu memory controlled by MXNet

void* OpResource::alloc_gpu ( int  size) const
inline

allocate gpu memory controlled by MXNet

void OpResource::alloc_sparse ( MXSparse sparse,
int  index,
int  indices_len,
int  indptr_len = 0 
) const
inline

allocate sparse memory controlled by MXNet

mx_cpu_rand_t* OpResource::get_cpu_rand_states ( ) const
inline

get pointer to initialized and seeded random number states located on CPU

mx_stream_t OpResource::get_cuda_stream ( ) const
inline

return the cuda stream object with correct type

mx_gpu_rand_t* OpResource::get_gpu_rand_states ( ) const
inline

get pointer to initialized and seeded random number states located on GPU


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