Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   /*
    * JCublas - Java bindings for CUBLAS, the NVIDIA CUDA BLAS library,
    * to be used with JCuda
    *
    * Copyright (c) 2010-2012 Marco Hutter - http://www.jcuda.org
    * 
    * Permission is hereby granted, free of charge, to any person
    * obtaining a copy of this software and associated documentation
    * files (the "Software"), to deal in the Software without
   * restriction, including without limitation the rights to use,
   * copy, modify, merge, publish, distribute, sublicense, and/or sell
   * copies of the Software, and to permit persons to whom the
   * Software is furnished to do so, subject to the following
   * conditions:
   * 
   * The above copyright notice and this permission notice shall be
   * included in all copies or substantial portions of the Software.
   * 
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
   * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
   * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
   * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
   * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
   * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
   * OTHER DEALINGS IN THE SOFTWARE.
   */
  
  package jcuda.jcublas;
  
  import jcuda.*;
Java bindings for CUBLAS, the NVIDIA CUDA BLAS library.
This class contains the new CUBLAS API that was introduced with CUDA 4.0

Most comments are taken from the CUBLAS header file.
  
  public class JCublas2
  {
    
The flag that indicates whether the native library has been loaded
  
      private static boolean initialized = false;

    
Whether a CudaException should be thrown if a method is about to set a result code that is not cublasStatus.CUBLAS_STATUS_SUCCESS
  
      private static boolean exceptionsEnabled = false;
      
      /* Private constructor to prevent instantiation */
      private JCublas2()
      {
      }
  
      // Initialize the native library.
      static
      {
          initialize();
      }
    
    
Initializes the native library. Note that this method does not have to be called explicitly, since it will be called automatically when this class is loaded.
  
      public static void initialize()
      {
          if (!)
          {
              LibUtils.loadLibrary("JCublas2");
               = true;
          }
      }

    

    
Set the specified log level for the JCublas library.

Currently supported log levels:
LOG_QUIET: Never print anything
LOG_ERROR: Print error messages
LOG_TRACE: Print a trace of all native function calls

Parameters:
logLevel The log level to use.
  
      public static void setLogLevel(LogLevel logLevel)
      {
          setLogLevelNative(logLevel.ordinal());
      }
  
     private static native void setLogLevelNative(int logLevel);


    
Enables or disables exceptions. By default, the methods of this class only return the jcuda.jcublas.cublasStatus from the native method. If exceptions are enabled, a CudaException with a detailed error message will be thrown if a method is about to return a result code that is not cublasStatus.CUBLAS_STATUS_SUCCESS

Parameters:
enabled Whether exceptions are enabled
 
     public static void setExceptionsEnabled(boolean enabled)
     {
          = enabled;
     }
    
    
If the given result is different to cublasStatus.CUBLAS_STATUS_SUCCESS and exceptions have been enabled, this method will throw a CudaException with an error message that corresponds to the given result code. Otherwise, the given result is simply returned.

Parameters:
result The result to check
Returns:
The result that was given as the parameter
Throws:
jcuda.CudaException If exceptions have been enabled and the given result code is not cublasStatus.CUBLAS_STATUS_SUCCESS
 
     private static int checkResult(int result)
     {
         if ( && result != .)
         {
             throw new CudaException(cublasStatus.stringFor(result));
         }
         return result;
     }
     
     //=== Auto-generated part ================================================
     
     public static int cublasCreate(
         cublasHandle handle)
     {
         return checkResult(cublasCreateNative(handle));
     }
     private static native int cublasCreateNative(
         cublasHandle handle);
 
 
     public static int cublasDestroy(
         cublasHandle handle)
     {
         return checkResult(cublasDestroyNative(handle));
     }
     private static native int cublasDestroyNative(
         cublasHandle handle);
 
 
     public static int cublasGetVersion(
         cublasHandle handle
         int[] version)
     {
         return checkResult(cublasGetVersionNative(handleversion));
     }
     private static native int cublasGetVersionNative(
         cublasHandle handle
         int[] version);
 
 
     public static int cublasSetStream(
         cublasHandle handle
         cudaStream_t streamId)
     {
         return checkResult(cublasSetStreamNative(handlestreamId));
     }
     private static native int cublasSetStreamNative(
         cublasHandle handle
         cudaStream_t streamId);
 
 
     public static int cublasGetStream(
         cublasHandle handle
         cudaStream_t streamId)
     {
         return checkResult(cublasGetStreamNative(handlestreamId));
     }
     private static native int cublasGetStreamNative(
         cublasHandle handle
         cudaStream_t streamId);
 
 
     public static int cublasGetPointerMode(
         cublasHandle handle
         int[] mode)
     {
         return checkResult(cublasGetPointerModeNative(handlemode));
     }
     private static native int cublasGetPointerModeNative(
         cublasHandle handle
         int[] mode);
 
 
     public static int cublasSetPointerMode(
         cublasHandle handle
         int mode)
     {
         return checkResult(cublasSetPointerModeNative(handlemode));
     }
     private static native int cublasSetPointerModeNative(
         cublasHandle handle
         int mode);
 
 
     public static int cublasGetAtomicsMode(
         cublasHandle handle
         int[] mode)
     {
         return checkResult(cublasGetAtomicsModeNative(handlemode));
     }
     private static native int cublasGetAtomicsModeNative(
         cublasHandle handle
         int[] mode);
 
 
     public static int cublasSetAtomicsMode(
         cublasHandle handle
         int mode)
     {
         return checkResult(cublasSetAtomicsModeNative(handlemode));
     }
     private static native int cublasSetAtomicsModeNative(
         cublasHandle handle
         int mode);


    
 cublasStatus_t 
 cublasSetVector (int n, int elemSize, const void *x, int incx, 
                  void *y, int incy) 

 copies n elements from a vector x in CPU memory space to a vector y 
 in GPU 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, y 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.

 Return Values
 -------------
 CUBLAS_STATUS_NOT_INITIALIZED  if CUBLAS library not been initialized
 CUBLAS_STATUS_INVALID_VALUE    if incx, incy, or elemSize <= 0
 CUBLAS_STATUS_MAPPING_ERROR    if an error occurred accessing GPU memory   
 CUBLAS_STATUS_SUCCESS          if the operation completed successfully
 
 
     public static int cublasSetVector(
         int n
         int elemSize
         Pointer x
         int incx
         Pointer devicePtr
         int incy)
     {
         return checkResult(cublasSetVectorNative(nelemSizexincxdevicePtrincy));
     }
     private static native int cublasSetVectorNative(
         int n
         int elemSize
         Pointer x
         int incx
         Pointer devicePtr
         int incy);


    
 cublasStatus_t 
 cublasGetVector (int n, int elemSize, const void *x, int incx, 
                  void *y, int incy)
 
 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.

 Return Values
 -------------
 CUBLAS_STATUS_NOT_INITIALIZED  if CUBLAS library not been initialized
 CUBLAS_STATUS_INVALID_VALUE    if incx, incy, or elemSize <= 0
 CUBLAS_STATUS_MAPPING_ERROR    if an error occurred accessing GPU memory   
 CUBLAS_STATUS_SUCCESS          if the operation completed successfully
 
 
     public static int cublasGetVector(
         int n
         int elemSize
         Pointer x
         int incx
         Pointer y
         int incy)
     {
         return checkResult(cublasGetVectorNative(nelemSizexincxyincy));
     }
     private static native int cublasGetVectorNative(
         int n
         int elemSize
         Pointer x
         int incx
         Pointer y
         int incy);


    
 cublasStatus_t 
 cublasSetMatrix (int rows, int cols, int elemSize, const void *A, 
                  int lda, void *B, int ldb)

 copies a tile of rows x cols elements from a matrix A in CPU memory
 space to a matrix B in GPU 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, B points to an object, or part of an 
 object, that was allocated via cublasAlloc().

 Return Values 
 -------------
 CUBLAS_STATUS_NOT_INITIALIZED  if CUBLAS library has not been initialized
 CUBLAS_STATUS_INVALID_VALUE    if rows or cols < 0, or elemSize, lda, or 
                                ldb <= 0
 CUBLAS_STATUS_MAPPING_ERROR    if error occurred accessing GPU memory
 CUBLAS_STATUS_SUCCESS          if the operation completed successfully
 
 
     public static int cublasSetMatrix(
         int rows
         int cols
         int elemSize
         Pointer A
         int lda
         Pointer B
         int ldb)
     {
         return checkResult(cublasSetMatrixNative(rowscolselemSizeAldaBldb));
     }
     private static native int cublasSetMatrixNative(
         int rows
         int cols
         int elemSize
         Pointer A
         int lda
         Pointer B
         int ldb);


    
 cublasStatus_t 
 cublasGetMatrix (int rows, int cols, int elemSize, const void *A, 
                  int lda, void *B, int ldb)

 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().

 Return Values 
 -------------
 CUBLAS_STATUS_NOT_INITIALIZED  if CUBLAS library has not been initialized
 CUBLAS_STATUS_INVALID_VALUE    if rows, cols, eleSize, lda, or ldb <= 0
 CUBLAS_STATUS_MAPPING_ERROR    if error occurred accessing GPU memory
 CUBLAS_STATUS_SUCCESS          if the operation completed successfully
 
 
     public static int cublasGetMatrix(
         int rows
         int cols
         int elemSize
         Pointer A
         int lda
         Pointer B
         int ldb)
     {
         return checkResult(cublasGetMatrixNative(rowscolselemSizeAldaBldb));
     }
     private static native int cublasGetMatrixNative(
         int rows
         int cols
         int elemSize
         Pointer A
         int lda
         Pointer B
         int ldb);


    
 cublasStatus 
 cublasSetVectorAsync ( int n, int elemSize, const void *x, int incx, 
                       void *y, int incy, cudaStream_t stream );

 cublasSetVectorAsync has the same functionnality as cublasSetVector
 but the transfer is done asynchronously within the CUDA stream passed
 in parameter.

 Return Values
 -------------
 CUBLAS_STATUS_NOT_INITIALIZED  if CUBLAS library not been initialized
 CUBLAS_STATUS_INVALID_VALUE    if incx, incy, or elemSize <= 0
 CUBLAS_STATUS_MAPPING_ERROR    if an error occurred accessing GPU memory   
 CUBLAS_STATUS_SUCCESS          if the operation completed successfully
 
 
     public static int cublasSetVectorAsync(
         int n
         int elemSize
         Pointer hostPtr
         int incx
         Pointer devicePtr
         int incy
         cudaStream_t stream)
     {
         return checkResult(cublasSetVectorAsyncNative(nelemSizehostPtrincxdevicePtrincystream));
     }
     private static native int cublasSetVectorAsyncNative(
         int n
         int elemSize
         Pointer hostPtr
         int incx
         Pointer devicePtr
         int incy
         cudaStream_t stream);


    
 cublasStatus 
 cublasGetVectorAsync( int n, int elemSize, const void *x, int incx, 
                       void *y, int incy, cudaStream_t stream)
 
 cublasGetVectorAsync has the same functionnality as cublasGetVector
 but the transfer is done asynchronously within the CUDA stream passed
 in parameter.

 Return Values
 -------------
 CUBLAS_STATUS_NOT_INITIALIZED  if CUBLAS library not been initialized
 CUBLAS_STATUS_INVALID_VALUE    if incx, incy, or elemSize <= 0
 CUBLAS_STATUS_MAPPING_ERROR    if an error occurred accessing GPU memory   
 CUBLAS_STATUS_SUCCESS          if the operation completed successfully
 
 
     public static int cublasGetVectorAsync(
         int n
         int elemSize
         Pointer devicePtr
         int incx
         Pointer hostPtr
         int incy
         cudaStream_t stream)
     {
         return checkResult(cublasGetVectorAsyncNative(nelemSizedevicePtrincxhostPtrincystream));
     }
     private static native int cublasGetVectorAsyncNative(
         int n
         int elemSize
         Pointer devicePtr
         int incx
         Pointer hostPtr
         int incy
         cudaStream_t stream);


    
 cublasStatus_t 
 cublasSetMatrixAsync (int rows, int cols, int elemSize, const void *A, 
                       int lda, void *B, int ldb, cudaStream_t stream)

 cublasSetMatrixAsync has the same functionnality as cublasSetMatrix
 but the transfer is done asynchronously within the CUDA stream passed
 in parameter.

 Return Values 
 -------------
 CUBLAS_STATUS_NOT_INITIALIZED  if CUBLAS library has not been initialized
 CUBLAS_STATUS_INVALID_VALUE    if rows or cols < 0, or elemSize, lda, or 
                                ldb <= 0
 CUBLAS_STATUS_MAPPING_ERROR    if error occurred accessing GPU memory
 CUBLAS_STATUS_SUCCESS          if the operation completed successfully
 
 
     public static int cublasSetMatrixAsync(
         int rows
         int cols
         int elemSize
         Pointer A
         int lda
         Pointer B
         int ldb
         cudaStream_t stream)
     {
         return checkResult(cublasSetMatrixAsyncNative(rowscolselemSizeAldaBldbstream));
     }
     private static native int cublasSetMatrixAsyncNative(
         int rows
         int cols
         int elemSize
         Pointer A
         int lda
         Pointer B
         int ldb
         cudaStream_t stream);


    
 cublasStatus_t 
 cublasGetMatrixAsync (int rows, int cols, int elemSize, const void *A, 
                       int lda, void *B, int ldb, cudaStream_t stream)

 cublasGetMatrixAsync has the same functionnality as cublasGetMatrix
 but the transfer is done asynchronously within the CUDA stream passed
 in parameter.

 Return Values 
 -------------
 CUBLAS_STATUS_NOT_INITIALIZED  if CUBLAS library has not been initialized
 CUBLAS_STATUS_INVALID_VALUE    if rows, cols, eleSize, lda, or ldb <= 0
 CUBLAS_STATUS_MAPPING_ERROR    if error occurred accessing GPU memory
 CUBLAS_STATUS_SUCCESS          if the operation completed successfully
 
 
     public static int cublasGetMatrixAsync(
         int rows
         int cols
         int elemSize
         Pointer A
         int lda
         Pointer B
         int ldb
         cudaStream_t stream)
     {
         return checkResult(cublasGetMatrixAsyncNative(rowscolselemSizeAldaBldbstream));
     }
     private static native int cublasGetMatrixAsyncNative(
         int rows
         int cols
         int elemSize
         Pointer A
         int lda
         Pointer B
         int ldb
         cudaStream_t stream);
 
 
     public static int cublasSnrm2(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer result)
host or device pointer
 
     {
         return checkResult(cublasSnrm2Native(handlenxincxresult));
     }
     private static native int cublasSnrm2Native(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer result);
host or device pointer
 
 
 
     public static int cublasDnrm2(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer result)
host or device pointer
 
     {
         return checkResult(cublasDnrm2Native(handlenxincxresult));
     }
     private static native int cublasDnrm2Native(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer result);
host or device pointer
 
 
 
     public static int cublasScnrm2(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer result)
host or device pointer
 
     {
         return checkResult(cublasScnrm2Native(handlenxincxresult));
     }
     private static native int cublasScnrm2Native(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer result);
host or device pointer
 
 
 
     public static int cublasDznrm2(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer result)
host or device pointer
 
     {
         return checkResult(cublasDznrm2Native(handlenxincxresult));
     }
     private static native int cublasDznrm2Native(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer result);
host or device pointer
 
 
 
     public static int cublasSdot(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy
         Pointer result)
host or device pointer
 
     {
         return checkResult(cublasSdotNative(handlenxincxyincyresult));
     }
     private static native int cublasSdotNative(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy
         Pointer result);
host or device pointer
 
 
 
     public static int cublasDdot(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy
         Pointer result)
host or device pointer
 
     {
         return checkResult(cublasDdotNative(handlenxincxyincyresult));
     }
     private static native int cublasDdotNative(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy
         Pointer result);
host or device pointer
 
 
 
     public static int cublasCdotu(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy
         Pointer result)
host or device pointer
 
     {
         return checkResult(cublasCdotuNative(handlenxincxyincyresult));
     }
     private static native int cublasCdotuNative(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy
         Pointer result);
host or device pointer
 
 
 
     public static int cublasCdotc(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy
         Pointer result)
host or device pointer
 
     {
         return checkResult(cublasCdotcNative(handlenxincxyincyresult));
     }
     private static native int cublasCdotcNative(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy
         Pointer result);
host or device pointer
 
 
 
     public static int cublasZdotu(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy
         Pointer result)
host or device pointer
 
     {
         return checkResult(cublasZdotuNative(handlenxincxyincyresult));
     }
     private static native int cublasZdotuNative(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy
         Pointer result);
host or device pointer
 
 
 
     public static int cublasZdotc(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy
         Pointer result)
host or device pointer
 
     {
         return checkResult(cublasZdotcNative(handlenxincxyincyresult));
     }
     private static native int cublasZdotcNative(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy
         Pointer result);
host or device pointer
 
 
 
     public static int cublasSscal(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx)
     {
         return checkResult(cublasSscalNative(handlenalphaxincx));
     }
     private static native int cublasSscalNative(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx);
 
 
     public static int cublasDscal(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx)
     {
         return checkResult(cublasDscalNative(handlenalphaxincx));
     }
     private static native int cublasDscalNative(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx);
 
 
     public static int cublasCscal(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx)
     {
         return checkResult(cublasCscalNative(handlenalphaxincx));
     }
     private static native int cublasCscalNative(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx);
 
 
     public static int cublasCsscal(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx)
     {
         return checkResult(cublasCsscalNative(handlenalphaxincx));
     }
     private static native int cublasCsscalNative(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx);
 
 
     public static int cublasZscal(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx)
     {
         return checkResult(cublasZscalNative(handlenalphaxincx));
     }
     private static native int cublasZscalNative(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx);
 
 
     public static int cublasZdscal(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx)
     {
         return checkResult(cublasZdscalNative(handlenalphaxincx));
     }
     private static native int cublasZdscalNative(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx);
 
 
     public static int cublasSaxpy(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx
         Pointer y
         int incy)
     {
         return checkResult(cublasSaxpyNative(handlenalphaxincxyincy));
     }
     private static native int cublasSaxpyNative(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx
         Pointer y
         int incy);
 
 
     public static int cublasDaxpy(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx
         Pointer y
         int incy)
     {
         return checkResult(cublasDaxpyNative(handlenalphaxincxyincy));
     }
     private static native int cublasDaxpyNative(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx
         Pointer y
         int incy);
 
 
     public static int cublasCaxpy(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx
         Pointer y
         int incy)
     {
         return checkResult(cublasCaxpyNative(handlenalphaxincxyincy));
     }
     private static native int cublasCaxpyNative(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx
         Pointer y
         int incy);
 
 
     public static int cublasZaxpy(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx
         Pointer y
         int incy)
     {
         return checkResult(cublasZaxpyNative(handlenalphaxincxyincy));
     }
     private static native int cublasZaxpyNative(
         cublasHandle handle
         int n
         Pointer alpha
host or device pointer
 
         Pointer x
         int incx
         Pointer y
         int incy);
 
 
     public static int cublasScopy(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy)
     {
         return checkResult(cublasScopyNative(handlenxincxyincy));
     }
     private static native int cublasScopyNative(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy);
 
 
     public static int cublasDcopy(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy)
     {
         return checkResult(cublasDcopyNative(handlenxincxyincy));
     }
     private static native int cublasDcopyNative(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy);
 
 
     public static int cublasCcopy(
         cublasHandle handle
         int n
         Pointer x
         int incx
         Pointer y
         int incy)
     {
         return checkResult(cublasCcopyNative(handlenxincxyincy));
     }
     private static native int cublasCcopyNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer y
        int incy);
    public static int cublasZcopy(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer y
        int incy)
    {
        return checkResult(cublasZcopyNative(handlenxincxyincy));
    }
    private static native int cublasZcopyNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer y
        int incy);
    public static int cublasSswap(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer y
        int incy)
    {
        return checkResult(cublasSswapNative(handlenxincxyincy));
    }
    private static native int cublasSswapNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer y
        int incy);
    public static int cublasDswap(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer y
        int incy)
    {
        return checkResult(cublasDswapNative(handlenxincxyincy));
    }
    private static native int cublasDswapNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer y
        int incy);
    public static int cublasCswap(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer y
        int incy)
    {
        return checkResult(cublasCswapNative(handlenxincxyincy));
    }
    private static native int cublasCswapNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer y
        int incy);
    public static int cublasZswap(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer y
        int incy)
    {
        return checkResult(cublasZswapNative(handlenxincxyincy));
    }
    private static native int cublasZswapNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer y
        int incy);
    public static int cublasIsamax(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result)
