/// <summary>
		/// </summary>
		public CudaSparseSolveAnalysisInfo()
		{
			_info = new cusparseSolveAnalysisInfo();
			res = CudaSparseNativeMethods.cusparseCreateSolveAnalysisInfo(ref _info);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCreateSolveAnalysisInfo", res));
			if (res != cusparseStatus.Success)
				throw new CudaSparseException(res);
		}
        /// <summary>
        /// When the matrix descriptor is created, its fields are initialized to: 
		/// CUSPARSE_MATRIXYPE_GENERAL
		/// CUSPARSE_INDEX_BASE_ZERO
		/// All other fields are uninitialized
        /// </summary>
        public CudaSparseMatrixDescriptor()
        {
            _descr = new cusparseMatDescr();
            res = CudaSparseNativeMethods.cusparseCreateMatDescr(ref _descr);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCreateMatDescr", res));
            if (res != cusparseStatus.Success)
                throw new CudaSparseException(res);
        }
		/// <summary>
		/// </summary>
		public CudaSparseHybMat()
		{
			_hyb = new cusparseHybMat();
			res = CudaSparseNativeMethods.cusparseCreateHybMat(ref _hyb);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCreateHybMat", res));
			if (res != cusparseStatus.Success)
				throw new CudaSparseException(res);
		}
 /// <summary>
 /// SetColorAlgs
 /// </summary>
 public void SetColorAlgs(cusparseColorAlg alg)
 {
     res = CudaSparseNativeMethods.cusparseSetColorAlgs(_info, alg);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseSetColorAlgs", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
Beispiel #5
0
 public void SetAttribute(cusparseDiagType diagType)
 {
     res = CudaSparseNativeMethods.cusparseSpMatSetAttribute(descr, cusparseSpMatAttribute.DiagType, ref diagType, sizeof(cusparseDiagType));
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseSpMatSetAttribute", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
Beispiel #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="data"></param>
 public void SetValues(CudaDeviceVariable <dataT> data)
 {
     res = CudaSparseNativeMethods.cusparseDnVecSetValues(descr, data.DevicePointer);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseDnVecSetValues", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
 /// <summary>
 /// Sets matrix index base
 /// </summary>
 /// <param name="indexBase"></param>
 public void SetMatIndexBase(IndexBase indexBase)
 {
     res = CudaSparseNativeMethods.cusparseSetMatIndexBase(_descr, indexBase);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseSetMatIndexBase", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
Beispiel #8
0
 /// <summary>
 ///
 /// </summary>
 public void SetStridedBatch(int batchCount)
 {
     res = CudaSparseNativeMethods.cusparseSpMatSetStridedBatch(descr, batchCount);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseSpMatSetStridedBatch", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
Beispiel #9
0
 /// <summary>
 ///
 /// </summary>
 public void GetSize()
 {
     res = CudaSparseNativeMethods.cusparseSpMatGetSize(descr, ref rows, ref cols, ref nnz);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseSpMatGetSize", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
 /// <summary>
 /// When the matrix descriptor is created, its fields are initialized to:
 /// CUSPARSE_MATRIXYPE_GENERAL
 /// CUSPARSE_INDEX_BASE_ZERO
 /// All other fields are uninitialized
 /// </summary>
 public CudaSparseMatrixDescriptor()
 {
     _descr = new cusparseMatDescr();
     res    = CudaSparseNativeMethods.cusparseCreateMatDescr(ref _descr);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCreateMatDescr", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
Beispiel #11
0
 /// <summary>
 /// </summary>
 public SpGEMMDescr()
 {
     descr = new cusparseSpGEMMDescr();
     res   = CudaSparseNativeMethods.cusparseSpGEMM_createDescr(ref descr);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseSpGEMM_createDescr", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
Beispiel #12
0
 /// <summary>
 ///
 /// </summary>
 public void SetStridedBatchCsr(int batchCount,
                                long offsetsBatchStride, long columnsValuesBatchStride)
 {
     res = CudaSparseNativeMethods.cusparseCsrSetStridedBatch(descr, batchCount, offsetsBatchStride, columnsValuesBatchStride);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCsrSetStridedBatch", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
Beispiel #13
0
 public void GetAttribute(out cusparseFillMode fillMode)
 {
     fillMode = cusparseFillMode.Lower;
     res      = CudaSparseNativeMethods.cusparseSpMatGetAttribute(descr, cusparseSpMatAttribute.FillMode, ref fillMode, sizeof(cusparseFillMode));
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseSpMatGetAttribute", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
Beispiel #14
0
 /// <summary>
 /// </summary>
 public CudaSparseCsrsm2Info()
 {
     _info = new csrsm2Info();
     res   = CudaSparseNativeMethods.cusparseCreateCsrsm2Info(ref _info);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCreateCsrsm2Info", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
 /// <summary>
 /// </summary>
 public CudaSparseHybMat()
 {
     _hyb = new cusparseHybMat();
     res  = CudaSparseNativeMethods.cusparseCreateHybMat(ref _hyb);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCreateHybMat", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
		/// <summary>
		/// For IDisposable
		/// </summary>
		/// <param name="fDisposing"></param>
		protected virtual void Dispose(bool fDisposing)
		{
			if (fDisposing && !disposed)
			{
				//Ignore if failing
				res = CudaSparseNativeMethods.cusparseDestroySolveAnalysisInfo(_info);
				Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseDestroySolveAnalysisInfo", res));
				disposed = true;
			}
			if (!fDisposing && !disposed)
				Debug.WriteLine(String.Format("ManagedCUDA not-disposed warning: {0}", this.GetType()));
		}
Beispiel #17
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public CudaDeviceVariable <dataT> GetValues()
        {
            CUdeviceptr devPtr = new CUdeviceptr();

            res = CudaSparseNativeMethods.cusparseDnVecGetValues(descr, ref devPtr);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseDnVecGetValues", res));
            if (res != cusparseStatus.Success)
            {
                throw new CudaSparseException(res);
            }
            return(new CudaDeviceVariable <dataT>(devPtr));
        }
Beispiel #18
0
 /// <summary>
 /// </summary>
 public DenseVector(long aSize, CudaDeviceVariable <dataT> values)
 {
     size     = aSize;
     descr    = new cusparseDnVecDescr();
     typeData = CudaDataTypeTranslator.GetType(typeof(dataT));
     res      = CudaSparseNativeMethods.cusparseCreateDnVec(ref descr, size, values.DevicePointer, typeData);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCreateDnVec", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
        /// <summary>
        /// Creates a new CudaSparseMatrixDescriptor
        /// </summary>
        public CudaSparseMatrixDescriptor(cusparseMatrixType matrixType, cusparseFillMode fillMode, cusparseDiagType diagType, cusparseIndexBase indexBase)
        {
            _descr = new cusparseMatDescr();
            res = CudaSparseNativeMethods.cusparseCreateMatDescr(ref _descr);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCreateMatDescr", res));
            if (res != cusparseStatus.Success)
				throw new CudaSparseException(res);
			SetMatType(matrixType);
			SetMatFillMode(fillMode);
			SetMatDiagType(diagType);
			SetMatIndexBase(indexBase);
        }
        /// <summary>
        /// GetColorAlgs
        /// </summary>
        public cusparseColorAlg GetColorAlgs()
        {
            cusparseColorAlg retVal = new cusparseColorAlg();

            res = CudaSparseNativeMethods.cusparseGetColorAlgs(_info, ref retVal);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseGetColorAlgs", res));
            if (res != cusparseStatus.Success)
            {
                throw new CudaSparseException(res);
            }
            return(retVal);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public CudaSparseMatrixDescriptor Copy()
        {
            CudaSparseMatrixDescriptor retVal = new CudaSparseMatrixDescriptor();

            res = CudaSparseNativeMethods.cusparseCopyMatDescr(retVal.Descriptor, _descr);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCopyMatDescr", res));
            if (res != cusparseStatus.Success)
            {
                throw new CudaSparseException(res);
            }
            return(retVal);
        }
Beispiel #22
0
        /// <summary>
        ///
        /// </summary>
        public CudaDeviceVariable <dataT> Get()
        {
            CUdeviceptr ptrValues = new CUdeviceptr();

            res = CudaSparseNativeMethods.cusparseDnMatGet(descr, ref rows, ref cols, ref ld, ref ptrValues, ref typeData, ref order);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseDnMatGet", res));
            if (res != cusparseStatus.Success)
            {
                throw new CudaSparseException(res);
            }

            return(new CudaDeviceVariable <dataT>(ptrValues));
        }
Beispiel #23
0
        /// <summary>
        ///
        /// </summary>
        public void CooSet(CudaDeviceVariable <indexT> cooRows,
                           CudaDeviceVariable <indexT> cooColumns,
                           CudaDeviceVariable <dataT> cooValues)
        {
            res = CudaSparseNativeMethods.cusparseCooSetPointers(descr, cooRows.DevicePointer,
                                                                 cooColumns.DevicePointer, cooValues.DevicePointer);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCooSetPointers", res));

            if (res != cusparseStatus.Success)
            {
                throw new CudaSparseException(res);
            }
        }
Beispiel #24
0
 /// <summary>
 /// For IDisposable
 /// </summary>
 /// <param name="fDisposing"></param>
 protected virtual void Dispose(bool fDisposing)
 {
     if (fDisposing && !disposed)
     {
         //Ignore if failing
         res = CudaSparseNativeMethods.cusparseDestroyCsrsm2Info(_info);
         Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseDestroyCsrsm2Info", res));
         disposed = true;
     }
     if (!fDisposing && !disposed)
     {
         Debug.WriteLine(String.Format("ManagedCUDA not-disposed warning: {0}", this.GetType()));
     }
 }
 /// <summary>
 /// Creates a new CudaSparseMatrixDescriptor
 /// </summary>
 public CudaSparseMatrixDescriptor(cusparseMatrixType matrixType, cusparseFillMode fillMode, cusparseDiagType diagType, IndexBase indexBase)
 {
     _descr = new cusparseMatDescr();
     res    = CudaSparseNativeMethods.cusparseCreateMatDescr(ref _descr);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCreateMatDescr", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
     SetMatType(matrixType);
     SetMatFillMode(fillMode);
     SetMatDiagType(diagType);
     SetMatIndexBase(indexBase);
 }
Beispiel #26
0
        /// <summary>
        ///
        /// </summary>
        public void Get(out CudaDeviceVariable <indexT> indices, out CudaDeviceVariable <dataT> values)
        {
            CUdeviceptr ptrIndices = new CUdeviceptr();
            CUdeviceptr ptrValues  = new CUdeviceptr();

            res = CudaSparseNativeMethods.cusparseSpVecGet(descr, ref size, ref nnz, ref ptrIndices, ref ptrValues, ref typeIndices, ref idxBase, ref typeData);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseSpVecGet", res));
            if (res != cusparseStatus.Success)
            {
                throw new CudaSparseException(res);
            }

            indices = new CudaDeviceVariable <indexT>(ptrIndices);
            values  = new CudaDeviceVariable <dataT>(ptrValues);
        }
Beispiel #27
0
 /// <summary>
 /// </summary>
 public SparseVector(long aSize, long aNnz, CudaDeviceVariable <indexT> indices, CudaDeviceVariable <dataT> values, IndexBase aIdxBase)
 {
     size        = aSize;
     nnz         = aNnz;
     idxBase     = aIdxBase;
     descr       = new cusparseSpVecDescr();
     typeIndices = IndexTypeTranslator.GetType(typeof(indexT));
     typeData    = CudaDataTypeTranslator.GetType(typeof(dataT));
     res         = CudaSparseNativeMethods.cusparseCreateSpVec(ref descr, size, nnz, indices.DevicePointer, values.DevicePointer, typeIndices, idxBase, typeData);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCreateSpVec", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
Beispiel #28
0
 /// <summary>
 /// </summary>
 public DenseMatrix(long aRows, long aCols, long aLd, Order aOrder, CudaDeviceVariable <dataT> values)
 {
     rows     = aRows;
     cols     = aCols;
     ld       = aLd;
     order    = aOrder;
     descr    = new cusparseDnMatDescr();
     typeData = CudaDataTypeTranslator.GetType(typeof(dataT));
     res      = CudaSparseNativeMethods.cusparseCreateDnMat(ref descr, rows, cols, ld, values.DevicePointer, typeData, order);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCreateDnMat", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
Beispiel #29
0
 /// <summary>
 /// </summary>
 private SparseMatrix(cusparseSpMatDescr aDescr, long aRows, long aCols, long aNnz, IndexBase aIdxBase, IndexType aTypeIndices, cudaDataType aTypeData)
 {
     rows        = aRows;
     cols        = aCols;
     nnz         = aNnz;
     idxBase     = aIdxBase;
     descr       = aDescr;
     typeIndices = aTypeIndices;
     typeData    = aTypeData;
     format      = Format.COO;
     res         = CudaSparseNativeMethods.cusparseSpMatGetFormat(descr, ref format);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseSpMatGetFormat", res));
     if (res != cusparseStatus.Success)
     {
         throw new CudaSparseException(res);
     }
 }
Beispiel #30
0
        public void CooAoSGet(out CudaDeviceVariable <indexT> cooInd,
                              out CudaDeviceVariable <dataT> cooValues)
        {
            CUdeviceptr ptrIdx    = new CUdeviceptr();
            CUdeviceptr ptrValues = new CUdeviceptr();

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

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

            cooInd    = new CudaDeviceVariable <indexT>(ptrIdx);
            cooValues = new CudaDeviceVariable <dataT>(ptrValues);
        }
Beispiel #31
0
        /// <summary>
        ///
        /// </summary>
        public void BlockedEllGet(out CudaDeviceVariable <indexT> ellColInd,
                                  out CudaDeviceVariable <dataT> ellValue, out long ellBlockSize, out long ellCols)
        {
            ellBlockSize = 0;
            ellCols      = 0;
            CUdeviceptr ptrIdx    = new CUdeviceptr();
            CUdeviceptr ptrValues = new CUdeviceptr();

            res = CudaSparseNativeMethods.cusparseBlockedEllGet(descr, ref rows, ref cols, ref ellBlockSize, ref ellCols, ref ptrIdx, ref ptrValues, ref typeIndices, ref idxBase, ref typeData);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseBlockedEllGet", res));

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

            ellColInd = new CudaDeviceVariable <indexT>(ptrIdx);
            ellValue  = new CudaDeviceVariable <dataT>(ptrValues);
        }
Beispiel #32
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);
        }
Beispiel #33
0
        public static SparseMatrix <indexT1, dataT1> CreateCooAoS <indexT1, dataT1>(
            long rows,
            long cols,
            long nnz,
            CudaDeviceVariable <indexT1> cooInd,
            CudaDeviceVariable <dataT1> cooValues,
            IndexBase idxBase) where indexT1 : struct where dataT1 : struct
        {
            cusparseSpMatDescr descr       = new cusparseSpMatDescr();
            IndexType          typeIndices = IndexTypeTranslator.GetType(typeof(indexT1));
            cudaDataType       typeData    = CudaDataTypeTranslator.GetType(typeof(dataT1));
            cusparseStatus     res         = CudaSparseNativeMethods.cusparseCreateCooAoS(ref descr, rows, cols, nnz, cooInd.DevicePointer,
                                                                                          cooValues.DevicePointer, typeIndices, idxBase, typeData);

            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCreateCooAoS", res));
            if (res != cusparseStatus.Success)
            {
                throw new CudaSparseException(res);
            }

            return(new SparseMatrix <indexT1, dataT1>(descr, rows, cols, nnz, idxBase, typeIndices, typeData));
        }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="error"></param>
		/// <param name="message"></param>
		/// <param name="exception"></param>
		public CudaSparseException(cusparseStatus error, string message, Exception exception)
			: base(message, exception)
		{
			this._cudaSparseError = error;
		}
		private static string GetErrorMessageFromCUResult(cusparseStatus error)
		{
			string message = string.Empty;

			switch (error)
			{
				case cusparseStatus.Success:
					message = "Any CUSPARSE operation is successful.";
					break;
				case cusparseStatus.NotInitialized:
					message = "The CUSPARSE library was not initialized. This is usually caused by the lack of a prior "+
						"cusparseCreate() call, an error in the CUDA Runtime API called by the CUSPARSE routine, or an "+
						"error in the hardware setup. To correct: call cusparseCreate() prior to the function call; and"+
						" check that the hardware, an appropriate version of the driver, and the CUSPARSE library are "+
						"correctly installed.";
					break;
				case cusparseStatus.AllocFailed:
					message = "Resource allocation failed inside the CUSPARSE library. This is usually caused by a "+
						"cudaMalloc() failure. To correct: prior to the function call, deallocate previously allocated " +
						"memory as much as possible.";
					break;
				case cusparseStatus.InvalidValue:
					message = "An unsupported value or parameter was passed to the function (a negative vector size, "+
						"for example). To correct: ensure that all the parameters being passed have valid values.";
					break;
				case cusparseStatus.ArchMismatch:
					message = "The function requires a feature absent from the device architecture; usually caused by "+
						"the lack of support for atomic operations or double precision. To correct: compile and run the"+
						" application on a device with appropriate compute capability, which is 1.1 for 32-bit atomic "+
						"operations and 1.3 for double precision.";
					break;
				case cusparseStatus.MappingError:
					message = "An access to GPU memory space failed, which is usually caused by a failure to bind a texture. "+
						"To correct: prior to the function call, unbind any previously bound textures.";
					break;
				case cusparseStatus.ExecutionFailed:
					message = "The GPU program failed to execute. This is often caused by a launch failure of the kernel on "+
						"the GPU, which can be caused by multiple reasons. To correct: check that the hardware, an appropriate"+
						" version of the driver, and the CUSPARSE library are correctly installed.";
					break;
				case cusparseStatus.InternalError:
					message = "An internal CUSPARSE operation failed. This error is usually caused by a cudaMemcpyAsync() "+
						"failure. To correct: check that the hardware, an appropriate version of the driver, and the CUSPARSE"+
						" library are correctly installed. Also, check that the memory passed as a parameter to the routine "+
						"is not being deallocated prior to the routine’s completion.";
					break;
				case cusparseStatus.MatrixTypeNotSupported:
					message = "The matrix type is not supported by this function. This is usually caused by passing an invalid "+
						"matrix descriptor to the function. To correct: check that the fields in cusparseMatDescr_t descrA were "+
						"set correctly.";
					break;
				default:
					break;
			}


			return error.ToString() + ": " + message;
		}
 /// <summary>
 /// GetColorAlgs
 /// </summary>
 public cusparseColorAlg GetColorAlgs()
 {
     cusparseColorAlg retVal = new cusparseColorAlg();
     res = CudaSparseNativeMethods.cusparseGetColorAlgs(_info, ref retVal);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseGetColorAlgs", res));
     if (res != cusparseStatus.Success)
         throw new CudaSparseException(res);
     return retVal;
 }
 /// <summary>
 /// SetColorAlgs
 /// </summary>
 public void SetColorAlgs(cusparseColorAlg alg)
 {
     res = CudaSparseNativeMethods.cusparseSetColorAlgs(_info, alg);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseSetColorAlgs", res));
     if (res != cusparseStatus.Success)
         throw new CudaSparseException(res);
 }
Beispiel #38
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="error"></param>
 public CudaSparseException(cusparseStatus error)
     : base(GetErrorMessageFromCUResult(error))
 {
     this._cudaSparseError = error;
 }
Beispiel #39
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="error"></param>
 /// <param name="message"></param>
 /// <param name="exception"></param>
 public CudaSparseException(cusparseStatus error, string message, Exception exception)
     : base(message, exception)
 {
     this._cudaSparseError = error;
 }
		/// <summary>
		/// Sets matrix index base
		/// </summary>
		/// <param name="indexBase"></param>
		public void SetMatIndexBase(cusparseIndexBase indexBase)
		{
			res = CudaSparseNativeMethods.cusparseSetMatIndexBase(_descr, indexBase);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseSetMatIndexBase", res));
			if (res != cusparseStatus.Success)
				throw new CudaSparseException(res);
		}
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public CudaSparseMatrixDescriptor Copy()
 {
     CudaSparseMatrixDescriptor retVal = new CudaSparseMatrixDescriptor();
     res = CudaSparseNativeMethods.cusparseCopyMatDescr(retVal.Descriptor, _descr);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusparseCopyMatDescr", res));
     if (res != cusparseStatus.Success)
         throw new CudaSparseException(res);
     return retVal;
 }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="error"></param>
		public CudaSparseException(cusparseStatus error)
			: base(GetErrorMessageFromCUResult(error))
		{
			this._cudaSparseError = error;
		}