AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
LinkList.hpp
Go to the documentation of this file.
1/*
2 * This file is part of AQUAgpusph, a free CFD program based on SPH.
3 * Copyright (C) 2012 Jose Luis Cercos Pita <jl.cercos@upm.es>
4 *
5 * AQUAgpusph is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * AQUAgpusph is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with AQUAgpusph. If not, see <http://www.gnu.org/licenses/>.
17 */
18
25
26#ifndef LINKLIST_H_INCLUDED
27#define LINKLIST_H_INCLUDED
28
30#include <vector>
31#include "Tool.hpp"
32#include "Reduction.hpp"
33
34namespace Aqua {
35namespace CalcServer {
36
52{
53 public:
73 LinkList(const std::string tool_name,
74 const std::string input = "r",
75 const std::string input_min = "r_min",
76 const std::string input_max = "r_max",
77 const std::string ihoc = "ihoc",
78 const std::string icell = "icell",
79 const std::string n_cells = "n_cells",
80 const std::string permutations = "id_unsorted",
81 const std::string inv_permutations = "id_sorted",
82 bool recompute_grid = true,
83 const std::string sorter = "radix-sort",
84 bool once = false);
85
88 ~LinkList();
89
92 void setup();
93
99 inline cl_event getUserEvent() const { return _user_event; }
100
101 protected:
106 template<typename T>
107 void nCells();
108
113 void allocate();
114
119 void setVariables();
120
125 cl_event _execute(const std::vector<cl_event> events);
126
127 private:
128 inline uivec4 nCells32() const {
129 uivec4 n_cells;
130 for (unsigned int i = 0; i < 4; i++)
131 n_cells.s[i] = narrow_cast<uicl>(_n_cells.s[i]);
132 return n_cells;
133 }
134
137 void setupOpenCL();
138
140 std::string _input_name;
141
143 std::string _input_min_name;
144
146 std::string _input_max_name;
147
149 std::string _ihoc_name;
150
152 std::string _icell_name;
153
155 std::string _n_cells_name;
156
158 float _cell_length;
159
161 ulvec4 _n_cells;
162
164 Reduction* _min_pos;
165
167 Reduction* _max_pos;
168
170 bool _recompute_minmax;
171
173 Tool* _sort;
174
176 cl_kernel _ihoc;
178 size_t _ihoc_lws;
180 size_t _ihoc_gws;
182 std::vector<void*> _ihoc_args;
183
185 cl_kernel _icell;
187 size_t _icell_lws;
189 size_t _icell_gws;
191 std::vector<void*> _icell_args;
192
194 cl_kernel _ll;
196 size_t _ll_lws;
198 size_t _ll_gws;
200 std::vector<void*> _ll_args;
201
204 cl_event _user_event;
205};
206
207}
208} // namespace
209
210#endif // LINKLIST_H_INCLUDED
Reductions, like scans, prefix sums, maximum or minimum, etc... (See Aqua::CalcServer::Reduction for ...
Tools virtual environment to allow the user to define/manipulate the tools used to carry out the simu...
Reductions, like scans, prefix sums, maximum or minimum, etc...
Definition Reduction.hpp:45
Tools base class.
Definition Tool.hpp:176
Calculation server name space.
Definition Assert.cpp:32
Main AQUAgpusph namespace.
Definition ArgumentsManager.cpp:50
Tdst narrow_cast(Torg v)
Cast a value, checking that it is not overflowing.
Definition AuxiliarMethods.hpp:414
Set of definitions and macros related with the implementation.