2using System.Collections.Generic;
5using System.Threading.Tasks;
43 get {
return m_hBuffer; }
51 get {
return m_lCapacity; }
61 m_cuda.FreeHostBuffer(m_hBuffer);
94 if (nCount > m_lCapacity)
97 m_hBuffer = m_cuda.AllocHostBuffer(nCount);
101 m_cuda.CopyDeviceToHost(nCount, hGpu, m_hBuffer);
111 m_cuda.CopyHostToDevice(nCount, m_hBuffer, hGpu);
120 return m_cuda.GetHostMemory(m_hBuffer);
129 return m_cuda.GetHostMemoryDouble(m_hBuffer);
138 return m_cuda.GetHostMemoryFloat(m_hBuffer);
147 if (m_lCapacity < rgSrc.Length)
150 m_hBuffer = m_cuda.AllocHostBuffer(rgSrc.Length);
153 m_cuda.SetHostMemory(m_hBuffer, rgSrc);
The Blob is the main holder of data that moves through the Layers of the Net.
long mutable_gpu_diff
Returns the diff GPU handle used by the CudaDnn connection.
long mutable_gpu_data
Returns the data GPU handle used by the CudaDnn connection.
int count()
Returns the total number of items in the Blob.
long gpu_diff
Returns the diff GPU handle used by the CudaDnn connection.
long gpu_data
Returns the data GPU handle used by the CudaDnn connection.
The CudaDnn object is the main interface to the Low-Level Cuda C++ DLL.
The HostBuffer helps manage host memory, often used when implementing CPU versions of a function or l...
void Free()
Free the host buffer.
double[] GetHostDataAsDouble()
Returns the host buffer data as an array of doubles.
long Capacity
Returns the capacity of the host buffer.
T[] GetHostData()
Returns the host buffer data as an array of the base type.
void SetHostData(T[] rgSrc)
Set the host buffer data, making to expand the capcity if needed.
HostBuffer(CudaDnn< T > cuda)
The constructor.
float[] GetHostDataAsFloat()
Returns the host buffer data as an array of floats.
void Dispose()
Release all resources used.
void CopyToGpu(int nCount, long hGpu)
Copy data from the host buffer into the GPU memory.
void CopyFrom(Blob< T > b, bool bFromDiff=false)
Copy the gpu data from the blob to the host buffer.
void CopyFromGpu(int nCount, long hGpu)
Copy data from the GPU into the host buffer making sure to grow the host buffer capacity if needed.
long Handle
Returns a handle to the host buffer.
void CopyTo(Blob< T > b, bool bToDiff=false)
Copy from the host buffer to the gpu data of the blob.
The MyCaffe.common namespace contains common MyCaffe classes.