This commit is contained in:
Razvan Nane committed 2024-06-24 13:36:36 +02:00
1 parent deeb8a8582
commit 1477a4d76e
3 files changed
+13 -23

No files matched your search

+1
View File
@@ -3,6 +3,7 @@
#include <hip/hip_runtime_api.h>
#include <hip/hip_version.h>
#include <sstream>
#define HIP_CHECK(STAT) \
do { \
@@ -34,7 +34,10 @@ namespace Opm::Accelerator {
template<class Scalar, unsigned int block_size>
std::unique_ptr<openclPreconditioner<Scalar,block_size>>
openclPreconditioner<Scalar,block_size>::create(PreconditionerType type, int verbosity, bool opencl_ilu_parallel)
openclPreconditioner<Scalar,block_size>::
create(PreconditionerType type,
int verbosity,
bool opencl_ilu_parallel)
{
switch (type ) {
case PreconditionerType::BILU0:
@@ -51,29 +54,13 @@ openclPreconditioner<Scalar,block_size>::create(PreconditionerType type, int ver
template<class Scalar, unsigned int block_size>
void openclPreconditioner<Scalar,block_size>::
setOpencl(std::shared_ptr<cl::Context>& context_,
std::shared_ptr<cl::CommandQueue>& queue_)
setOpencl(std::shared_ptr<cl::Context>& context_,
std::shared_ptr<cl::CommandQueue>& queue_)
{
context = context_;
queue = queue_;
}
// template<class Scalar, unsigned int block_size>
// bool Preconditioner<Scalar,block_size>::
// analyze_matrix(BlockedMatrix<Scalar>* mat,
// [[maybe_unused]] BlockedMatrix<Scalar>* jacMat)
// {
// return analyze_matrix(mat);
// }
// template<class Scalar, unsigned int block_size>
// bool Preconditioner<Scalar,block_size>::
// create_preconditioner(BlockedMatrix<Scalar>* mat,
// [[maybe_unused]] BlockedMatrix<Scalar>* jacMat)
// {
// return create_preconditioner(mat);
// }
#define INSTANCE_TYPE(T) \
template class openclPreconditioner<T,1>; \
template class openclPreconditioner<T,2>; \
@@ -33,13 +33,15 @@ std::unique_ptr<rocsparsePreconditioner<Scalar,block_size> > rocsparsePreconditi
create(PreconditionerType type,
int verbosity)
{
if (type == PreconditionerType::BILU0) {
switch (type ) {
case PreconditionerType::BILU0:
return std::make_unique<Opm::Accelerator::rocsparseBILU0<Scalar, block_size> >(verbosity);
} else if (type == PreconditionerType::CPR) {
case PreconditionerType::CPR:
return std::make_unique<Opm::Accelerator::rocsparseCPR<Scalar, block_size> >(verbosity);
} else {
OPM_THROW(std::logic_error, "Invalid PreconditionerType");
}
OPM_THROW(std::logic_error,
"Invalid preconditioner type " + std::to_string(static_cast<int>(type)));
}
template <class Scalar, unsigned int block_size>