/** * Wrapper for CUBLAS function.<br /> * <br /> * cublasStatus<br /> * cublasGetVector (int n, int elemSize, const void *x, int incx, * void *y, int incy)<br /> *<br /> * copies n elements from a vector x in GPU memory space to a vector y * in CPU memory space. Elements in both vectors are assumed to have a * size of elemSize bytes. Storage spacing between consecutive elements * is incx for the source vector x and incy for the destination vector * y. In general, x points to an object, or part of an object, allocated * via cublasAlloc(). Column major format for two-dimensional matrices * is assumed throughout CUBLAS. Therefore, if the increment for a vector * is equal to 1, this access a column vector while using an increment * equal to the leading dimension of the respective matrix accesses a * row vector.<br /> *<br /> * Return Values<br /> * -------------<br /> * CUBLAS_STATUS_NOT_INITIALIZED if CUBLAS library not been initialized<br /> * CUBLAS_STATUS_INVALID_VALUE if incx, incy, or elemSize <= 0<br /> * CUBLAS_STATUS_MAPPING_ERROR if an error occurred accessing GPU memory<br /> * CUBLAS_STATUS_SUCCESS if the operation completed successfully<br /> */ public static int cublasGetVector (int n, int elemSize, Pointer x, int incx, Pointer y, int incy) { return checkResult(cublasGetVectorNative(n, elemSize, x, incx, y, incy)); }
/** * Wrapper for CUBLAS function.<br /> * <br /> * cublasStatus<br /> * cublasGetVector (int n, int elemSize, const void *x, int incx, * void *y, int incy)<br /> *<br /> * copies n elements from a vector x in GPU memory space to a vector y * in CPU memory space. Elements in both vectors are assumed to have a * size of elemSize bytes. Storage spacing between consecutive elements * is incx for the source vector x and incy for the destination vector * y. In general, x points to an object, or part of an object, allocated * via cublasAlloc(). Column major format for two-dimensional matrices * is assumed throughout CUBLAS. Therefore, if the increment for a vector * is equal to 1, this access a column vector while using an increment * equal to the leading dimension of the respective matrix accesses a * row vector.<br /> *<br /> * Return Values<br /> * -------------<br /> * CUBLAS_STATUS_NOT_INITIALIZED if CUBLAS library not been initialized<br /> * CUBLAS_STATUS_INVALID_VALUE if incx, incy, or elemSize <= 0<br /> * CUBLAS_STATUS_MAPPING_ERROR if an error occurred accessing GPU memory<br /> * CUBLAS_STATUS_SUCCESS if the operation completed successfully<br /> */ public static int cublasGetVector (int n, int elemSize, Pointer x, int incx, Pointer y, int incy) { return checkResult(cublasGetVectorNative(n, elemSize, x, incx, y, incy)); }
/** * Wrapper for CUBLAS function.<br /> * <br /> * cublasStatus<br /> * cublasGetVector (int n, int elemSize, const void *x, int incx, * void *y, int incy)<br /> *<br /> * copies n elements from a vector x in GPU memory space to a vector y * in CPU memory space. Elements in both vectors are assumed to have a * size of elemSize bytes. Storage spacing between consecutive elements * is incx for the source vector x and incy for the destination vector * y. In general, x points to an object, or part of an object, allocated * via cublasAlloc(). Column major format for two-dimensional matrices * is assumed throughout CUBLAS. Therefore, if the increment for a vector * is equal to 1, this access a column vector while using an increment * equal to the leading dimension of the respective matrix accesses a * row vector.<br /> *<br /> * Return Values<br /> * -------------<br /> * CUBLAS_STATUS_NOT_INITIALIZED if CUBLAS library not been initialized<br /> * CUBLAS_STATUS_INVALID_VALUE if incx, incy, or elemSize <= 0<br /> * CUBLAS_STATUS_MAPPING_ERROR if an error occurred accessing GPU memory<br /> * CUBLAS_STATUS_SUCCESS if the operation completed successfully<br /> */ public static int cublasGetVector (int n, int elemSize, Pointer x, int incx, Pointer y, int incy) { return checkResult(cublasGetVectorNative(n, elemSize, x, incx, y, incy)); }
/** * Wrapper for CUBLAS function.<br /> * <br /> * cublasStatus<br /> * cublasGetVector (int n, int elemSize, const void *x, int incx, * void *y, int incy)<br /> *<br /> * copies n elements from a vector x in GPU memory space to a vector y * in CPU memory space. Elements in both vectors are assumed to have a * size of elemSize bytes. Storage spacing between consecutive elements * is incx for the source vector x and incy for the destination vector * y. In general, x points to an object, or part of an object, allocated * via cublasAlloc(). Column major format for two-dimensional matrices * is assumed throughout CUBLAS. Therefore, if the increment for a vector * is equal to 1, this access a column vector while using an increment * equal to the leading dimension of the respective matrix accesses a * row vector.<br /> *<br /> * Return Values<br /> * -------------<br /> * CUBLAS_STATUS_NOT_INITIALIZED if CUBLAS library not been initialized<br /> * CUBLAS_STATUS_INVALID_VALUE if incx, incy, or elemSize <= 0<br /> * CUBLAS_STATUS_MAPPING_ERROR if an error occurred accessing GPU memory<br /> * CUBLAS_STATUS_SUCCESS if the operation completed successfully<br /> */ public static int cublasGetVector (int n, int elemSize, Pointer x, int incx, Pointer y, int incy) { return checkResult(cublasGetVectorNative(n, elemSize, x, incx, y, incy)); }
/** * Wrapper for CUBLAS function.<br /> * <br /> * cublasStatus<br /> * cublasGetVector (int n, int elemSize, const void *x, int incx, * void *y, int incy)<br /> *<br /> * copies n elements from a vector x in GPU memory space to a vector y * in CPU memory space. Elements in both vectors are assumed to have a * size of elemSize bytes. Storage spacing between consecutive elements * is incx for the source vector x and incy for the destination vector * y. In general, x points to an object, or part of an object, allocated * via cublasAlloc(). Column major format for two-dimensional matrices * is assumed throughout CUBLAS. Therefore, if the increment for a vector * is equal to 1, this access a column vector while using an increment * equal to the leading dimension of the respective matrix accesses a * row vector.<br /> *<br /> * Return Values<br /> * -------------<br /> * CUBLAS_STATUS_NOT_INITIALIZED if CUBLAS library not been initialized<br /> * CUBLAS_STATUS_INVALID_VALUE if incx, incy, or elemSize <= 0<br /> * CUBLAS_STATUS_MAPPING_ERROR if an error occurred accessing GPU memory<br /> * CUBLAS_STATUS_SUCCESS if the operation completed successfully<br /> */ public static int cublasGetVector (int n, int elemSize, Pointer x, int incx, Pointer y, int incy) { return checkResult(cublasGetVectorNative(n, elemSize, x, incx, y, incy)); }
/** * Wrapper for CUBLAS function.<br /> * <br /> * cublasStatus<br /> * cublasGetVector (int n, int elemSize, const void *x, int incx, * void *y, int incy)<br /> *<br /> * copies n elements from a vector x in GPU memory space to a vector y * in CPU memory space. Elements in both vectors are assumed to have a * size of elemSize bytes. Storage spacing between consecutive elements * is incx for the source vector x and incy for the destination vector * y. In general, x points to an object, or part of an object, allocated * via cublasAlloc(). Column major format for two-dimensional matrices * is assumed throughout CUBLAS. Therefore, if the increment for a vector * is equal to 1, this access a column vector while using an increment * equal to the leading dimension of the respective matrix accesses a * row vector.<br /> *<br /> * Return Values<br /> * -------------<br /> * CUBLAS_STATUS_NOT_INITIALIZED if CUBLAS library not been initialized<br /> * CUBLAS_STATUS_INVALID_VALUE if incx, incy, or elemSize <= 0<br /> * CUBLAS_STATUS_MAPPING_ERROR if an error occurred accessing GPU memory<br /> * CUBLAS_STATUS_SUCCESS if the operation completed successfully<br /> */ public static int cublasGetVector (int n, int elemSize, Pointer x, int incx, Pointer y, int incy) { return checkResult(cublasGetVectorNative(n, elemSize, x, incx, y, incy)); }
/** * Extended wrapper for arrays of cuDoubleComplex values. Note that this method * only exists for convenience and compatibility with native C code. It * is much more efficient to provide a Pointer to a double array that may * store the complex numbers, where each pair of consecutive numbers in * the array describes the real- and imaginary part of one complex number. * * @see JCublas#cublasGetVector(int, int, Pointer, int, Pointer, int) */ public static int cublasGetVector (int n, Pointer x, int incx, cuDoubleComplex y[], int offsety, int incy) { ByteBuffer byteBuffery = ByteBuffer.allocateDirect(y.length * 8 * 2); byteBuffery.order(ByteOrder.nativeOrder()); DoubleBuffer doubleBuffery = byteBuffery.asDoubleBuffer(); int status = cublasGetVectorNative(n, 16, x, incx, Pointer.to(doubleBuffery).withByteOffset(offsety * 8 * 2), incy); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { doubleBuffery.rewind(); int indexy = offsety; for (int i=0; i<n; i++, indexy+=incy) { y[indexy].x = doubleBuffery.get(indexy*2+0); y[indexy].y = doubleBuffery.get(indexy*2+1); } } return checkResult(status); }
/** * Extended wrapper for arrays of cuComplex values. Note that this method * only exists for convenience and compatibility with native C code. It * is much more efficient to provide a Pointer to a float array that may * store the complex numbers, where each pair of consecutive numbers in * the array describes the real- and imaginary part of one complex number. * * @see jcuda.jcublas.JCublas#cublasGetVector(int, int, jcuda.Pointer, int, jcuda.Pointer, int) */ public static int cublasGetVector (int n, Pointer x, int incx, cuComplex y[], int offsety, int incy) { ByteBuffer byteBuffery = ByteBuffer.allocateDirect(y.length * 4 * 2); byteBuffery.order(ByteOrder.nativeOrder()); FloatBuffer floatBuffery = byteBuffery.asFloatBuffer(); int status = cublasGetVectorNative(n, 8, x, incx, Pointer.to(floatBuffery).withByteOffset(offsety * 4 * 2), incy); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { floatBuffery.rewind(); int indexy = offsety; for (int i=0; i<n; i++, indexy+=incy) { y[indexy].x = floatBuffery.get(indexy*2+0); y[indexy].y = floatBuffery.get(indexy*2+1); } } return checkResult(status); }
/** * Extended wrapper for arrays of cuDoubleComplex values. Note that this method * only exists for convenience and compatibility with native C code. It * is much more efficient to provide a Pointer to a double array that may * store the complex numbers, where each pair of consecutive numbers in * the array describes the real- and imaginary part of one complex number. * * @see JCublas#cublasGetVector(int, int, Pointer, int, Pointer, int) */ public static int cublasGetVector (int n, Pointer x, int incx, cuDoubleComplex y[], int offsety, int incy) { ByteBuffer byteBuffery = ByteBuffer.allocateDirect(y.length * 8 * 2); byteBuffery.order(ByteOrder.nativeOrder()); DoubleBuffer doubleBuffery = byteBuffery.asDoubleBuffer(); int status = cublasGetVectorNative(n, 16, x, incx, Pointer.to(doubleBuffery).withByteOffset(offsety * 8 * 2), incy); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { doubleBuffery.rewind(); int indexy = offsety; for (int i=0; i<n; i++, indexy+=incy) { y[indexy].x = doubleBuffery.get(indexy*2+0); y[indexy].y = doubleBuffery.get(indexy*2+1); } } return checkResult(status); }
/** * Extended wrapper for arrays of cuDoubleComplex values. Note that this method * only exists for convenience and compatibility with native C code. It * is much more efficient to provide a Pointer to a double array that may * store the complex numbers, where each pair of consecutive numbers in * the array describes the real- and imaginary part of one complex number. * * @see JCublas#cublasGetVector(int, int, Pointer, int, Pointer, int) */ public static int cublasGetVector (int n, Pointer x, int incx, cuDoubleComplex y[], int offsety, int incy) { ByteBuffer byteBuffery = ByteBuffer.allocateDirect(y.length * 8 * 2); byteBuffery.order(ByteOrder.nativeOrder()); DoubleBuffer doubleBuffery = byteBuffery.asDoubleBuffer(); int status = cublasGetVectorNative(n, 16, x, incx, Pointer.to(doubleBuffery).withByteOffset(offsety * 8 * 2), incy); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { doubleBuffery.rewind(); int indexy = offsety; for (int i=0; i<n; i++, indexy+=incy) { y[indexy].x = doubleBuffery.get(indexy*2+0); y[indexy].y = doubleBuffery.get(indexy*2+1); } } return checkResult(status); }
/** * Extended wrapper for arrays of cuDoubleComplex values. Note that this method * only exists for convenience and compatibility with native C code. It * is much more efficient to provide a Pointer to a double array that may * store the complex numbers, where each pair of consecutive numbers in * the array describes the real- and imaginary part of one complex number. * * @see JCublas#cublasGetVector(int, int, Pointer, int, Pointer, int) */ public static int cublasGetVector (int n, Pointer x, int incx, cuDoubleComplex y[], int offsety, int incy) { ByteBuffer byteBuffery = ByteBuffer.allocateDirect(y.length * 8 * 2); byteBuffery.order(ByteOrder.nativeOrder()); DoubleBuffer doubleBuffery = byteBuffery.asDoubleBuffer(); int status = cublasGetVectorNative(n, 16, x, incx, Pointer.to(doubleBuffery).withByteOffset(offsety * 8 * 2), incy); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { doubleBuffery.rewind(); int indexy = offsety; for (int i=0; i<n; i++, indexy+=incy) { y[indexy].x = doubleBuffery.get(indexy*2+0); y[indexy].y = doubleBuffery.get(indexy*2+1); } } return checkResult(status); }
/** * Extended wrapper for arrays of cuDoubleComplex values. Note that this method * only exists for convenience and compatibility with native C code. It * is much more efficient to provide a Pointer to a double array that may * store the complex numbers, where each pair of consecutive numbers in * the array describes the real- and imaginary part of one complex number. * * @see jcuda.jcublas.JCublas#cublasGetVector(int, int, jcuda.Pointer, int, jcuda.Pointer, int) */ public static int cublasGetVector (int n, Pointer x, int incx, cuDoubleComplex y[], int offsety, int incy) { ByteBuffer byteBuffery = ByteBuffer.allocateDirect(y.length * 8 * 2); byteBuffery.order(ByteOrder.nativeOrder()); DoubleBuffer doubleBuffery = byteBuffery.asDoubleBuffer(); int status = cublasGetVectorNative(n, 16, x, incx, Pointer.to(doubleBuffery).withByteOffset(offsety * 8 * 2), incy); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { doubleBuffery.rewind(); int indexy = offsety; for (int i=0; i<n; i++, indexy+=incy) { y[indexy].x = doubleBuffery.get(indexy*2+0); y[indexy].y = doubleBuffery.get(indexy*2+1); } } return checkResult(status); }
/** * Extended wrapper for arrays of cuComplex values. Note that this method * only exists for convenience and compatibility with native C code. It * is much more efficient to provide a Pointer to a float array that may * store the complex numbers, where each pair of consecutive numbers in * the array describes the real- and imaginary part of one complex number. * * @see JCublas#cublasGetVector(int, int, Pointer, int, Pointer, int) */ public static int cublasGetVector (int n, Pointer x, int incx, cuComplex y[], int offsety, int incy) { ByteBuffer byteBuffery = ByteBuffer.allocateDirect(y.length * 4 * 2); byteBuffery.order(ByteOrder.nativeOrder()); FloatBuffer floatBuffery = byteBuffery.asFloatBuffer(); int status = cublasGetVectorNative(n, 8, x, incx, Pointer.to(floatBuffery).withByteOffset(offsety * 4 * 2), incy); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { floatBuffery.rewind(); int indexy = offsety; for (int i=0; i<n; i++, indexy+=incy) { y[indexy].x = floatBuffery.get(indexy*2+0); y[indexy].y = floatBuffery.get(indexy*2+1); } } return checkResult(status); }
/** * Extended wrapper for arrays of cuComplex values. Note that this method * only exists for convenience and compatibility with native C code. It * is much more efficient to provide a Pointer to a float array that may * store the complex numbers, where each pair of consecutive numbers in * the array describes the real- and imaginary part of one complex number. * * @see JCublas#cublasGetVector(int, int, Pointer, int, Pointer, int) */ public static int cublasGetVector (int n, Pointer x, int incx, cuComplex y[], int offsety, int incy) { ByteBuffer byteBuffery = ByteBuffer.allocateDirect(y.length * 4 * 2); byteBuffery.order(ByteOrder.nativeOrder()); FloatBuffer floatBuffery = byteBuffery.asFloatBuffer(); int status = cublasGetVectorNative(n, 8, x, incx, Pointer.to(floatBuffery).withByteOffset(offsety * 4 * 2), incy); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { floatBuffery.rewind(); int indexy = offsety; for (int i=0; i<n; i++, indexy+=incy) { y[indexy].x = floatBuffery.get(indexy*2+0); y[indexy].y = floatBuffery.get(indexy*2+1); } } return checkResult(status); }
/** * Extended wrapper for arrays of cuComplex values. Note that this method * only exists for convenience and compatibility with native C code. It * is much more efficient to provide a Pointer to a float array that may * store the complex numbers, where each pair of consecutive numbers in * the array describes the real- and imaginary part of one complex number. * * @see JCublas#cublasGetVector(int, int, Pointer, int, Pointer, int) */ public static int cublasGetVector (int n, Pointer x, int incx, cuComplex y[], int offsety, int incy) { ByteBuffer byteBuffery = ByteBuffer.allocateDirect(y.length * 4 * 2); byteBuffery.order(ByteOrder.nativeOrder()); FloatBuffer floatBuffery = byteBuffery.asFloatBuffer(); int status = cublasGetVectorNative(n, 8, x, incx, Pointer.to(floatBuffery).withByteOffset(offsety * 4 * 2), incy); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { floatBuffery.rewind(); int indexy = offsety; for (int i=0; i<n; i++, indexy+=incy) { y[indexy].x = floatBuffery.get(indexy*2+0); y[indexy].y = floatBuffery.get(indexy*2+1); } } return checkResult(status); }
/** * Extended wrapper for arrays of cuComplex values. Note that this method * only exists for convenience and compatibility with native C code. It * is much more efficient to provide a Pointer to a float array that may * store the complex numbers, where each pair of consecutive numbers in * the array describes the real- and imaginary part of one complex number. * * @see JCublas#cublasGetVector(int, int, Pointer, int, Pointer, int) */ public static int cublasGetVector (int n, Pointer x, int incx, cuComplex y[], int offsety, int incy) { ByteBuffer byteBuffery = ByteBuffer.allocateDirect(y.length * 4 * 2); byteBuffery.order(ByteOrder.nativeOrder()); FloatBuffer floatBuffery = byteBuffery.asFloatBuffer(); int status = cublasGetVectorNative(n, 8, x, incx, Pointer.to(floatBuffery).withByteOffset(offsety * 4 * 2), incy); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { floatBuffery.rewind(); int indexy = offsety; for (int i=0; i<n; i++, indexy+=incy) { y[indexy].x = floatBuffery.get(indexy*2+0); y[indexy].y = floatBuffery.get(indexy*2+1); } } return checkResult(status); }
/** * Extended wrapper for arrays of cuComplex values. Note that this method * only exists for convenience and compatibility with native C code. It * is much more efficient to provide a Pointer to a float array that may * store the complex numbers, where each pair of consecutive numbers in * the array describes the real- and imaginary part of one complex number. * * @see JCublas#cublasGetVector(int, int, Pointer, int, Pointer, int) */ public static int cublasGetVector (int n, Pointer x, int incx, cuComplex y[], int offsety, int incy) { ByteBuffer byteBuffery = ByteBuffer.allocateDirect(y.length * 4 * 2); byteBuffery.order(ByteOrder.nativeOrder()); FloatBuffer floatBuffery = byteBuffery.asFloatBuffer(); int status = cublasGetVectorNative(n, 8, x, incx, Pointer.to(floatBuffery).withByteOffset(offsety * 4 * 2), incy); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { floatBuffery.rewind(); int indexy = offsety; for (int i=0; i<n; i++, indexy+=incy) { y[indexy].x = floatBuffery.get(indexy*2+0); y[indexy].y = floatBuffery.get(indexy*2+1); } } return checkResult(status); }
/** * Extended wrapper for arrays of cuDoubleComplex values. Note that this method * only exists for convenience and compatibility with native C code. It * is much more efficient to provide a Pointer to a double array that may * store the complex numbers, where each pair of consecutive numbers in * the array describes the real- and imaginary part of one complex number. * * @see JCublas#cublasGetVector(int, int, Pointer, int, Pointer, int) */ public static int cublasGetVector (int n, Pointer x, int incx, cuDoubleComplex y[], int offsety, int incy) { ByteBuffer byteBuffery = ByteBuffer.allocateDirect(y.length * 8 * 2); byteBuffery.order(ByteOrder.nativeOrder()); DoubleBuffer doubleBuffery = byteBuffery.asDoubleBuffer(); int status = cublasGetVectorNative(n, 16, x, incx, Pointer.to(doubleBuffery).withByteOffset(offsety * 8 * 2), incy); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { doubleBuffery.rewind(); int indexy = offsety; for (int i=0; i<n; i++, indexy+=incy) { y[indexy].x = doubleBuffery.get(indexy*2+0); y[indexy].y = doubleBuffery.get(indexy*2+1); } } return checkResult(status); }