Beispiel #1
0
        public void SetVector <T>(T[] data, int incx, CUdeviceptr ptr, int incy)
        {
            GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);

            this.LastError = CUBLASDriver.cublasSetVector(data.Length, CUDA.MSizeOf(typeof(T)), handle.AddrOfPinnedObject(), incx, ptr, incy);
            handle.Free();
        }
Beispiel #2
0
        //public void Create()
        //{
        //    this.LastError = CUBLASDriver.cublasCreate_v2();
        //}

        public void SetMatrix <T>(int rows, int cols, T[] data, int lda, CUdeviceptr ptr, int ldb)
        {
            GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);

            this.LastError = CUBLASDriver.cublasSetMatrix(rows, cols, CUDA.MSizeOf(typeof(T)), handle.AddrOfPinnedObject(), lda, ptr, ldb);
            handle.Free();
        }
Beispiel #3
0
        public CUdeviceptr Allocate(int numOfElements, int elementSize)
        {
            CUdeviceptr devicePtr = new CUdeviceptr();

            this.LastError = CUBLASDriver.cublasAlloc(numOfElements, elementSize, ref devicePtr);
            return(devicePtr);
        }
Beispiel #4
0
        public CUdeviceptr Allocate <T>(T[] array)
        {
            CUdeviceptr devicePtr = new CUdeviceptr();

            this.LastError = CUBLASDriver.cublasAlloc(array.Length, CUDA.MSizeOf(typeof(T)), ref devicePtr);
            return(devicePtr);
        }
Beispiel #5
0
 public void Shutdown()
 {
     this.LastError = CUBLASDriver.cublasShutdown();
 }
Beispiel #6
0
 public void Init()
 {
     this.LastError = CUBLASDriver.cublasInit();
 }
Beispiel #7
0
        //public void Free(CUdeviceptr ptr)
        //{
        //    this.LastError = CUBLASDriver.cublasFree(ptr);
        //}

        public CUBLASStatus GetError()
        {
            this.LastError = CUBLASDriver.cublasGetError();
            return(this.LastError);
        }