60#define CPG_INCLUDE_SYCL
72 auto device = queue.get_device();
75 << device.get_info<sycl::info::device::name>() <<
cpg::endL;
81 auto f =[](
auto x,
auto y,
auto z)
83 return std::sin(x) * std::cos(y) * z * z;
90 auto cpu_gradients = cna::gradients<1, 5, 5>(f, bound, bound, bound);
92 for(
auto& g: cpu_gradients)
100 auto gpu_gradients = cna::gradients<1, 5, 5>(queue, f, bound, bound, bound);
102 for(
auto& g: gpu_gradients)
111 auto device = queue.get_device();
114 << device.get_info<sycl::info::device::name>() <<
cpg::endL;
120 auto fx =[](
auto x,
auto y,
auto z)
122 return std::sin(x) * std::cos(y) * z * z;
125 auto fy =[](
auto x,
auto y,
auto z)
127 return std::sin(x) * y * z;
130 auto fz =[](
auto x,
auto y,
auto z)
132 return std::cos(x) * std::sin(y) * z;
139 auto cpu_curls = cna::curls<5, 5, 1>(fx, fy, fz, bound, bound, bound);
141 for(
auto& c: cpu_curls)
148 auto gpu_curls = cna::curls<5, 5, 1>(queue, fx, fy, fz, bound, bound, bound);
150 for(
auto& c: gpu_curls)
159 auto device = queue.get_device();
162 << device.get_info<sycl::info::device::name>() <<
cpg::endL;
168 auto fx =[](
auto x,
auto y,
auto z)
170 return std::sin(x) * std::cos(y) * z * z;
173 auto fy =[](
auto x,
auto y,
auto z)
175 return std::sin(x) * y * z;
178 auto fz =[](
auto x,
auto y,
auto z)
180 return std::cos(x) * std::sin(y) * z;
187 auto cpu_divs = cna::divs<5, 5, 1>(fx, fy, fz, bound, bound, bound);
189 for(
auto& d: cpu_divs)
196 auto gpu_divs = cna::divs<5, 5, 1>(queue, fx, fy, fz, bound, bound, bound);
198 for(
auto& d: gpu_divs)
209 auto device = queue.get_device();
212 << device.get_info<sycl::info::device::name>() <<
cpg::endL;
218 auto f =[](
auto x,
auto y,
auto z)
220 return std::sin(x) * std::cos(y) * z * z;
229 auto gpu_gradients = cna::gradients<100, 100, 1>(queue, f, bound_x, bound_y, bound_z);
231 for(
int i = 0; i < 10; ++i)
240 auto device = queue.get_device();
243 << device.get_info<sycl::info::device::name>() <<
cpg::endL;
249 auto fx =[](
auto x,
auto y,
auto z)
251 return std::sin(x) * std::cos(y) * z * z;
254 auto fy =[](
auto x,
auto y,
auto z)
256 return std::sin(x) * y * z;
259 auto fz =[](
auto x,
auto y,
auto z)
261 return std::cos(x) * std::sin(y) * z;
270 auto gpu_curls = cna::curls<100, 100, 1>(queue, fx, fy, fz, bound_x, bound_y, bound_z);
272 for(
auto& c: gpu_curls)
281 auto device = queue.get_device();
284 << device.get_info<sycl::info::device::name>() <<
cpg::endL;
290 auto fx =[](
auto x,
auto y,
auto z)
292 return std::sin(x) * std::cos(y) * z * z;
295 auto fy =[](
auto x,
auto y,
auto z)
297 return std::sin(x) * y * z;
300 auto fz =[](
auto x,
auto y,
auto z)
302 return std::cos(x) * std::sin(y) * z;
311 auto gpu_divs = cna::divs<100, 100, 1>(queue, fx, fy, fz, bound_x, bound_y, bound_z);
313 for(
auto& d: gpu_divs)
324 auto f = [](
auto x,
auto y,
auto z)
326 return std::sin(x) * std::cos(y)*z*z;
349 auto fx = [](
auto x,
auto y,
auto z)
351 return std::sin(x)*z*z;
354 auto fy = [](
auto x,
auto y,
auto z)
356 return std::sin(x) * std::cos(y);
359 auto fz = [](
auto x,
auto y,
auto z)
361 return std::cos(y)*z*z;
375 auto fx = [](
auto x,
auto y,
auto z)
377 return std::sin(x)*z*z;
380 auto fy = [](
auto x,
auto y,
auto z)
382 return std::sin(x) * std::cos(y);
385 auto fz = [](
auto x,
auto y,
auto z)
387 return std::cos(y)*z*z;
void test_divergence_gpu()
constexpr auto create_command(SeqType, SeqTypes...) noexcept
auto divergence(FuncTypeX &&func_x, FuncTypeY &&func_y, FuncTypeZ &&func_z, ArgTypes... args) noexcept
auto partial_derivative(cpt::sequence< VarIndex, Order >, FuncType &&func, ArgTypes... args) noexcept
auto curl(FuncTypeX &&func_x, FuncTypeY &&func_y, FuncTypeZ &&func_z, ArgTypes... args) noexcept
constexpr auto make_array(ArgTypes &&... args) noexcept