| The CPU Context, representing the bare
| minimum of what a Context class in Caffe2
| should implement.
|
| // TODO modify docs
|
| See operator.h, especially Operator,
| for how Context are used in actual operator
| implementations that are associated
| with specific devices.
|
| In general, the Context class is passed
| in as a template argument, and the operator
| can use the functions defined in the
| context to execute whatever computation
| it has.
|
| CudnnState is the owner of the CudnnWorkspace,
| and serializes all executions of operations
| that use the state onto it’s own stream
| (so multiple Net workers can reuse the same workspace
| from different threads and CUDA streams).
|
| CudnnWorkspace is a wrapper around
| a raw cuda pointer that holds the cudnn
| scratch space.
|
| This struct is meant to be only used in
|
| CudnnWrapper to provide a program-wide
| scratch space for Cudnn.
|
| The reason behind it is that cudnn function
| calls are usually very efficient, hence
| one probably does not want to run multiple
| cudnn calls at the same time.
|
| As a result, one should not need more
| than one cudnn workspace per device.
|
| CudnnWrapper is a class that wraps the
| cudnn handles and cudnn workspaces.
|
| The wrapper ensures that for each thread
| and each gpu, there is one identical
| cudnn handle, which is also associated
| with the thread-local per-device cuda
| stream. The wrapper also hosts the device-specific
| cudnn workspace (scratch space for
| some cudnn functions).
|
| A struct to host thread-local cuda objects.
|
| In Caffe2, each thread has its own non-default
| cuda stream as well as related objects
| such as cublas and curand handles.
|
| This is achieved by having the ThreadLocalCUDAObjects
| wrapper that takes care of allocating
| and deallocating these objects at the
| thread scope.
|
| This class is solely used inside CUDAContext
| and should not be used externally.
|
| This class manages the mapping from
| logical stream ID (int stream_id passed
| around in Caffe2) and CudaStream objects.
|
| We intend to eventually deprecate the
| logical stream ID interface, but not
| for now.
|