示例#1
0
        /// <summary>
        ///
        /// </summary>
        public void CsrGet(out CudaDeviceVariable <indexT> csrRowOffsets,
                           out CudaDeviceVariable <indexT> csrColInd,
                           out CudaDeviceVariable <dataT> csrValues)
        {
            CUdeviceptr ptrRowOffsets   = new CUdeviceptr();
            CUdeviceptr ptrColIdx       = new CUdeviceptr();
            CUdeviceptr ptrValues       = new CUdeviceptr();
            IndexType   indexTypeOffset = IndexType.Index32I;

            res = CudaSparseNativeMethods.cusparseCsrGet(descr, ref rows, ref cols, ref nnz, ref ptrRowOffsets,
                                                         ref ptrColIdx, ref ptrValues, ref indexTypeOffset, ref typeIndices, ref idxBase, ref typeData);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCsrGet", res));

            if (res != cusparseStatus.Success)
            {
                throw new CudaSparseException(res);
            }

            csrRowOffsets = new CudaDeviceVariable <indexT>(ptrRowOffsets);
            csrColInd     = new CudaDeviceVariable <indexT>(ptrColIdx);
            csrValues     = new CudaDeviceVariable <dataT>(ptrValues);
        }