53 using Base::verbosity;
61 std::vector<double> weights, coarse_vals, coarse_x, coarse_y;
62 std::vector<Matrix> Amatrices, Rmatrices;
63 std::vector<OpenclMatrix> d_Amatrices, d_Rmatrices;
64 std::vector<std::vector<int> > PcolIndices;
65 std::vector<cl::Buffer> d_PcolIndices;
66 std::vector<std::vector<double> > invDiags;
67 std::vector<cl::Buffer> d_invDiags;
68 std::vector<cl::Buffer> d_t, d_f, d_u;
69 std::unique_ptr<cl::Buffer> d_rs;
70 std::unique_ptr<cl::Buffer> d_weights;
71 std::unique_ptr<OpenclMatrix> d_mat;
72 std::unique_ptr<cl::Buffer> d_coarse_y, d_coarse_x;
73 std::once_flag opencl_buffers_allocated;
75 std::unique_ptr<BILU0<block_size> > bilu0;
78 using DuneMat = Dune::BCRSMatrix<Dune::FieldMatrix<double, 1, 1> >;
79 using DuneVec = Dune::BlockVector<Dune::FieldVector<double, 1> >;
80 using MatrixOperator = Dune::MatrixAdapter<DuneMat, DuneVec, DuneVec>;
81 using DuneAmg = Dune::Amg::MatrixHierarchy<MatrixOperator, Dune::Amg::SequentialInformation>;
82 std::unique_ptr<DuneAmg> dune_amg;
83 std::unique_ptr<DuneMat> dune_coarse;
84 std::shared_ptr<MatrixOperator> dune_op;
85 std::vector<int> level_sizes;
86 std::vector<std::vector<int> > diagIndices;
88 bool always_recalculate_aggregates =
false;
89 bool recalculate_aggregates =
true;
90 const int pressure_idx = 1;
91 unsigned num_pre_smooth_steps;
92 unsigned num_post_smooth_steps;
94 std::unique_ptr<openclSolverBackend<1> > coarse_solver;
95 bool opencl_ilu_parallel;
98 void analyzeHierarchy();
102 void analyzeAggregateMaps();
105 void init_opencl_buffers();
108 void opencl_upload();
111 void apply_amg(
const cl::Buffer&
y, cl::Buffer& x);
113 void amg_cycle_gpu(
const int level, cl::Buffer &
y, cl::Buffer &x);
119 CPR(
int verbosity,
bool opencl_ilu_parallel);
125 void setOpencl(std::shared_ptr<cl::Context>& context, std::shared_ptr<cl::CommandQueue>& queue)
override;
129 void apply(
const cl::Buffer&
y, cl::Buffer& x)
override;