Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Common/include/linear_algebra/CMatrixVectorProduct.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class CSysMatrixVectorProduct final : public CMatrixVectorProduct<ScalarType> {
const CSysMatrix<ScalarType>& matrix; /*!< \brief pointer to matrix that defines the product. */
CGeometry* geometry; /*!< \brief geometry associated with the matrix. */
const CConfig* config; /*!< \brief config of the problem. */
mutable bool matrix_uploaded = false; /*!< \brief Upload the matrix lazily on the first actual GPU matvec. */

public:
/*!
Expand All @@ -97,6 +98,10 @@ class CSysMatrixVectorProduct final : public CMatrixVectorProduct<ScalarType> {
inline void operator()(const CSysVector<ScalarType>& u, CSysVector<ScalarType>& v) const override {
if (config->GetCUDA()) {
#ifdef HAVE_CUDA
if (!matrix_uploaded) {
matrix.HtDTransfer();
matrix_uploaded = true;
}
matrix.GPUMatrixVectorProduct(u, v, geometry, config);
#else
SU2_MPI::Error(
Expand Down
1 change: 0 additions & 1 deletion Common/src/linear_algebra/CSysMatrixGPU.cu
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ void CSysMatrix<ScalarType>::GPUMatrixVectorProduct(const CSysVector<ScalarType>
ScalarType* d_vec = vec.GetDevicePointer();
ScalarType* d_prod = prod.GetDevicePointer();

HtDTransfer();
vec.HtDTransfer();
prod.GPUSetVal(0.0);

Expand Down