openclWellContributions.hpp
Go to the documentation of this file.
1/*
2 Copyright 2020 Equinor ASA
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef WELLCONTRIBUTIONS_OPENCL_HEADER_INCLUDED
21#define WELLCONTRIBUTIONS_OPENCL_HEADER_INCLUDED
22
24
27
28#include <memory>
29#include <vector>
30
31
32namespace Opm {
33
34template<class Scalar>
36{
37public:
38 void setOpenCLEnv(cl::Context *context_, cl::CommandQueue *queue_);
39
40 void apply_stdwells(cl::Buffer d_x, cl::Buffer d_y);
41 void apply_mswells(cl::Buffer d_x, cl::Buffer d_y);
42 void apply(cl::Buffer d_x, cl::Buffer d_y);
43
44protected:
46 void APIalloc() override;
47
49
50 void APIaddMatrix(MatrixType type, int* colIndices,
51 Scalar* values, unsigned int val_size) override;
52
53 cl::Context* context;
54 cl::CommandQueue* queue;
55 std::vector<cl::Event> events;
56
57 std::unique_ptr<cl::Buffer> d_Cnnzs_ocl, d_Dnnzs_ocl, d_Bnnzs_ocl;
58 std::unique_ptr<cl::Buffer> d_Ccols_ocl, d_Bcols_ocl;
59 std::unique_ptr<cl::Buffer> d_val_pointers_ocl;
60
61 std::vector<Scalar> h_x;
62 std::vector<Scalar> h_y;
63};
64
65} // namespace Opm
66
67#endif
Definition: openclWellContributions.hpp:36
std::vector< Scalar > h_y
Definition: openclWellContributions.hpp:62
std::unique_ptr< cl::Buffer > d_Dnnzs_ocl
Definition: openclWellContributions.hpp:57
void apply(cl::Buffer d_x, cl::Buffer d_y)
void apply_mswells(cl::Buffer d_x, cl::Buffer d_y)
std::vector< cl::Event > events
Definition: openclWellContributions.hpp:55
cl::CommandQueue * queue
Definition: openclWellContributions.hpp:54
std::unique_ptr< cl::Buffer > d_Cnnzs_ocl
Definition: openclWellContributions.hpp:57
cl::Context * context
Definition: openclWellContributions.hpp:53
void APIaddMatrix(MatrixType type, int *colIndices, Scalar *values, unsigned int val_size) override
Api specific upload of matrix.
std::vector< Scalar > h_x
Definition: openclWellContributions.hpp:61
void apply_stdwells(cl::Buffer d_x, cl::Buffer d_y)
std::unique_ptr< cl::Buffer > d_Ccols_ocl
Definition: openclWellContributions.hpp:58
void setOpenCLEnv(cl::Context *context_, cl::CommandQueue *queue_)
std::unique_ptr< cl::Buffer > d_Bnnzs_ocl
Definition: openclWellContributions.hpp:57
std::unique_ptr< cl::Buffer > d_Bcols_ocl
Definition: openclWellContributions.hpp:58
std::unique_ptr< cl::Buffer > d_val_pointers_ocl
Definition: openclWellContributions.hpp:59
void APIalloc() override
Allocate memory for the StandardWells.
Definition: WellContributions.hpp:53
MatrixType
StandardWell has C, D and B matrices that need to be copied.
Definition: WellContributions.hpp:59
Definition: blackoilboundaryratevector.hh:37