@@ -145,6 +145,12 @@ class CSysMatrix {
145145 const unsigned long * col_ind; /* !< \brief Column index for each of the elements in val(). */
146146 const unsigned long * col_ptr; /* !< \brief The transpose of col_ind, pointer to blocks with the same column index. */
147147
148+ ScalarType* d_matrix; /* !< \brief Device Pointer to store the matrix values on the GPU. */
149+ const unsigned long * d_row_ptr; /* !< \brief Device Pointers to the first element in each row. */
150+ const unsigned long * d_col_ind; /* !< \brief Device Column index for each of the elements in val(). */
151+ bool useCuda; /* !< \brief Boolean that indicates whether user has enabled CUDA or not.
152+ Mainly used to conditionally free GPU memory in the class destructor. */
153+
148154 ScalarType* ILU_matrix; /* !< \brief Entries of the ILU sparse matrix. */
149155 unsigned long nnz_ilu; /* !< \brief Number of possible nonzero entries in the matrix (ILU). */
150156 const unsigned long * row_ptr_ilu; /* !< \brief Pointers to the first element in each row (ILU). */
@@ -391,6 +397,12 @@ class CSysMatrix {
391397 */
392398 void SetValDiagonalZero (void );
393399
400+ /* !
401+ * \brief Performs the memory copy from host to device.
402+ * \param[in] trigger - boolean value that decides whether to conduct the transfer or not. True by default.
403+ */
404+ void HtDTransfer (bool trigger = true ) const ;
405+
394406 /* !
395407 * \brief Get a pointer to the start of block "ij"
396408 * \param[in] block_i - Row index.
@@ -838,6 +850,49 @@ class CSysMatrix {
838850 void MatrixVectorProduct (const CSysVector<ScalarType>& vec, CSysVector<ScalarType>& prod, CGeometry* geometry,
839851 const CConfig* config) const ;
840852
853+ /* !
854+ * \brief Performs the product of a sparse matrix by a CSysVector.
855+ * \param[in] vec - CSysVector to be multiplied by the sparse matrix A.
856+ * \param[in] geometry - Geometrical definition of the problem.
857+ * \param[in] config - Definition of the particular problem.
858+ * \param[out] prod - Result of the product.
859+ */
860+ void GPUMatrixVectorProduct (const CSysVector<ScalarType>& vec, CSysVector<ScalarType>& prod, CGeometry* geometry,
861+ const CConfig* config) const ;
862+
863+ /* !
864+ * \brief Performs first step of the LU_SGS Preconditioner building
865+ * \param[in] vec - CSysVector to be multiplied by the sparse matrix A.
866+ * \param[in] geometry - Geometrical definition of the problem.
867+ * \param[in] config - Definition of the particular problem.
868+ * \param[out] prod - Result of the product.
869+ */
870+ void GPUFirstSymmetricIteration (ScalarType& vec, ScalarType& prod, CGeometry* geometry, const CConfig* config) const ;
871+
872+ /* !
873+ * \brief Performs second step of the LU_SGS Preconditioner building
874+ * \param[in] geometry - Geometrical definition of the problem.
875+ * \param[in] config - Definition of the particular problem.
876+ * \param[out] prod - Result of the product.
877+ */
878+ void GPUSecondSymmetricIteration (ScalarType& prod, CGeometry* geometry, const CConfig* config) const ;
879+
880+ /* !
881+ * \brief Performs Gaussian Elimination between diagional blocks of the matrix and the prod vector
882+ * \param[in] geometry - Geometrical definition of the problem.
883+ * \param[in] config - Definition of the particular problem.
884+ * \param[out] prod - Result of the product.
885+ */
886+ void GPUGaussElimination (ScalarType& prod, CGeometry* geometry, const CConfig* config) const ;
887+
888+ /* !
889+ * \brief Multiply CSysVector by the preconditioner all of which are stored on the device
890+ * \param[in] vec - CSysVector to be multiplied by the preconditioner.
891+ * \param[out] prod - Result of the product A*vec.
892+ */
893+ void GPUComputeLU_SGSPreconditioner (ScalarType& vec, ScalarType& prod, CGeometry* geometry,
894+ const CConfig* config) const ;
895+
841896 /* !
842897 * \brief Build the Jacobi preconditioner.
843898 */
0 commit comments