MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MyCaffe.common.HostBuffer< T > Class Template Reference

The HostBuffer helps manage host memory, often used when implementing CPU versions of a function or layer. More...

Inheritance diagram for MyCaffe.common.HostBuffer< T >:

Public Member Functions

 HostBuffer (CudaDnn< T > cuda)
 The constructor. More...
 
void Dispose ()
 Release all resources used. More...
 
void Free ()
 Free the host buffer. More...
 
void CopyFrom (Blob< T > b, bool bFromDiff=false)
 Copy the gpu data from the blob to the host buffer. More...
 
void CopyTo (Blob< T > b, bool bToDiff=false)
 Copy from the host buffer to the gpu data of the blob. More...
 
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. More...
 
void CopyToGpu (int nCount, long hGpu)
 Copy data from the host buffer into the GPU memory. More...
 
T[] GetHostData ()
 Returns the host buffer data as an array of the base type. More...
 
double[] GetHostDataAsDouble ()
 Returns the host buffer data as an array of doubles. More...
 
float[] GetHostDataAsFloat ()
 Returns the host buffer data as an array of floats. More...
 
void SetHostData (T[] rgSrc)
 Set the host buffer data, making to expand the capcity if needed. More...
 

Properties

long Handle [get]
 Returns a handle to the host buffer. More...
 
long Capacity [get]
 Returns the capacity of the host buffer. More...
 

Detailed Description

The HostBuffer helps manage host memory, often used when implementing CPU versions of a function or layer.

Template Parameters
TSpecifies the base type float or double. Using float is recommended to conserve GPU memory.

Definition at line 13 of file HostBuffer.cs.

Constructor & Destructor Documentation

◆ HostBuffer()

The constructor.

Parameters
cudaSpecifies the CudaDnn link to all low-level functionality.

Definition at line 23 of file HostBuffer.cs.

Member Function Documentation

◆ CopyFrom()

void MyCaffe.common.HostBuffer< T >.CopyFrom ( Blob< T >  b,
bool  bFromDiff = false 
)

Copy the gpu data from the blob to the host buffer.

Parameters
bSpecifies the blob to copy from.
bFromDiffOptionally, specifies to topy from the diff (default = false, which copies from the data).

Definition at line 72 of file HostBuffer.cs.

◆ CopyFromGpu()

void MyCaffe.common.HostBuffer< T >.CopyFromGpu ( int  nCount,
long  hGpu 
)

Copy data from the GPU into the host buffer making sure to grow the host buffer capacity if needed.

Parameters
nCountSpecifies the number of items to copy.
hGpuSpecifies the source GPU data to copy.

Definition at line 92 of file HostBuffer.cs.

◆ CopyTo()

void MyCaffe.common.HostBuffer< T >.CopyTo ( Blob< T >  b,
bool  bToDiff = false 
)

Copy from the host buffer to the gpu data of the blob.

Parameters
bSpecifies the blob to copy to.
bToDiffOptionally, specifies to copy to the diff (default = false, which copies to the data).

Definition at line 82 of file HostBuffer.cs.

◆ CopyToGpu()

void MyCaffe.common.HostBuffer< T >.CopyToGpu ( int  nCount,
long  hGpu 
)

Copy data from the host buffer into the GPU memory.

Parameters
nCountSpecifies the number of items to copy.
hGpuSpecifies the destination GPU memory where the data is to be copied.

Definition at line 109 of file HostBuffer.cs.

◆ Dispose()

void MyCaffe.common.HostBuffer< T >.Dispose ( )

Release all resources used.

Definition at line 33 of file HostBuffer.cs.

◆ Free()

void MyCaffe.common.HostBuffer< T >.Free ( )

Free the host buffer.

Definition at line 57 of file HostBuffer.cs.

◆ GetHostData()

T[] MyCaffe.common.HostBuffer< T >.GetHostData ( )

Returns the host buffer data as an array of the base type.

Returns
The data is returned as an array of the base type.

Definition at line 118 of file HostBuffer.cs.

◆ GetHostDataAsDouble()

double[] MyCaffe.common.HostBuffer< T >.GetHostDataAsDouble ( )

Returns the host buffer data as an array of doubles.

Returns
The data is returned as an array of doubles.

Definition at line 127 of file HostBuffer.cs.

◆ GetHostDataAsFloat()

float[] MyCaffe.common.HostBuffer< T >.GetHostDataAsFloat ( )

Returns the host buffer data as an array of floats.

Returns
The data is returned as an array of floats.

Definition at line 136 of file HostBuffer.cs.

◆ SetHostData()

void MyCaffe.common.HostBuffer< T >.SetHostData ( T[]  rgSrc)

Set the host buffer data, making to expand the capcity if needed.

Parameters
rgSrcSpecifies the source data to set in the host buffer.

Definition at line 145 of file HostBuffer.cs.

Property Documentation

◆ Capacity

long MyCaffe.common.HostBuffer< T >.Capacity
get

Returns the capacity of the host buffer.

Definition at line 49 of file HostBuffer.cs.

◆ Handle

long MyCaffe.common.HostBuffer< T >.Handle
get

Returns a handle to the host buffer.

Definition at line 41 of file HostBuffer.cs.


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