Dragon - C++ API
A Computation Graph Virtual Machine Based Deep Learning Framework
Public Member Functions | Public Attributes | List of all members
dragon::CUDAObject Class Reference

#include <context_cuda.h>

Public Member Functions

 CUDAObject ()
 Default Constructor. More...
 
 ~CUDAObject ()
 Deconstructor. More...
 
cudaStream_t stream (int device_id, int stream_id)
 Return the specified cuda stream. More...
 
cudaStream_t default_stream ()
 Return the default cuda stream of current device. More...
 
cudaStream_t default_stream (int device_id)
 Return the default cuda stream of given device. More...
 
cublasHandle_t cublas_handle (int device_id, int stream_id)
 Return the specified cublas handle. More...
 
cudnnHandle_t cudnn_handle (int device_id, int stream_id)
 Return the specified cudnn handle. More...
 

Public Attributes

vector< cudaStream_t > cuda_streams_ [CUDA_MAX_DEVICES]
 
vector< cublasHandle_t > cublas_handles_ [CUDA_MAX_DEVICES]
 
vector< cudnnHandle_t > cudnn_handles_ [CUDA_MAX_DEVICES]
 
bool cudnn_enabled_ = true
 

Constructor & Destructor Documentation

◆ CUDAObject()

dragon::CUDAObject::CUDAObject ( )
inline

Default Constructor.

◆ ~CUDAObject()

dragon::CUDAObject::~CUDAObject ( )
inline

Deconstructor.

Do not check the stream destroying, error code 29 (driver shutting down) is inevitable.

Member Function Documentation

◆ cublas_handle()

cublasHandle_t dragon::CUDAObject::cublas_handle ( int  device_id,
int  stream_id 
)
inline

Return the specified cublas handle.

◆ cudnn_handle()

cudnnHandle_t dragon::CUDAObject::cudnn_handle ( int  device_id,
int  stream_id 
)
inline

Return the specified cudnn handle.

◆ default_stream() [1/2]

cudaStream_t dragon::CUDAObject::default_stream ( )
inline

Return the default cuda stream of current device.

◆ default_stream() [2/2]

cudaStream_t dragon::CUDAObject::default_stream ( int  device_id)
inline

Return the default cuda stream of given device.

◆ stream()

cudaStream_t dragon::CUDAObject::stream ( int  device_id,
int  stream_id 
)
inline

Return the specified cuda stream.

Follow the caffe2, Each device takes a group of non-blocking streams.

The stream 0 is reserved for default stream, as some computations really require it, e.g. static primitives, cublas.asum(), and hybrid cpu/cuda operations.

Member Data Documentation

◆ cublas_handles_

vector<cublasHandle_t> dragon::CUDAObject::cublas_handles_[CUDA_MAX_DEVICES]

◆ cuda_streams_

vector<cudaStream_t> dragon::CUDAObject::cuda_streams_[CUDA_MAX_DEVICES]

◆ cudnn_enabled_

bool dragon::CUDAObject::cudnn_enabled_ = true

◆ cudnn_handles_

vector<cudnnHandle_t> dragon::CUDAObject::cudnn_handles_[CUDA_MAX_DEVICES]

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