Ejemplo n.º 1
0
        //BlockedEll
        public static SparseMatrix <indexT1, dataT1> CreateBlockedEll <indexT1, dataT1>(
            long rows,
            long cols,
            long ellBlockSize,
            long ellCols,
            CudaDeviceVariable <indexT1> ellColInd,
            CudaDeviceVariable <dataT1> ellValue,
            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.cusparseCreateBlockedEll(ref descr, rows, cols, ellBlockSize, ellCols, ellColInd.DevicePointer,
                                                                                              ellValue.DevicePointer, typeIndices, idxBase, typeData);

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

            return(new SparseMatrix <indexT1, dataT1>(descr, rows, cols, 0, idxBase, typeIndices, typeData));
        }