21#ifndef VOTCA_XTP_OPENMP_CUDA_H
22#define VOTCA_XTP_OPENMP_CUDA_H
79 void setOperators(
const std::vector<Eigen::MatrixXd>& tensor,
80 const Eigen::MatrixXd& rightoperator);
85 const Eigen::MatrixXd& rightoperator);
91 void A_TDA(
const Eigen::VectorXd& vec,
Index OpenmpThread);
95 const Eigen::MatrixXd& input,
Index rows1,
Index rows2,
99 void PrepareMatrix2(
const Eigen::Block<const Eigen::MatrixXd>& mat,
bool Hd2,
101 void Addvec(
const Eigen::VectorXd& row,
Index OpenmpThread);
125 assert(
p !=
nullptr &&
"Dangling reference!");
130 const T*
p =
nullptr;
141 reduce_mat = Eigen::MatrixXd::Zero(rows, cols);
166 bool isGPUthread(
Index ParentThreadId)
const;
170 explicit GPU_data(
Index i)
176 std::unique_ptr<CudaPipeline> pipeline;
177 std::vector<std::unique_ptr<CudaMatrix>> temp;
180 CudaPipeline& pipe() {
return *pipeline; }
181 void activateGPU() { checkCuda(cudaSetDevice(pipeline->getDeviceId())); }
183 void push_back(
const Eigen::MatrixXd& m) {
184 temp.push_back(std::make_unique<CudaMatrix>(m, pipeline->get_stream()));
186 void push_back(Index rows, Index cols) {
188 std::make_unique<CudaMatrix>(rows, cols, pipeline->get_stream()));
191 void resize(Index
id, Index rows, Index cols) {
193 std::make_unique<CudaMatrix>(rows, cols, pipeline->get_stream());
197 std::vector<GPU_data> gpus_;
198 static bool isInVector(
Index Id,
const std::vector<GPU_data>& vec);
DefaultReference & operator=(const T &object)
DefaultReference()=default
DefaultReference(T object)
void A_TDA(const Eigen::VectorXd &vec, Index OpenmpThread)
void Addvec(const Eigen::VectorXd &row, Index OpenmpThread)
Index getParentThreadId(Index OpenmpThreadId) const
void PushMatrix1(const Eigen::MatrixXd &mat, Index OpenmpThread)
void MultiplyLeftRight(Eigen::MatrixXd &matrix, Index OpenmpThread)
std::vector< CPU_data > cpus_
Eigen::MatrixXd getReductionVar()
void SetTempZero(Index OpenmpThread)
void MultiplyRight(Eigen::MatrixXd &matrix, Index OpenmpThread)
void createTemporaries(Index rows, Index cols)
void setOperators(const std::vector< Eigen::MatrixXd > &tensor, const Eigen::MatrixXd &rightoperator)
void PushMatrix(const Eigen::MatrixXd &mat, Index OpenmpThread)
void MultiplyBlocks(const Eigen::Block< const Eigen::MatrixXd > &mat, Index i1, Index i2, Index OpenmpThread)
static Index AvailableGPUs()
void MultiplyRow(Index row, Index OpenmpThread)
bool inside_Parallel_region_
void createAdditionalTemporaries(Index rows, Index cols)
void PrepareMatrix2(const Eigen::Block< const Eigen::MatrixXd > &mat, bool Hd2, Index OpenmpThread)
static void SetNoGPUs(Index number)
Index getLocalThreadId(Index ParentThreadId) const
DefaultReference< const Eigen::MatrixXd > rOP_
DefaultReference< const Eigen::MatrixXd > lOP_
static Index number_of_gpus
Index getNumberThreads() const
DefaultReference< const Eigen::VectorXd > vec_
void PrepareMatrix1(Eigen::MatrixXd &mat, Index OpenmpThread)
Provides a means for comparing floating point numbers.
DefaultReference< Eigen::MatrixXd > ref_mat
Eigen::MatrixXd & reduce()
Eigen::MatrixXd reduce_mat
void InitializeReduce(Index rows, Index cols)
void InitializeVec(Index size)