Loading...
Searching...
No Matches
vector_operations.hpp
/*
Copyright 2022-2023 SINTEF AS
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_CUISTL_VECTOR_OPERATIONS_HPP
#define OPM_CUISTL_VECTOR_OPERATIONS_HPP
#include <cstddef>
#include <cublas_v2.h>
namespace Opm::gpuistl::detail
{
template <class T>
void setVectorValue(T* deviceData, size_t numberOfElements, const T& value);
template <class T>
void setZeroAtIndexSet(T* deviceData, size_t numberOfElements, const int* indices);
template <class T>
T innerProductAtIndices(cublasHandle_t cublasHandle, const T* deviceA, const T* deviceB, T* buffer, size_t numberOfElements, const int* indices);
template <class T>
void prepareSendBuf(const T* deviceA, T* buffer, size_t numberOfElements, const int* indices);
template <class T>
void syncFromRecvBuf(T* deviceA, T* buffer, size_t numberOfElements, const int* indices);
template <class T>
void weightedDiagMV(const T* squareBlockVector,
const size_t numberOfRows,
const size_t blocksize,
T relaxationFactor,
const T* srcVec,
T* dstVec);
} // namespace Opm::gpuistl::detail
#endif
Opm::gpuistl::detail
Contains wrappers to make the CuBLAS library behave as a modern C++ library with function overlading.
Definition autotuner.hpp:30
Opm::gpuistl::detail::innerProductAtIndices
T innerProductAtIndices(cublasHandle_t cublasHandle, const T *deviceA, const T *deviceB, T *buffer, size_t numberOfElements, const int *indices)
innerProductAtIndices computes the inner product between deviceA[indices] and deviceB[indices]
Opm::gpuistl::detail::setZeroAtIndexSet
void setZeroAtIndexSet(T *deviceData, size_t numberOfElements, const int *indices)
setZeroAtIndexSet sets deviceData to zero in the indices of contained in indices
Opm::gpuistl::detail::setVectorValue
void setVectorValue(T *deviceData, size_t numberOfElements, const T &value)
setVectorValue sets every element of deviceData to value
Opm::gpuistl::detail::weightedDiagMV
void weightedDiagMV(const T *squareBlockVector, const size_t numberOfRows, const size_t blocksize, T relaxationFactor, const T *srcVec, T *dstVec)
Compue the weighted matrix vector product where the matrix is diagonal, the diagonal is a vector,...