Exemplo n.º 1
0
		/// <summary>
		/// Create new refactorization solve instance
		/// </summary>
		public CudaSolveRefactorization()
		{
			_handle = new cusolverRfHandle();
			res = CudaSolveNativeMethods.Refactorization.cusolverRfCreate(ref _handle);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusolverRfCreate", res));
			if (res != cusolverStatus.Success) throw new CudaSolveException(res);
		}
Exemplo n.º 2
0
 /// <summary>
 /// This routine performs the LU re-factorization
 /// </summary>
 public void Refactor(cusolverRfHandle handle)
 {
     res = CudaSolveNativeMethods.Refactorization.cusolverRfRefactor(_handle);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusolverRfRefactor", res));
     if (res != cusolverStatus.Success)
     {
         throw new CudaSolveException(res);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Create new refactorization solve instance
 /// </summary>
 public CudaSolveRefactorization()
 {
     _handle = new cusolverRfHandle();
     res     = CudaSolveNativeMethods.Refactorization.cusolverRfCreate(ref _handle);
     Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusolverRfCreate", res));
     if (res != cusolverStatus.Success)
     {
         throw new CudaSolveException(res);
     }
 }
			public static extern cusolverStatus cusolverRfBatchRefactor(cusolverRfHandle handle);
			public static extern cusolverStatus cusolverRfBatchAnalyze(cusolverRfHandle handle);
			public static extern cusolverStatus cusolverRfBatchResetValues(int batchSize, int n, int nnzA, CUdeviceptr csrRowPtrA, CUdeviceptr csrColIndA, CUdeviceptr[] csrValA_array, 
				CUdeviceptr P, CUdeviceptr Q, cusolverRfHandle handle);
			public static extern cusolverStatus cusolverRfBatchSetupHost(int batchSize ,int n, int nnzA, int[] h_csrRowPtrA, int[] h_csrColIndA, IntPtr[] h_csrValA_array, int nnzL, 
				int[] h_csrRowPtrL, int[] h_csrColIndL, double[] h_csrValL, int nnzU, int[] h_csrRowPtrU, int[] h_csrColIndU, double[] h_csrValU, int[] h_P, int[] h_Q, cusolverRfHandle handle);
			public static extern cusolverStatus cusolverRfDestroy(cusolverRfHandle handle);
			public static extern cusolverStatus cusolverRfGetNumericProperties(cusolverRfHandle handle, ref double zero, ref double boost);
Exemplo n.º 10
0
		/// <summary>
		/// This routine performs the LU re-factorization
		/// </summary>
		public void Refactor(cusolverRfHandle handle)
		{
			res = CudaSolveNativeMethods.Refactorization.cusolverRfRefactor(_handle);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusolverRfRefactor", res));
			if (res != cusolverStatus.Success) throw new CudaSolveException(res);
		}
Exemplo n.º 11
0
			public static extern cusolverStatus cusolverRfAccessBundledFactorsDevice(cusolverRfHandle handle, ref int nnzM, ref CUdeviceptr Mp, ref CUdeviceptr Mi, ref CUdeviceptr Mx);
Exemplo n.º 12
0
			public static extern cusolverStatus cusolverRfResetValues(int n, int nnzA, CUdeviceptr csrRowPtrA, CUdeviceptr csrColIndA, CUdeviceptr csrValA,
				CUdeviceptr P, CUdeviceptr Q, cusolverRfHandle handle);
Exemplo n.º 13
0
			public static extern cusolverStatus cusolverRfSetupDevice(int n, int nnzA, CUdeviceptr csrRowPtrA, CUdeviceptr csrColIndA, CUdeviceptr csrValA, int nnzL,
				CUdeviceptr csrRowPtrL, CUdeviceptr csrColIndL, CUdeviceptr csrValL, int nnzU, CUdeviceptr csrRowPtrU, CUdeviceptr csrColIndU, CUdeviceptr csrValU,
				CUdeviceptr P, CUdeviceptr Q, cusolverRfHandle handle);
Exemplo n.º 14
0
			public static extern cusolverStatus cusolverRfSetupHost(int n, int nnzA, int[] h_csrRowPtrA, int[] h_csrColIndA, double[] h_csrValA, int nnzL, int[] h_csrRowPtrL, int[] h_csrColIndL, double[] h_csrValL, int nnzU, int[] h_csrRowPtrU, int[] h_csrColIndU, double[] h_csrValU, int[] h_P, int[] h_Q, cusolverRfHandle handle);
Exemplo n.º 15
0
			public static extern cusolverStatus cusolverRfSetResetValuesFastMode(cusolverRfHandle handle, ResetValuesFastMode fastMode);
Exemplo n.º 16
0
			public static extern cusolverStatus cusolverRfGetAlgs(cusolverRfHandle handle, ref Factorization factAlg, ref TriangularSolve solveAlg);
Exemplo n.º 17
0
			public static extern cusolverStatus cusolverRfGetNumericBoostReport(cusolverRfHandle handle, ref NumericBoostReport report);
Exemplo n.º 18
0
			public static extern cusolverStatus cusolverRfBatchSolve(cusolverRfHandle handle, CUdeviceptr P, CUdeviceptr Q, int nrhs, double[] Temp, 
				int ldt, IntPtr[] XF_array, int ldxf);
Exemplo n.º 19
0
			public static extern cusolverStatus cusolverRfBatchZeroPivot(cusolverRfHandle handle, int[] position);
Exemplo n.º 20
0
		/// <summary>
		/// This routine assembles the internal data structures of the cuSolverRF library for batched
		/// operation. It is called after the call to the cusolverRfCreate() routine, and before any
		/// other batched routines.
		/// </summary>
		/// <param name="batchSize">the number of matrices in the batched mode.</param>
		/// <param name="n">the number of rows (and columns) of matrix A.</param>
		/// <param name="nnzA">the number of non-zero elements of matrix A.</param>
		/// <param name="h_csrRowPtrA">the array of offsets corresponding to 
		/// the start of each row in the arrays h_csrColIndA and h_csrValA. This array has also an extra entry at the
		/// end that stores the number of non-zero elements in the matrix. The array size is n+1.</param>
		/// <param name="h_csrColIndA">the array of column indices corresponding 
		/// to the non-zero elements in the matrix. It is assumed that this array is sorted by row and by column within each row. The array size is nnzA.</param>
		/// <param name="h_csrValA_array">array of pointers of size batchSize, each pointer points to the array of values corresponding to the non-zero elements in the matrix.</param>
		/// <param name="nnzL">the number of non-zero elements of matrix L.</param>
		/// <param name="h_csrRowPtrL">the array of offsets corresponding to the start of each row in the arrays h_csrColIndL and h_csrValL. This
		/// array has also an extra entry at the end that stores the number of non-zero elements in the matrix L. The array size is n+1.</param>
		/// <param name="h_csrColIndL">the array of column indices corresponding to the non-zero elements in the matrix L. It is assumed that this array is sorted by
		/// row and by column within each row. The array size is nnzL.</param>
		/// <param name="h_csrValL">the array of values corresponding to the non-zero elements in the matrix L. It is assumed that this array is sorted by row
		/// and by column within each row. The array size is nnzL.</param>
		/// <param name="nnzU">the number of non-zero elements of matrix U.</param>
		/// <param name="h_csrRowPtrU">the array of offsets corresponding to the start of each row in the arrays h_csrColIndU and h_csrValU. This
		/// array has also an extra entry at the end that stores the number of non-zero elements in the matrix U. The array size is n+1.</param>
		/// <param name="h_csrColIndU">the array of column indices corresponding to the non-zero elements in the matrix U. It is assumed that this array is sorted by
		/// row and by column within each row. The array size is nnzU.</param> 
		/// <param name="h_csrValU">the array of values corresponding to the non-zero elements in the matrix U. It is assumed that this array is sorted by row
		/// and by column within each row. The array size is nnzU.</param>
		/// <param name="h_P">the left permutation (often associated with pivoting). The array size in n.</param>
		/// <param name="h_Q">the right permutation (often associated with reordering). The array size in n.</param>
		/// <param name="handle">the pointer to the cuSolverRF library handle.</param>
		public void BatchSetupHost(int batchSize, int n, int nnzA, int[] h_csrRowPtrA, int[] h_csrColIndA, double[][] h_csrValA_array, int nnzL,
			int[] h_csrRowPtrL, int[] h_csrColIndL, double[] h_csrValL, int nnzU, int[] h_csrRowPtrU, int[] h_csrColIndU, double[] h_csrValU, int[] h_P, int[] h_Q, cusolverRfHandle handle)
		{
			if (batchSize > h_csrValA_array.Length)
			{
				throw new ArgumentException("batchSize must be smaller or equal to the length of h_csrValA_array.");
			}

			IntPtr[] valA = new IntPtr[batchSize];
			GCHandle[] handles = new GCHandle[batchSize];

			try
			{
				for (int i = 0; i < batchSize; i++)
				{
					handles[i] = GCHandle.Alloc(h_csrValA_array[i], GCHandleType.Pinned);
					valA[i] = handles[i].AddrOfPinnedObject();
				}

				res = CudaSolveNativeMethods.Refactorization.cusolverRfBatchSetupHost(batchSize, n, nnzA, h_csrRowPtrA, h_csrColIndA, valA, nnzL,
				h_csrRowPtrL, h_csrColIndL, h_csrValL, nnzU, h_csrRowPtrU, h_csrColIndU, h_csrValU, h_P, h_Q, _handle);
				Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusolverRfBatchSetupHost", res));
			}
			catch
			{
				throw;
			}
			finally
			{
				for (int i = 0; i < batchSize; i++)
				{
					handles[i].Free();
				}
			}
			if (res != cusolverStatus.Success) throw new CudaSolveException(res);
		}
Exemplo n.º 21
0
			public static extern cusolverStatus cusolverRfExtractBundledFactorsHost(cusolverRfHandle handle, ref int h_nnzM, ref IntPtr h_Mp, ref IntPtr h_Mi, ref IntPtr h_Mx);
Exemplo n.º 22
0
			public static extern cusolverStatus cusolverRfSetMatrixFormat(cusolverRfHandle handle, MatrixFormat format, UnitDiagonal diag);
Exemplo n.º 23
0
			public static extern cusolverStatus cusolverRfExtractSplitFactorsHost(cusolverRfHandle handle, ref int h_nnzL, ref IntPtr h_csrRowPtrL, ref IntPtr h_csrColIndL, ref IntPtr h_csrValL, ref int h_nnzU, ref IntPtr h_csrRowPtrU, ref IntPtr h_csrColIndU, ref IntPtr h_csrValU);
Exemplo n.º 24
0
			public static extern cusolverStatus cusolverRfSolve(cusolverRfHandle handle, CUdeviceptr P, CUdeviceptr Q, int nrhs, double[] Temp, int ldt, double[] XF, int ldxf);
Exemplo n.º 25
0
        /// <summary>
        /// This routine assembles the internal data structures of the cuSolverRF library for batched
        /// operation. It is called after the call to the cusolverRfCreate() routine, and before any
        /// other batched routines.
        /// </summary>
        /// <param name="batchSize">the number of matrices in the batched mode.</param>
        /// <param name="n">the number of rows (and columns) of matrix A.</param>
        /// <param name="nnzA">the number of non-zero elements of matrix A.</param>
        /// <param name="h_csrRowPtrA">the array of offsets corresponding to
        /// the start of each row in the arrays h_csrColIndA and h_csrValA. This array has also an extra entry at the
        /// end that stores the number of non-zero elements in the matrix. The array size is n+1.</param>
        /// <param name="h_csrColIndA">the array of column indices corresponding
        /// to the non-zero elements in the matrix. It is assumed that this array is sorted by row and by column within each row. The array size is nnzA.</param>
        /// <param name="h_csrValA_array">array of pointers of size batchSize, each pointer points to the array of values corresponding to the non-zero elements in the matrix.</param>
        /// <param name="nnzL">the number of non-zero elements of matrix L.</param>
        /// <param name="h_csrRowPtrL">the array of offsets corresponding to the start of each row in the arrays h_csrColIndL and h_csrValL. This
        /// array has also an extra entry at the end that stores the number of non-zero elements in the matrix L. The array size is n+1.</param>
        /// <param name="h_csrColIndL">the array of column indices corresponding to the non-zero elements in the matrix L. It is assumed that this array is sorted by
        /// row and by column within each row. The array size is nnzL.</param>
        /// <param name="h_csrValL">the array of values corresponding to the non-zero elements in the matrix L. It is assumed that this array is sorted by row
        /// and by column within each row. The array size is nnzL.</param>
        /// <param name="nnzU">the number of non-zero elements of matrix U.</param>
        /// <param name="h_csrRowPtrU">the array of offsets corresponding to the start of each row in the arrays h_csrColIndU and h_csrValU. This
        /// array has also an extra entry at the end that stores the number of non-zero elements in the matrix U. The array size is n+1.</param>
        /// <param name="h_csrColIndU">the array of column indices corresponding to the non-zero elements in the matrix U. It is assumed that this array is sorted by
        /// row and by column within each row. The array size is nnzU.</param>
        /// <param name="h_csrValU">the array of values corresponding to the non-zero elements in the matrix U. It is assumed that this array is sorted by row
        /// and by column within each row. The array size is nnzU.</param>
        /// <param name="h_P">the left permutation (often associated with pivoting). The array size in n.</param>
        /// <param name="h_Q">the right permutation (often associated with reordering). The array size in n.</param>
        /// <param name="handle">the pointer to the cuSolverRF library handle.</param>
        public void BatchSetupHost(int batchSize, int n, int nnzA, int[] h_csrRowPtrA, int[] h_csrColIndA, double[][] h_csrValA_array, int nnzL,
                                   int[] h_csrRowPtrL, int[] h_csrColIndL, double[] h_csrValL, int nnzU, int[] h_csrRowPtrU, int[] h_csrColIndU, double[] h_csrValU, int[] h_P, int[] h_Q, cusolverRfHandle handle)
        {
            if (batchSize > h_csrValA_array.Length)
            {
                throw new ArgumentException("batchSize must be smaller or equal to the length of h_csrValA_array.");
            }

            IntPtr[]   valA    = new IntPtr[batchSize];
            GCHandle[] handles = new GCHandle[batchSize];

            try
            {
                for (int i = 0; i < batchSize; i++)
                {
                    handles[i] = GCHandle.Alloc(h_csrValA_array[i], GCHandleType.Pinned);
                    valA[i]    = handles[i].AddrOfPinnedObject();
                }

                res = CudaSolveNativeMethods.Refactorization.cusolverRfBatchSetupHost(batchSize, n, nnzA, h_csrRowPtrA, h_csrColIndA, valA, nnzL,
                                                                                      h_csrRowPtrL, h_csrColIndL, h_csrValL, nnzU, h_csrRowPtrU, h_csrColIndU, h_csrValU, h_P, h_Q, _handle);
                Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cusolverRfBatchSetupHost", res));
            }
            catch
            {
                throw;
            }
            finally
            {
                for (int i = 0; i < batchSize; i++)
                {
                    handles[i].Free();
                }
            }
            if (res != cusolverStatus.Success)
            {
                throw new CudaSolveException(res);
            }
        }
Exemplo n.º 26
0
			public static extern cusolverStatus cusolverRfCreate(ref cusolverRfHandle handle);