host or device pointer
    {
        return checkResult(cublasIsamaxNative(handlenxincxresult));
    }
    private static native int cublasIsamaxNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result);
host or device pointer
    public static int cublasIdamax(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result)
host or device pointer
    {
        return checkResult(cublasIdamaxNative(handlenxincxresult));
    }
    private static native int cublasIdamaxNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result);
host or device pointer
    public static int cublasIcamax(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result)
host or device pointer
    {
        return checkResult(cublasIcamaxNative(handlenxincxresult));
    }
    private static native int cublasIcamaxNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result);
host or device pointer
    public static int cublasIzamax(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result)
host or device pointer
    {
        return checkResult(cublasIzamaxNative(handlenxincxresult));
    }
    private static native int cublasIzamaxNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result);
host or device pointer
    public static int cublasIsamin(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result)
host or device pointer
    {
        return checkResult(cublasIsaminNative(handlenxincxresult));
    }
    private static native int cublasIsaminNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result);
host or device pointer
    public static int cublasIdamin(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result)
host or device pointer
    {
        return checkResult(cublasIdaminNative(handlenxincxresult));
    }
    private static native int cublasIdaminNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result);
host or device pointer
    public static int cublasIcamin(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result)
host or device pointer
    {
        return checkResult(cublasIcaminNative(handlenxincxresult));
    }
    private static native int cublasIcaminNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result);
host or device pointer
    public static int cublasIzamin(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result)
host or device pointer
    {
        return checkResult(cublasIzaminNative(handlenxincxresult));
    }
    private static native int cublasIzaminNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result);
host or device pointer
    public static int cublasSasum(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result)
host or device pointer
    {
        return checkResult(cublasSasumNative(handlenxincxresult));
    }
    private static native int cublasSasumNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result);
host or device pointer
    public static int cublasDasum(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result)
host or device pointer
    {
        return checkResult(cublasDasumNative(handlenxincxresult));
    }
    private static native int cublasDasumNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result);
host or device pointer
    public static int cublasScasum(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result)
host or device pointer
    {
        return checkResult(cublasScasumNative(handlenxincxresult));
    }
    private static native int cublasScasumNative(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result);
host or device pointer
    public static int cublasDzasum(
        cublasHandle handle
        int n
        Pointer x
        int incx
        Pointer result)
host or device pointer
    {
        return checkResult(cublasDzasumNative(handlenxincxresult));
    }
    private static native int cublasDzasumNative(