public abstract class BaseCudaDataBuffer extends BaseDataBuffer implements JCudaBuffer
DataBuffer.AllocationMode, DataBuffer.Type| Modifier and Type | Field and Description |
|---|---|
protected AtomicBoolean |
freed |
protected AtomicBoolean |
modified |
protected com.google.common.collect.Table<String,org.apache.commons.lang3.tuple.Triple<Integer,Integer,Integer>,DevicePointerInfo> |
pointersToContexts
Pointers to contexts covers this buffer on the gpu at offset 0
for each thread.
|
protected WeakReference<DataBuffer> |
ref |
protected Collection<String> |
referencing |
allocationMode, dataBuffer, dirty, doubleData, elementSize, floatData, intData, isPersist, length| Constructor and Description |
|---|
BaseCudaDataBuffer(byte[] data,
int length) |
BaseCudaDataBuffer(io.netty.buffer.ByteBuf buf,
int length) |
BaseCudaDataBuffer(double[] data) |
BaseCudaDataBuffer(double[] data,
boolean copy) |
BaseCudaDataBuffer(float[] data) |
BaseCudaDataBuffer(float[] data,
boolean copy) |
BaseCudaDataBuffer(int length) |
BaseCudaDataBuffer(int[] data) |
BaseCudaDataBuffer(int[] data,
boolean copy) |
BaseCudaDataBuffer(int length,
int elementSize)
Base constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addReferencing(String id) |
DataBuffer.AllocationMode |
allocationMode() |
void |
assign(DataBuffer data) |
boolean |
copied(String name)
Returns true if the buffer has
already been copied to the device
|
void |
copyAtStride(DataBuffer buf,
int n,
int stride,
int yStride,
int offset,
int yOffset) |
void |
copyToHost(CudaContext context,
int offset,
int length)
Copy to the host synchronizing
using the given context
|
void |
copyToHost(int offset,
int length)
Copies the buffer to the host
|
void |
destroy() |
void |
flush() |
boolean |
freeDevicePointer(int offset,
int length)
Frees the pointer
|
IComplexNumber |
getComplex(int i) |
IComplexDouble |
getComplexDouble(int i) |
IComplexFloat |
getComplexFloat(int i) |
Pointer |
getDevicePointer(INDArray arr,
int stride,
int offset,
int length)
Get the device pointer with the given offset and stride
|
Pointer |
getDevicePointer(int stride,
int offset,
int length)
Get the device pointer with the given offset and stride
|
int |
getElementSize() |
ByteBuffer |
getHostBuffer()
Get the underlying host bytebuffer
|
Pointer |
getHostPointer()
THe pointer for the buffer
|
Pointer |
getHostPointer(int offset)
Get the host pointer with the given offset
note that this will automatically
multiply the specified offset
by the element size
|
com.google.common.collect.Table<String,org.apache.commons.lang3.tuple.Triple<Integer,Integer,Integer>,DevicePointerInfo> |
getPointersToContexts()
Pointer to context map.
|
void |
put(int i,
double element) |
void |
put(int i,
float element) |
void |
put(int i,
IComplexNumber result) |
Collection<String> |
references() |
void |
removeReferencing(String id) |
protected void |
set(int index,
int length,
Pointer from)
Set an individual element
|
protected void |
set(int index,
int length,
Pointer from,
int inc)
Set an individual element
|
protected void |
set(int index,
Pointer from)
Set an individual element
|
void |
set(Pointer pointer)
Sets the data for this pointer
from the data in this pointer
|
void |
setCopied(String name)
Returns true if the data for this
thread name has already been copied
|
void |
setHostBuffer(ByteBuffer hostBuffer)
Set the underlying host buffer, very fast method of copying on RAM side and not using cublas (SLOW)
|
void |
setPointersToContexts(com.google.common.collect.Table<String,org.apache.commons.lang3.tuple.Triple<Integer,Integer,Integer>,DevicePointerInfo> pointersToContexts) |
String |
toString() |
array, asBytes, asDouble, asFloat, asInt, asNetty, asNio, asNioDouble, asNioFloat, assign, assign, assign, assign, assign, assign, assign, assign, assign, create, create, create, create, create, dirty, doReadObject, dup, ensureWritable, equals, getDouble, getDoublesAt, getDoublesAt, getFloat, getFloatsAt, getFloatsAt, getInt, getNumber, hashCode, isPersist, length, persist, put, read, read, setData, setData, setData, unPersist, write, writeclone, finalize, getClass, notify, notifyAll, wait, wait, waitarray, asBytes, asDouble, asFloat, asInt, asNetty, asNio, asNioDouble, asNioFloat, assign, assign, assign, assign, assign, assign, assign, assign, assign, dataType, dirty, dup, getDouble, getDoublesAt, getDoublesAt, getFloat, getFloatsAt, getFloatsAt, getInt, getNumber, isPersist, length, persist, put, read, setData, setData, setData, unPersist, writeprotected transient com.google.common.collect.Table<String,org.apache.commons.lang3.tuple.Triple<Integer,Integer,Integer>,DevicePointerInfo> pointersToContexts
protected AtomicBoolean modified
protected Collection<String> referencing
protected transient WeakReference<DataBuffer> ref
protected AtomicBoolean freed
public BaseCudaDataBuffer(io.netty.buffer.ByteBuf buf,
int length)
public BaseCudaDataBuffer(float[] data,
boolean copy)
public BaseCudaDataBuffer(double[] data,
boolean copy)
public BaseCudaDataBuffer(int[] data,
boolean copy)
public BaseCudaDataBuffer(int length,
int elementSize)
length - the length of the bufferelementSize - the size of each elementpublic BaseCudaDataBuffer(int length)
public BaseCudaDataBuffer(float[] data)
public BaseCudaDataBuffer(int[] data)
public BaseCudaDataBuffer(double[] data)
public BaseCudaDataBuffer(byte[] data,
int length)
public void copyAtStride(DataBuffer buf, int n, int stride, int yStride, int offset, int yOffset)
copyAtStride in interface DataBuffercopyAtStride in class BaseDataBufferpublic boolean copied(String name)
JCudaBuffercopied in interface JCudaBufferpublic void setCopied(String name)
JCudaBuffersetCopied in interface JCudaBuffername - the name of the thread to
check for whether it's been copied or notpublic DataBuffer.AllocationMode allocationMode()
allocationMode in interface DataBufferallocationMode in class BaseDataBufferpublic ByteBuffer getHostBuffer()
JCudaBuffergetHostBuffer in interface JCudaBufferpublic void setHostBuffer(ByteBuffer hostBuffer)
JCudaBuffersetHostBuffer in interface JCudaBufferpublic Pointer getHostPointer()
JCudaBuffergetHostPointer in interface JCudaBufferpublic Pointer getHostPointer(int offset)
JCudaBuffergetHostPointer in interface JCudaBufferoffset - the offset (NOT MULTIPLIED BY ELEMENT SIZE) to index in to the pointer atpublic void removeReferencing(String id)
removeReferencing in interface DataBufferremoveReferencing in class BaseDataBufferpublic Collection<String> references()
references in interface DataBufferreferences in class BaseDataBufferpublic int getElementSize()
getElementSize in interface DataBufferpublic void addReferencing(String id)
addReferencing in interface DataBufferaddReferencing in class BaseDataBufferpublic void put(int i,
IComplexNumber result)
put in interface DataBufferput in class BaseDataBufferpublic Pointer getDevicePointer(int stride, int offset, int length)
JCudaBuffergetDevicePointer in interface JCudaBufferstride - the stride for the device pointeroffset - the offset for the device pointerlength - the length of the pointerpublic Pointer getDevicePointer(INDArray arr, int stride, int offset, int length)
JCudaBuffergetDevicePointer in interface JCudaBufferarr - the array to get the device pointer forstride - the stride for the device pointeroffset - the offset for the device pointerlength - the length of the pointerpublic void set(Pointer pointer)
JCudaBufferset in interface JCudaBufferpointer - the pointer to setpublic void put(int i,
float element)
put in interface DataBufferput in class BaseDataBufferpublic void put(int i,
double element)
put in interface DataBufferput in class BaseDataBufferpublic IComplexFloat getComplexFloat(int i)
getComplexFloat in interface DataBuffergetComplexFloat in class BaseDataBufferpublic IComplexDouble getComplexDouble(int i)
getComplexDouble in interface DataBuffergetComplexDouble in class BaseDataBufferpublic IComplexNumber getComplex(int i)
getComplex in interface DataBuffergetComplex in class BaseDataBufferprotected void set(int index,
int length,
Pointer from,
int inc)
index - the index of the elementfrom - the element to get data fromprotected void set(int index,
int length,
Pointer from)
index - the index of the elementfrom - the element to get data frompublic void assign(DataBuffer data)
assign in interface DataBufferassign in class BaseDataBufferprotected void set(int index,
Pointer from)
index - the index of the elementfrom - the element to get data frompublic boolean freeDevicePointer(int offset,
int length)
JCudaBufferfreeDevicePointer in interface JCudaBufferoffset - the offset to freelength - the length to freepublic void copyToHost(CudaContext context, int offset, int length)
JCudaBuffercopyToHost in interface JCudaBuffercontext - the context to synchronizeoffset - the offset to copylength - the length to copypublic void copyToHost(int offset,
int length)
JCudaBuffercopyToHost in interface JCudaBufferoffset - the offset for the buffer (one buffer may have multiple pointerslength - the length of the pointer (one buffer may have different lengths)public void flush()
flush in interface DataBufferflush in class BaseDataBufferpublic void destroy()
destroy in interface DataBufferdestroy in class BaseDataBufferpublic com.google.common.collect.Table<String,org.apache.commons.lang3.tuple.Triple<Integer,Integer,Integer>,DevicePointerInfo> getPointersToContexts()
JCudaBuffergetPointersToContexts in interface JCudaBufferpublic void setPointersToContexts(com.google.common.collect.Table<String,org.apache.commons.lang3.tuple.Triple<Integer,Integer,Integer>,DevicePointerInfo> pointersToContexts)
public String toString()
toString in class BaseDataBufferCopyright © 2015. All Rights Reserved.