mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Bugfix: set vector size for MSwells was removed during refactoring
This commit is contained in:
parent
448af67ce6
commit
2683019280
@ -272,7 +272,7 @@ namespace Opm
|
||||
if (use_gpu || use_fpga) {
|
||||
const std::string accelerator_mode = EWOMS_GET_PARAM(TypeTag, std::string, AcceleratorMode);
|
||||
auto wellContribs = WellContributions::create(accelerator_mode, useWellConn_);
|
||||
bdaBridge->initWellContributions(*wellContribs);
|
||||
bdaBridge->initWellContributions(*wellContribs, x.N() * x[0].N());
|
||||
|
||||
// the WellContributions can only be applied separately with CUDA or OpenCL, not with an FPGA or amgcl
|
||||
#if HAVE_CUDA || HAVE_OPENCL
|
||||
|
@ -285,7 +285,8 @@ void BdaBridge<BridgeMatrix, BridgeVector, block_size>::get_result([[maybe_unuse
|
||||
}
|
||||
|
||||
template <class BridgeMatrix, class BridgeVector, int block_size>
|
||||
void BdaBridge<BridgeMatrix, BridgeVector, block_size>::initWellContributions([[maybe_unused]] WellContributions& wellContribs) {
|
||||
void BdaBridge<BridgeMatrix, BridgeVector, block_size>::initWellContributions([[maybe_unused]] WellContributions& wellContribs,
|
||||
[[maybe_unused]] unsigned N) {
|
||||
if(accelerator_mode.compare("opencl") == 0){
|
||||
#if HAVE_OPENCL
|
||||
const auto openclBackend = static_cast<const Opm::Accelerator::openclSolverBackend<block_size>*>(backend.get());
|
||||
@ -294,6 +295,7 @@ void BdaBridge<BridgeMatrix, BridgeVector, block_size>::initWellContributions([[
|
||||
OPM_THROW(std::logic_error, "Error openclSolver was chosen, but OpenCL was not found by CMake");
|
||||
#endif
|
||||
}
|
||||
wellContribs.setVectorSize(N);
|
||||
}
|
||||
|
||||
// the tests use Dune::FieldMatrix, Flow uses Opm::MatrixBlock
|
||||
|
@ -93,7 +93,8 @@ public:
|
||||
/// Initialize the WellContributions object with opencl context and queue
|
||||
/// those must be set before calling BlackOilWellModel::getWellContributions() in ISTL
|
||||
/// \param[in] wellContribs container to hold all WellContributions
|
||||
void initWellContributions(WellContributions& wellContribs);
|
||||
/// \param[in] N number of rows in scalar vector that wellContribs will be applied on
|
||||
void initWellContributions(WellContributions& wellContribs, unsigned N);
|
||||
|
||||
/// Return whether the BdaBridge will use the FPGA or not
|
||||
/// return whether the BdaBridge will use the FPGA or not
|
||||
|
@ -101,6 +101,10 @@ void WellContributions::setBlockSize(unsigned int dim_, unsigned int dim_wells_)
|
||||
}
|
||||
}
|
||||
|
||||
void WellContributions::setVectorSize(unsigned N_) {
|
||||
N = N_;
|
||||
}
|
||||
|
||||
void WellContributions::addNumBlocks(unsigned int numBlocks)
|
||||
{
|
||||
if (allocated) {
|
||||
|
@ -101,6 +101,10 @@ public:
|
||||
/// \param[in] dim_wells number of rows
|
||||
void setBlockSize(unsigned int dim, unsigned int dim_wells);
|
||||
|
||||
/// Set size of vector that the wells are applied to
|
||||
/// \param[in] N size of vector
|
||||
void setVectorSize(unsigned N);
|
||||
|
||||
/// Store a matrix in this object, in blocked csr format, can only be called after alloc() is called
|
||||
/// \param[in] type indicate if C, D or B is sent
|
||||
/// \param[in] colIndices columnindices of blocks in C or B, ignored for D
|
||||
|
@ -35,12 +35,6 @@ using Accelerator::OpenclKernels;
|
||||
void WellContributionsOCL::setOpenCLEnv(cl::Context* context_, cl::CommandQueue* queue_) {
|
||||
this->context = context_;
|
||||
this->queue = queue_;
|
||||
}
|
||||
|
||||
void WellContributionsOCL::setKernel(Accelerator::stdwell_apply_kernel_type* kernel_,
|
||||
Accelerator::stdwell_apply_no_reorder_kernel_type* kernel_no_reorder_) {
|
||||
this->kernel = kernel_;
|
||||
this->kernel_no_reorder = kernel_no_reorder_;
|
||||
}
|
||||
|
||||
void WellContributionsOCL::setReordering(int* h_toOrder_, bool reorder_)
|
||||
|
@ -35,8 +35,6 @@ namespace Opm
|
||||
class WellContributionsOCL : public WellContributions
|
||||
{
|
||||
public:
|
||||
void setKernel(Opm::Accelerator::stdwell_apply_kernel_type *kernel_,
|
||||
Opm::Accelerator::stdwell_apply_no_reorder_kernel_type *kernel_no_reorder_);
|
||||
void setOpenCLEnv(cl::Context *context_, cl::CommandQueue *queue_);
|
||||
|
||||
/// Since the rows of the matrix are reordered, the columnindices of the matrixdata is incorrect
|
||||
@ -56,8 +54,6 @@ protected:
|
||||
|
||||
cl::Context* context;
|
||||
cl::CommandQueue* queue;
|
||||
Opm::Accelerator::stdwell_apply_kernel_type* kernel;
|
||||
Opm::Accelerator::stdwell_apply_no_reorder_kernel_type* kernel_no_reorder;
|
||||
std::vector<cl::Event> events;
|
||||
|
||||
std::unique_ptr<cl::Buffer> d_Cnnzs_ocl, d_Dnnzs_ocl, d_Bnnzs_ocl;
|
||||
|
Loading…
Reference in New Issue
Block a user