- All Implemented Interfaces:
AutoCloseable
CudaBuffer class represents a region of memory on a specific
device.
Data may be transferred between the device and the Java host via the
various copyTo or copyFrom methods. A buffer may be filled
with a specific pattern through use of one of the fillXxx methods.
When no longer required, a buffer must be closed.
-
Constructor Summary
ConstructorsConstructorDescriptionCudaBuffer(CudaDevice device, long byteCount) Allocates a new region on the specifieddeviceof sizebyteCountbytes. -
Method Summary
Modifier and TypeMethodDescriptionatOffset(long fromOffset) Returns a sub-region of this buffer.voidclose()Releases the region of device memory backing this buffer.voidcopyFrom(byte[] array) Copies all data from the specifiedarray(on the Java host) to this buffer (on the device).voidcopyFrom(byte[] array, int fromIndex, int toIndex) Copies data from the specifiedarray(on the Java host) to this buffer (on the device).voidcopyFrom(char[] array) Copies all data from the specifiedarray(on the Java host) to this buffer (on the device).voidcopyFrom(char[] array, int fromIndex, int toIndex) Copies data from the specifiedarray(on the Java host) to this buffer (on the device).voidcopyFrom(double[] array) Copies all data from the specifiedarray(on the Java host) to this buffer (on the device).voidcopyFrom(double[] array, int fromIndex, int toIndex) Copies data from the specifiedarray(on the Java host) to this buffer (on the device).voidcopyFrom(float[] array) Copies all data from the specifiedarray(on the Java host) to this buffer (on the device).voidcopyFrom(float[] array, int fromIndex, int toIndex) Copies data from the specifiedarray(on the Java host) to this buffer (on the device).voidcopyFrom(int[] array) Copies all data from the specifiedarray(on the Java host) to this buffer (on the device).voidcopyFrom(int[] array, int fromIndex, int toIndex) Copies data from the specifiedarray(on the Java host) to this buffer (on the device).voidcopyFrom(long[] array) Copies all data from the specifiedarray(on the Java host) to this buffer (on the device).voidcopyFrom(long[] array, int fromIndex, int toIndex) Copies data from the specifiedarray(on the Java host) to this buffer (on the device).voidcopyFrom(short[] array) Copies all data from the specifiedarray(on the Java host) to this buffer (on the device).voidcopyFrom(short[] array, int fromIndex, int toIndex) Copies data from the specifiedarray(on the Java host) to this buffer (on the device).voidcopyFrom(CudaBuffer source, long fromOffset, long toOffset) Copies data from the specifiedsourcebuffer (on a device) to this buffer (on the device).voidcopyFrom(ByteBuffer source) Copies data from the specifiedsourcebuffer (on the Java host) to this buffer (on the device).voidcopyFrom(CharBuffer source) Copies data from the specifiedsourcebuffer (on the Java host) to this buffer (on the device).voidcopyFrom(DoubleBuffer source) Copies data from the specifiedsourcebuffer (on the Java host) to this buffer (on the device).voidcopyFrom(FloatBuffer source) Copies data from the specifiedsourcebuffer (on the Java host) to this buffer (on the device).voidCopies data from the specifiedsourcebuffer (on the Java host) to this buffer (on the device).voidcopyFrom(LongBuffer source) Copies data from the specifiedsourcebuffer (on the Java host) to this buffer (on the device).voidcopyFrom(ShortBuffer source) Copies data from the specifiedsourcebuffer (on the Java host) to this buffer (on the device).voidcopyTo(byte[] array) Copies data from this buffer (on the device) to the specifiedarray(on the Java host).voidcopyTo(byte[] array, int fromIndex, int toIndex) Copies data from this buffer (on the device) to the specifiedarray(on the Java host).voidcopyTo(char[] array) Copies data from this buffer (on the device) to the specifiedarray(on the Java host).voidcopyTo(char[] array, int fromIndex, int toIndex) Copies data from this buffer (on the device) to the specifiedarray(on the Java host).voidcopyTo(double[] array) Copies data from this buffer (on the device) to the specifiedarray(on the Java host).voidcopyTo(double[] array, int fromIndex, int toIndex) Copies data from this buffer (on the device) to the specifiedarray(on the Java host).voidcopyTo(float[] array) Copies data from this buffer (on the device) to the specifiedarray(on the Java host).voidcopyTo(float[] array, int fromIndex, int toIndex) Copies data from this buffer (on the device) to the specifiedarray(on the Java host).voidcopyTo(int[] array) Copies data from this buffer (on the device) to the specifiedarray(on the Java host).voidcopyTo(int[] array, int fromIndex, int toIndex) Copies data from this buffer (on the device) to the specifiedarray(on the Java host).voidcopyTo(long[] array) Copies data from this buffer (on the device) to the specifiedarray(on the Java host).voidcopyTo(long[] array, int fromIndex, int toIndex) Copies data from this buffer (on the device) to the specifiedarray(on the Java host).voidcopyTo(short[] array) Copies data from this buffer (on the device) to the specifiedarray(on the Java host).voidcopyTo(short[] array, int fromIndex, int toIndex) Copies data from this buffer (on the device) to the specifiedarray(on the Java host).voidcopyTo(ByteBuffer target) Copies data from this buffer (on the device) to the specifiedtargetbuffer (on the Java host).voidcopyTo(CharBuffer target) Copies data from this buffer (on the device) to the specifiedtargetbuffer (on the Java host).voidcopyTo(DoubleBuffer target) Copies data from this buffer (on the device) to the specifiedtargetbuffer (on the Java host).voidcopyTo(FloatBuffer target) Copies data from this buffer (on the device) to the specifiedtargetbuffer (on the Java host).voidCopies data from this buffer (on the device) to the specifiedtargetbuffer (on the Java host).voidcopyTo(LongBuffer target) Copies data from this buffer (on the device) to the specifiedtargetbuffer (on the Java host).voidcopyTo(ShortBuffer target) Copies data from this buffer (on the device) to the specifiedtargetbuffer (on the Java host).voidfillByte(byte value, long count) Storescountcopies ofvaluein this buffer.voidfillChar(char value, long count) Storescountcopies ofvaluein this buffer.voidfillFloat(float value, long count) Storescountcopies ofvaluein this buffer.voidfillInt(int value, long count) Storescountcopies ofvaluein this buffer.voidfillShort(short value, long count) Storescountcopies ofvaluein this buffer.longReturns the length in bytes of this buffer.slice(long fromOffset, long toOffset) Returns a sub-region of this buffer.
-
Constructor Details
-
CudaBuffer
Allocates a new region on the specifieddeviceof sizebyteCountbytes.- Parameters:
device- the device on which the region is to be allocatedbyteCount- the allocation size in bytes- Throws:
CudaException- if a CUDA exception occurs
-
-
Method Details
-
atOffset
Returns a sub-region of this buffer. The new buffer begins at the specified offset and extends to the end of this buffer.- Parameters:
fromOffset- the byte offset of the sub-region within this buffer- Returns:
- the specified sub-region
- Throws:
IllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the specified offset is negative or larger than the length of this buffer
-
close
Releases the region of device memory backing this buffer.Closing a buffer created via
atOffset(long)with a non-zero offset has no effect: the memory is still accessible via the parent buffer which must be closed separately.- Specified by:
closein interfaceAutoCloseable- Throws:
CudaException- if a CUDA exception occurs
-
copyFrom
Copies all data from the specifiedarray(on the Java host) to this buffer (on the device). Equivalent tocopyFrom(array, 0, array.length);
- Parameters:
array- the source array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedarray(on the Java host) to this buffer (on the device). Elements are read fromarraybeginning atfromIndexcontinuing up to, but excluding,toIndexstoring them in the same order in this buffer.A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
array- the source arrayfromIndex- the source starting offset (inclusive)toIndex- the source ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalArgumentException- iffromIndex > toIndexIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromIndexis negative,toIndex > array.length, or the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedsourcebuffer (on the Java host) to this buffer (on the device). Elements are read fromsourcebeginning atposition()continuing up to, but excluding,limit()storing them in the same order in this buffer. Thesourcebuffer position is set tolimit().A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
source- the source buffer- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies all data from the specifiedarray(on the Java host) to this buffer (on the device). Equivalent tocopyFrom(array, 0, array.length);
- Parameters:
array- the source array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedarray(on the Java host) to this buffer (on the device). Elements are read fromarraybeginning atfromIndexcontinuing up to, but excluding,toIndexstoring them in the same order in this buffer.A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
array- the source arrayfromIndex- the source starting offset (inclusive)toIndex- the source ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalArgumentException- iffromIndex > toIndexIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromIndexis negative,toIndex > array.length, or the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedsourcebuffer (on the Java host) to this buffer (on the device). Elements are read fromsourcebeginning atposition()continuing up to, but excluding,limit()storing them in the same order in this buffer. Thesourcebuffer position is set tolimit().A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
source- the source buffer- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedsourcebuffer (on a device) to this buffer (on the device). Elements are read fromsourcebeginning atposition()continuing up to, but excluding,limit()storing them in the same order in this buffer.A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
source- the source bufferfromOffset- the source starting offset (inclusive)toOffset- the source ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if eitherfromOffsetortoOffsetis not a legal offset within the source buffer or the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies all data from the specifiedarray(on the Java host) to this buffer (on the device). Equivalent tocopyFrom(array, 0, array.length);
- Parameters:
array- the source array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedarray(on the Java host) to this buffer (on the device). Elements are read fromarraybeginning atfromIndexcontinuing up to, but excluding,toIndexstoring them in the same order in this buffer.A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
array- the source arrayfromIndex- the source starting offset (inclusive)toIndex- the source ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalArgumentException- iffromIndex > toIndexIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromIndexis negative,toIndex > array.length, or the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedsourcebuffer (on the Java host) to this buffer (on the device). Elements are read fromsourcebeginning atposition()continuing up to, but excluding,limit()storing them in the same order in this buffer. Thesourcebuffer position is set tolimit().A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
source- the source buffer- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies all data from the specifiedarray(on the Java host) to this buffer (on the device). Equivalent tocopyFrom(array, 0, array.length);
- Parameters:
array- the source array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedarray(on the Java host) to this buffer (on the device). Elements are read fromarraybeginning atfromIndexcontinuing up to, but excluding,toIndexstoring them in the same order in this buffer.A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
array- the source arrayfromIndex- the source starting offset (inclusive)toIndex- the source ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalArgumentException- iffromIndex > toIndexIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromIndexis negative,toIndex > array.length, or the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedsourcebuffer (on the Java host) to this buffer (on the device). Elements are read fromsourcebeginning atposition()continuing up to, but excluding,limit()storing them in the same order in this buffer. Thesourcebuffer position is set tolimit().A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
source- the source buffer- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies all data from the specifiedarray(on the Java host) to this buffer (on the device). Equivalent tocopyFrom(array, 0, array.length);
- Parameters:
array- the source array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedarray(on the Java host) to this buffer (on the device). Elements are read fromarraybeginning atfromIndexcontinuing up to, but excluding,toIndexstoring them in the same order in this buffer.A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
array- the source arrayfromIndex- the source starting offset (inclusive)toIndex- the source ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalArgumentException- iffromIndex > toIndexIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromIndexis negative,toIndex > array.length, or the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedsourcebuffer (on the Java host) to this buffer (on the device). Elements are read fromsourcebeginning atposition()continuing up to, but excluding,limit()storing them in the same order in this buffer. Thesourcebuffer position is set tolimit().A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
source- the source buffer- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies all data from the specifiedarray(on the Java host) to this buffer (on the device). Equivalent tocopyFrom(array, 0, array.length);
- Parameters:
array- the source array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedarray(on the Java host) to this buffer (on the device). Elements are read fromarraybeginning atfromIndexcontinuing up to, but excluding,toIndexstoring them in the same order in this buffer.A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
array- the source arrayfromIndex- the source starting offset (inclusive)toIndex- the source ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalArgumentException- iffromIndex > toIndexIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromIndexis negative,toIndex > array.length, or the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedsourcebuffer (on the Java host) to this buffer (on the device). Elements are read fromsourcebeginning atposition()continuing up to, but excluding,limit()storing them in the same order in this buffer. Thesourcebuffer position is set tolimit().A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
source- the source buffer- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies all data from the specifiedarray(on the Java host) to this buffer (on the device). Equivalent tocopyFrom(array, 0, array.length);
- Parameters:
array- the source array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedarray(on the Java host) to this buffer (on the device). Elements are read fromarraybeginning atfromIndexcontinuing up to, but excluding,toIndexstoring them in the same order in this buffer.A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
array- the source arrayfromIndex- the source starting offset (inclusive)toIndex- the source ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalArgumentException- iffromIndex > toIndexIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromIndexis negative,toIndex > array.length, or the number of source bytes is larger than the length of this buffer
-
copyFrom
Copies data from the specifiedsourcebuffer (on the Java host) to this buffer (on the device). Elements are read fromsourcebeginning atposition()continuing up to, but excluding,limit()storing them in the same order in this buffer. Thesourcebuffer position is set tolimit().A sub-buffer may be created (see
atOffset(long)) when the data are to be copied somewhere other than the beginning of this buffer.- Parameters:
source- the source buffer- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedarray(on the Java host). Equivalent tocopyTo(array, 0, array.length);
- Parameters:
array- the destination array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedarray(on the Java host). Elements are read starting at the beginning of this buffer and stored inarraybeginning atfromIndexcontinuing up to, but excluding,toIndex.A sub-buffer may be created (see
atOffset(long)) when the source data are not located at the beginning of this buffer.- Parameters:
array- the destination arrayfromIndex- the destination starting offset (inclusive)toIndex- the destination ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalArgumentException- iffromIndex > toIndexIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromIndexis negative,toIndex > array.length, or the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedtargetbuffer (on the Java host). Elements are read starting at the beginning of this buffer and stored intargetbeginning atposition()continuing up to, but excluding,limit(). Thetargetbuffer position is set tolimit().A sub-buffer may be created (see
atOffset(long)) when the source data are not located at the beginning of this buffer.- Parameters:
target- the destination buffer- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedarray(on the Java host). Equivalent tocopyTo(array, 0, array.length);
- Parameters:
array- the destination array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedarray(on the Java host). Elements are read starting at the beginning of this buffer and stored inarraybeginning atfromIndexcontinuing up to, but excluding,toIndex.A sub-buffer may be created (see
atOffset(long)) when the source data are not located at the beginning of this buffer.- Parameters:
array- the destination arrayfromIndex- the destination starting offset (inclusive)toIndex- the destination ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalArgumentException- iffromIndex > toIndexIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromIndexis negative,toIndex > array.length, or the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedtargetbuffer (on the Java host). Elements are read starting at the beginning of this buffer and stored intargetbeginning atposition()continuing up to, but excluding,limit(). Thetargetbuffer position is set tolimit().A sub-buffer may be created (see
atOffset(long)) when the source data are not located at the beginning of this buffer.- Parameters:
target- the destination buffer- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedarray(on the Java host). Equivalent tocopyTo(array, 0, array.length);
- Parameters:
array- the destination array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedarray(on the Java host). Elements are read starting at the beginning of this buffer and stored inarraybeginning atfromIndexcontinuing up to, but excluding,toIndex.A sub-buffer may be created (see
atOffset(long)) when the source data are not located at the beginning of this buffer.- Parameters:
array- the destination arrayfromIndex- the destination starting offset (inclusive)toIndex- the destination ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalArgumentException- iffromIndex > toIndexIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromIndexis negative,toIndex > array.length, or the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedtargetbuffer (on the Java host). Elements are read starting at the beginning of this buffer and stored intargetbeginning atposition()continuing up to, but excluding,limit(). Thetargetbuffer position is set tolimit().A sub-buffer may be created (see
atOffset(long)) when the source data are not located at the beginning of this buffer.- Parameters:
target- the destination buffer- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedarray(on the Java host). Equivalent tocopyTo(array, 0, array.length);
- Parameters:
array- the destination array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedarray(on the Java host). Elements are read starting at the beginning of this buffer and stored inarraybeginning atfromIndexcontinuing up to, but excluding,toIndex.A sub-buffer may be created (see
atOffset(long)) when the source data are not located at the beginning of this buffer.- Parameters:
array- the destination arrayfromIndex- the destination starting offset (inclusive)toIndex- the destination ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalArgumentException- iffromIndex > toIndexIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromIndexis negative,toIndex > array.length, or the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedtargetbuffer (on the Java host). Elements are read starting at the beginning of this buffer and stored intargetbeginning atposition()continuing up to, but excluding,limit(). Thetargetbuffer position is set tolimit().A sub-buffer may be created (see
atOffset(long)) when the source data are not located at the beginning of this buffer.- Parameters:
target- the destination buffer- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedarray(on the Java host). Equivalent tocopyTo(array, 0, array.length);
- Parameters:
array- the destination array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedarray(on the Java host). Elements are read starting at the beginning of this buffer and stored inarraybeginning atfromIndexcontinuing up to, but excluding,toIndex.A sub-buffer may be created (see
atOffset(long)) when the source data are not located at the beginning of this buffer.- Parameters:
array- the destination arrayfromIndex- the destination starting offset (inclusive)toIndex- the destination ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalArgumentException- iffromIndex > toIndexIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromIndexis negative,toIndex > array.length, or the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedtargetbuffer (on the Java host). Elements are read starting at the beginning of this buffer and stored intargetbeginning atposition()continuing up to, but excluding,limit(). Thetargetbuffer position is set tolimit().A sub-buffer may be created (see
atOffset(long)) when the source data are not located at the beginning of this buffer.- Parameters:
target- the destination buffer- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedarray(on the Java host). Equivalent tocopyTo(array, 0, array.length);
- Parameters:
array- the destination array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedarray(on the Java host). Elements are read starting at the beginning of this buffer and stored inarraybeginning atfromIndexcontinuing up to, but excluding,toIndex.A sub-buffer may be created (see
atOffset(long)) when the source data are not located at the beginning of this buffer.- Parameters:
array- the destination arrayfromIndex- the destination starting offset (inclusive)toIndex- the destination ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalArgumentException- iffromIndex > toIndexIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromIndexis negative,toIndex > array.length, or the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedtargetbuffer (on the Java host). Elements are read starting at the beginning of this buffer and stored intargetbeginning atposition()continuing up to, but excluding,limit(). Thetargetbuffer position is set tolimit().A sub-buffer may be created (see
atOffset(long)) when the source data are not located at the beginning of this buffer.- Parameters:
target- the destination buffer- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedarray(on the Java host). Equivalent tocopyTo(array, 0, array.length);
- Parameters:
array- the destination array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedarray(on the Java host). Elements are read starting at the beginning of this buffer and stored inarraybeginning atfromIndexcontinuing up to, but excluding,toIndex.A sub-buffer may be created (see
atOffset(long)) when the source data are not located at the beginning of this buffer.- Parameters:
array- the destination arrayfromIndex- the destination starting offset (inclusive)toIndex- the destination ending offset (exclusive)- Throws:
CudaException- if a CUDA exception occursIllegalArgumentException- iffromIndex > toIndexIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromIndexis negative,toIndex > array.length, or the number of required source bytes is larger than the length of this buffer
-
copyTo
Copies data from this buffer (on the device) to the specifiedtargetbuffer (on the Java host). Elements are read starting at the beginning of this buffer and stored intargetbeginning atposition()continuing up to, but excluding,limit(). Thetargetbuffer position is set tolimit().A sub-buffer may be created (see
atOffset(long)) when the source data are not located at the beginning of this buffer.- Parameters:
target- the destination buffer- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the number of required source bytes is larger than the length of this buffer
-
fillByte
Storescountcopies ofvaluein this buffer.A sub-buffer may be created (see
atOffset(long)) when the values are to be stored somewhere other than the beginning of this buffer.- Parameters:
value- the destination arraycount- the destination array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the space required is larger than the length of this buffer
-
fillChar
Storescountcopies ofvaluein this buffer.A sub-buffer may be created (see
atOffset(long)) when the values are to be stored somewhere other than the beginning of this buffer.- Parameters:
value- the destination arraycount- the destination array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the space required is larger than the length of this buffer
-
fillFloat
Storescountcopies ofvaluein this buffer.A sub-buffer may be created (see
atOffset(long)) when the values are to be stored somewhere other than the beginning of this buffer.- Parameters:
value- the destination arraycount- the destination array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the space required is larger than the length of this buffer
-
fillInt
Storescountcopies ofvaluein this buffer.A sub-buffer may be created (see
atOffset(long)) when the values are to be stored somewhere other than the beginning of this buffer.- Parameters:
value- the destination arraycount- the destination array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the space required is larger than the length of this buffer
-
fillShort
Storescountcopies ofvaluein this buffer.A sub-buffer may be created (see
atOffset(long)) when the values are to be stored somewhere other than the beginning of this buffer.- Parameters:
value- the destination arraycount- the destination array- Throws:
CudaException- if a CUDA exception occursIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- if the space required is larger than the length of this buffer
-
getLength
public long getLength()Returns the length in bytes of this buffer.- Returns:
- the length in bytes of this buffer
-
slice
Returns a sub-region of this buffer. The new buffer begins at the specified fromOffset and extends to the specified toOffset (exclusive).- Parameters:
fromOffset- the byte offset of the start of the sub-region within this buffertoOffset- the byte offset of the end of the sub-region within this buffer- Returns:
- the specified sub-region
- Throws:
IllegalArgumentException- iffromOffset > toOffsetIllegalStateException- if this buffer has been closed (seeclose())IndexOutOfBoundsException- iffromOffsetis negative,toOffset > length, or the number of source bytes is larger than the length of this buffer
-