/** * Wrapper for CUBLAS function.<br /> * <br /> * cublasStatus * cublasGetMatrix (int rows, int cols, int elemSize, const void *A, * int lda, void *B, int ldb)<br /> *<br /> * copies a tile of rows x cols elements from a matrix A in GPU memory * space to a matrix B in CPU memory space. Each element requires storage * of elemSize bytes. Both matrices are assumed to be stored in column * major format, with the leading dimension (i.e. number of rows) of * source matrix A provided in lda, and the leading dimension of matrix B * provided in ldb. In general, A points to an object, or part of an * object, that was allocated via cublasAlloc().<br /> *<br /> * Return Values<br /> * -------------<br /> * CUBLAS_STATUS_NOT_INITIALIZED if CUBLAS library has not been initialized<br /> * CUBLAS_STATUS_INVALID_VALUE if rows, cols, eleSize, lda, or ldb <= 0<br /> * CUBLAS_STATUS_MAPPING_ERROR if error occurred accessing GPU memory<br /> * CUBLAS_STATUS_SUCCESS if the operation completed successfully<br /> */ public static int cublasGetMatrix (int rows, int cols, int elemSize, Pointer A, int lda, Pointer B, int ldb) { return checkResult(cublasGetMatrixNative(rows, cols, elemSize, A, lda, B, ldb)); }
/** * Wrapper for CUBLAS function.<br /> * <br /> * cublasStatus * cublasGetMatrix (int rows, int cols, int elemSize, const void *A, * int lda, void *B, int ldb)<br /> *<br /> * copies a tile of rows x cols elements from a matrix A in GPU memory * space to a matrix B in CPU memory space. Each element requires storage * of elemSize bytes. Both matrices are assumed to be stored in column * major format, with the leading dimension (i.e. number of rows) of * source matrix A provided in lda, and the leading dimension of matrix B * provided in ldb. In general, A points to an object, or part of an * object, that was allocated via cublasAlloc().<br /> *<br /> * Return Values<br /> * -------------<br /> * CUBLAS_STATUS_NOT_INITIALIZED if CUBLAS library has not been initialized<br /> * CUBLAS_STATUS_INVALID_VALUE if rows, cols, eleSize, lda, or ldb <= 0<br /> * CUBLAS_STATUS_MAPPING_ERROR if error occurred accessing GPU memory<br /> * CUBLAS_STATUS_SUCCESS if the operation completed successfully<br /> */ public static int cublasGetMatrix (int rows, int cols, int elemSize, Pointer A, int lda, Pointer B, int ldb) { return checkResult(cublasGetMatrixNative(rows, cols, elemSize, A, lda, B, ldb)); }
/** * Wrapper for CUBLAS function.<br /> * <br /> * cublasStatus * cublasGetMatrix (int rows, int cols, int elemSize, const void *A, * int lda, void *B, int ldb)<br /> *<br /> * copies a tile of rows x cols elements from a matrix A in GPU memory * space to a matrix B in CPU memory space. Each element requires storage * of elemSize bytes. Both matrices are assumed to be stored in column * major format, with the leading dimension (i.e. number of rows) of * source matrix A provided in lda, and the leading dimension of matrix B * provided in ldb. In general, A points to an object, or part of an * object, that was allocated via cublasAlloc().<br /> *<br /> * Return Values<br /> * -------------<br /> * CUBLAS_STATUS_NOT_INITIALIZED if CUBLAS library has not been initialized<br /> * CUBLAS_STATUS_INVALID_VALUE if rows, cols, eleSize, lda, or ldb <= 0<br /> * CUBLAS_STATUS_MAPPING_ERROR if error occurred accessing GPU memory<br /> * CUBLAS_STATUS_SUCCESS if the operation completed successfully<br /> */ public static int cublasGetMatrix (int rows, int cols, int elemSize, Pointer A, int lda, Pointer B, int ldb) { return checkResult(cublasGetMatrixNative(rows, cols, elemSize, A, lda, B, ldb)); }
/** * Wrapper for CUBLAS function.<br /> * <br /> * cublasStatus * cublasGetMatrix (int rows, int cols, int elemSize, const void *A, * int lda, void *B, int ldb)<br /> *<br /> * copies a tile of rows x cols elements from a matrix A in GPU memory * space to a matrix B in CPU memory space. Each element requires storage * of elemSize bytes. Both matrices are assumed to be stored in column * major format, with the leading dimension (i.e. number of rows) of * source matrix A provided in lda, and the leading dimension of matrix B * provided in ldb. In general, A points to an object, or part of an * object, that was allocated via cublasAlloc().<br /> *<br /> * Return Values<br /> * -------------<br /> * CUBLAS_STATUS_NOT_INITIALIZED if CUBLAS library has not been initialized<br /> * CUBLAS_STATUS_INVALID_VALUE if rows, cols, eleSize, lda, or ldb <= 0<br /> * CUBLAS_STATUS_MAPPING_ERROR if error occurred accessing GPU memory<br /> * CUBLAS_STATUS_SUCCESS if the operation completed successfully<br /> */ public static int cublasGetMatrix (int rows, int cols, int elemSize, Pointer A, int lda, Pointer B, int ldb) { return checkResult(cublasGetMatrixNative(rows, cols, elemSize, A, lda, B, ldb)); }
/** * Wrapper for CUBLAS function.<br /> * <br /> * cublasStatus * cublasGetMatrix (int rows, int cols, int elemSize, const void *A, * int lda, void *B, int ldb)<br /> *<br /> * copies a tile of rows x cols elements from a matrix A in GPU memory * space to a matrix B in CPU memory space. Each element requires storage * of elemSize bytes. Both matrices are assumed to be stored in column * major format, with the leading dimension (i.e. number of rows) of * source matrix A provided in lda, and the leading dimension of matrix B * provided in ldb. In general, A points to an object, or part of an * object, that was allocated via cublasAlloc().<br /> *<br /> * Return Values<br /> * -------------<br /> * CUBLAS_STATUS_NOT_INITIALIZED if CUBLAS library has not been initialized<br /> * CUBLAS_STATUS_INVALID_VALUE if rows, cols, eleSize, lda, or ldb <= 0<br /> * CUBLAS_STATUS_MAPPING_ERROR if error occurred accessing GPU memory<br /> * CUBLAS_STATUS_SUCCESS if the operation completed successfully<br /> */ public static int cublasGetMatrix (int rows, int cols, int elemSize, Pointer A, int lda, Pointer B, int ldb) { return checkResult(cublasGetMatrixNative(rows, cols, elemSize, A, lda, B, ldb)); }
/** * Wrapper for CUBLAS function.<br /> * <br /> * cublasStatus * cublasGetMatrix (int rows, int cols, int elemSize, const void *A, * int lda, void *B, int ldb)<br /> *<br /> * copies a tile of rows x cols elements from a matrix A in GPU memory * space to a matrix B in CPU memory space. Each element requires storage * of elemSize bytes. Both matrices are assumed to be stored in column * major format, with the leading dimension (i.e. number of rows) of * source matrix A provided in lda, and the leading dimension of matrix B * provided in ldb. In general, A points to an object, or part of an * object, that was allocated via cublasAlloc().<br /> *<br /> * Return Values<br /> * -------------<br /> * CUBLAS_STATUS_NOT_INITIALIZED if CUBLAS library has not been initialized<br /> * CUBLAS_STATUS_INVALID_VALUE if rows, cols, eleSize, lda, or ldb <= 0<br /> * CUBLAS_STATUS_MAPPING_ERROR if error occurred accessing GPU memory<br /> * CUBLAS_STATUS_SUCCESS if the operation completed successfully<br /> */ public static int cublasGetMatrix (int rows, int cols, int elemSize, Pointer A, int lda, Pointer B, int ldb) { return checkResult(cublasGetMatrixNative(rows, cols, elemSize, A, lda, B, ldb)); }
/** * 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#cublasGetMatrix(int, int, int, Pointer, int, Pointer, int) */ public static int cublasGetMatrix (int rows, int cols, Pointer A, int lda, cuDoubleComplex B[], int offsetB, int ldb) { ByteBuffer byteBufferB = ByteBuffer.allocateDirect(B.length * 8 * 2); byteBufferB.order(ByteOrder.nativeOrder()); DoubleBuffer doubleBufferB = byteBufferB.asDoubleBuffer(); int status = cublasGetMatrixNative(rows, cols, 16, A, lda, Pointer.to(doubleBufferB).withByteOffset(offsetB * 8 * 2), ldb); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { doubleBufferB.rewind(); for (int c=0; c<cols; c++) { for (int r=0; r<rows; r++) { int index = c * ldb + r + offsetB; B[index].x = doubleBufferB.get(index*2+0); B[index].y = doubleBufferB.get(index*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#cublasGetMatrix(int, int, int, Pointer, int, Pointer, int) */ public static int cublasGetMatrix (int rows, int cols, Pointer A, int lda, cuComplex B[], int offsetB, int ldb) { ByteBuffer byteBufferB = ByteBuffer.allocateDirect(B.length * 4 * 2); byteBufferB.order(ByteOrder.nativeOrder()); FloatBuffer floatBufferB = byteBufferB.asFloatBuffer(); int status = cublasGetMatrixNative(rows, cols, 8, A, lda, Pointer.to(floatBufferB).withByteOffset(offsetB * 4 * 2), ldb); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { floatBufferB.rewind(); for (int c=0; c<cols; c++) { for (int r=0; r<rows; r++) { int index = c * ldb + r + offsetB; B[index].x = floatBufferB.get(index*2+0); B[index].y = floatBufferB.get(index*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#cublasGetMatrix(int, int, int, jcuda.Pointer, int, jcuda.Pointer, int) */ public static int cublasGetMatrix (int rows, int cols, Pointer A, int lda, cuDoubleComplex B[], int offsetB, int ldb) { ByteBuffer byteBufferB = ByteBuffer.allocateDirect(B.length * 8 * 2); byteBufferB.order(ByteOrder.nativeOrder()); DoubleBuffer doubleBufferB = byteBufferB.asDoubleBuffer(); int status = cublasGetMatrixNative(rows, cols, 16, A, lda, Pointer.to(doubleBufferB).withByteOffset(offsetB * 8 * 2), ldb); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { doubleBufferB.rewind(); for (int c=0; c<cols; c++) { for (int r=0; r<rows; r++) { int index = c * ldb + r + offsetB; B[index].x = doubleBufferB.get(index*2+0); B[index].y = doubleBufferB.get(index*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#cublasGetMatrix(int, int, int, Pointer, int, Pointer, int) */ public static int cublasGetMatrix (int rows, int cols, Pointer A, int lda, cuDoubleComplex B[], int offsetB, int ldb) { ByteBuffer byteBufferB = ByteBuffer.allocateDirect(B.length * 8 * 2); byteBufferB.order(ByteOrder.nativeOrder()); DoubleBuffer doubleBufferB = byteBufferB.asDoubleBuffer(); int status = cublasGetMatrixNative(rows, cols, 16, A, lda, Pointer.to(doubleBufferB).withByteOffset(offsetB * 8 * 2), ldb); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { doubleBufferB.rewind(); for (int c=0; c<cols; c++) { for (int r=0; r<rows; r++) { int index = c * ldb + r + offsetB; B[index].x = doubleBufferB.get(index*2+0); B[index].y = doubleBufferB.get(index*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#cublasGetMatrix(int, int, int, Pointer, int, Pointer, int) */ public static int cublasGetMatrix (int rows, int cols, Pointer A, int lda, cuComplex B[], int offsetB, int ldb) { ByteBuffer byteBufferB = ByteBuffer.allocateDirect(B.length * 4 * 2); byteBufferB.order(ByteOrder.nativeOrder()); FloatBuffer floatBufferB = byteBufferB.asFloatBuffer(); int status = cublasGetMatrixNative(rows, cols, 8, A, lda, Pointer.to(floatBufferB).withByteOffset(offsetB * 4 * 2), ldb); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { floatBufferB.rewind(); for (int c=0; c<cols; c++) { for (int r=0; r<rows; r++) { int index = c * ldb + r + offsetB; B[index].x = floatBufferB.get(index*2+0); B[index].y = floatBufferB.get(index*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#cublasGetMatrix(int, int, int, Pointer, int, Pointer, int) */ public static int cublasGetMatrix (int rows, int cols, Pointer A, int lda, cuComplex B[], int offsetB, int ldb) { ByteBuffer byteBufferB = ByteBuffer.allocateDirect(B.length * 4 * 2); byteBufferB.order(ByteOrder.nativeOrder()); FloatBuffer floatBufferB = byteBufferB.asFloatBuffer(); int status = cublasGetMatrixNative(rows, cols, 8, A, lda, Pointer.to(floatBufferB).withByteOffset(offsetB * 4 * 2), ldb); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { floatBufferB.rewind(); for (int c=0; c<cols; c++) { for (int r=0; r<rows; r++) { int index = c * ldb + r + offsetB; B[index].x = floatBufferB.get(index*2+0); B[index].y = floatBufferB.get(index*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#cublasGetMatrix(int, int, int, Pointer, int, Pointer, int) */ public static int cublasGetMatrix (int rows, int cols, Pointer A, int lda, cuComplex B[], int offsetB, int ldb) { ByteBuffer byteBufferB = ByteBuffer.allocateDirect(B.length * 4 * 2); byteBufferB.order(ByteOrder.nativeOrder()); FloatBuffer floatBufferB = byteBufferB.asFloatBuffer(); int status = cublasGetMatrixNative(rows, cols, 8, A, lda, Pointer.to(floatBufferB).withByteOffset(offsetB * 4 * 2), ldb); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { floatBufferB.rewind(); for (int c=0; c<cols; c++) { for (int r=0; r<rows; r++) { int index = c * ldb + r + offsetB; B[index].x = floatBufferB.get(index*2+0); B[index].y = floatBufferB.get(index*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#cublasGetMatrix(int, int, int, Pointer, int, Pointer, int) */ public static int cublasGetMatrix (int rows, int cols, Pointer A, int lda, cuDoubleComplex B[], int offsetB, int ldb) { ByteBuffer byteBufferB = ByteBuffer.allocateDirect(B.length * 8 * 2); byteBufferB.order(ByteOrder.nativeOrder()); DoubleBuffer doubleBufferB = byteBufferB.asDoubleBuffer(); int status = cublasGetMatrixNative(rows, cols, 16, A, lda, Pointer.to(doubleBufferB).withByteOffset(offsetB * 8 * 2), ldb); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { doubleBufferB.rewind(); for (int c=0; c<cols; c++) { for (int r=0; r<rows; r++) { int index = c * ldb + r + offsetB; B[index].x = doubleBufferB.get(index*2+0); B[index].y = doubleBufferB.get(index*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#cublasGetMatrix(int, int, int, Pointer, int, Pointer, int) */ public static int cublasGetMatrix (int rows, int cols, Pointer A, int lda, cuDoubleComplex B[], int offsetB, int ldb) { ByteBuffer byteBufferB = ByteBuffer.allocateDirect(B.length * 8 * 2); byteBufferB.order(ByteOrder.nativeOrder()); DoubleBuffer doubleBufferB = byteBufferB.asDoubleBuffer(); int status = cublasGetMatrixNative(rows, cols, 16, A, lda, Pointer.to(doubleBufferB).withByteOffset(offsetB * 8 * 2), ldb); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { doubleBufferB.rewind(); for (int c=0; c<cols; c++) { for (int r=0; r<rows; r++) { int index = c * ldb + r + offsetB; B[index].x = doubleBufferB.get(index*2+0); B[index].y = doubleBufferB.get(index*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#cublasGetMatrix(int, int, int, Pointer, int, Pointer, int) */ public static int cublasGetMatrix (int rows, int cols, Pointer A, int lda, cuDoubleComplex B[], int offsetB, int ldb) { ByteBuffer byteBufferB = ByteBuffer.allocateDirect(B.length * 8 * 2); byteBufferB.order(ByteOrder.nativeOrder()); DoubleBuffer doubleBufferB = byteBufferB.asDoubleBuffer(); int status = cublasGetMatrixNative(rows, cols, 16, A, lda, Pointer.to(doubleBufferB).withByteOffset(offsetB * 8 * 2), ldb); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { doubleBufferB.rewind(); for (int c=0; c<cols; c++) { for (int r=0; r<rows; r++) { int index = c * ldb + r + offsetB; B[index].x = doubleBufferB.get(index*2+0); B[index].y = doubleBufferB.get(index*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#cublasGetMatrix(int, int, int, jcuda.Pointer, int, jcuda.Pointer, int) */ public static int cublasGetMatrix (int rows, int cols, Pointer A, int lda, cuComplex B[], int offsetB, int ldb) { ByteBuffer byteBufferB = ByteBuffer.allocateDirect(B.length * 4 * 2); byteBufferB.order(ByteOrder.nativeOrder()); FloatBuffer floatBufferB = byteBufferB.asFloatBuffer(); int status = cublasGetMatrixNative(rows, cols, 8, A, lda, Pointer.to(floatBufferB).withByteOffset(offsetB * 4 * 2), ldb); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { floatBufferB.rewind(); for (int c=0; c<cols; c++) { for (int r=0; r<rows; r++) { int index = c * ldb + r + offsetB; B[index].x = floatBufferB.get(index*2+0); B[index].y = floatBufferB.get(index*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#cublasGetMatrix(int, int, int, Pointer, int, Pointer, int) */ public static int cublasGetMatrix (int rows, int cols, Pointer A, int lda, cuComplex B[], int offsetB, int ldb) { ByteBuffer byteBufferB = ByteBuffer.allocateDirect(B.length * 4 * 2); byteBufferB.order(ByteOrder.nativeOrder()); FloatBuffer floatBufferB = byteBufferB.asFloatBuffer(); int status = cublasGetMatrixNative(rows, cols, 8, A, lda, Pointer.to(floatBufferB).withByteOffset(offsetB * 4 * 2), ldb); if (status == cublasStatus.CUBLAS_STATUS_SUCCESS) { floatBufferB.rewind(); for (int c=0; c<cols; c++) { for (int r=0; r<rows; r++) { int index = c * ldb + r + offsetB; B[index].x = floatBufferB.get(index*2+0); B[index].y = floatBufferB.get(index*2+1); } } } return checkResult(status); }