34 int device_id):cfg_(cfg),
35 ideal_(
CLIdeal(cfg, device_type, device_id)),
36 backend_(ideal_.get_backend()),
37 bulkinfo_(cfg.
nx, cfg.
ny, cfg.
nz, cfg.nxskip,
38 cfg.nyskip, cfg.nzskip, backend_,
39 ideal_.get_compile_option())
71 }
catch (cl::Error &
err ){
72 std::cerr<<
"Error:"<<err.what()<<
"("<<err.err()<<
")\n";
73 std::cerr<<
"@" << __FILE__ <<
":line " << __LINE__ << std::endl;
81 bool read_only_option =
false;
87 for (
int i = 0;
i < 3;
i++) {
95 std::vector<cl_real4> h_udz_(
size_, (
cl_real4){{0.0f, 0.0f, 0.0f, 0.0f}});
251 template <
typename ValueType>
261 template <
typename ValueType>
263 const std::vector<ValueType> &
vx,
264 const std::vector<ValueType> &
vy,
265 const std::vector<ValueType> &
vz)
275 template <
typename ValueType>
277 const std::vector<ValueType> &
vx,
278 const std::vector<ValueType> &
vy,
279 const std::vector<ValueType> &
vz,
280 const std::vector<ValueType> & pi00,
281 const std::vector<ValueType> & pi01,
282 const std::vector<ValueType> & pi02,
283 const std::vector<ValueType> & pi03,
284 const std::vector<ValueType> & pi11,
285 const std::vector<ValueType> & pi12,
286 const std::vector<ValueType> & pi13,
287 const std::vector<ValueType> & pi22,
288 const std::vector<ValueType> & pi23,
289 const std::vector<ValueType> & pi33) {
292 for (
size_t i = 0;
i <
size_;
i++) {
293 h_shear_pi_.push_back(static_cast<cl_real>(pi00.at(
i)));
294 h_shear_pi_.push_back(static_cast<cl_real>(pi01.at(
i)));
295 h_shear_pi_.push_back(static_cast<cl_real>(pi02.at(
i)));
296 h_shear_pi_.push_back(static_cast<cl_real>(pi03.at(
i)));
297 h_shear_pi_.push_back(static_cast<cl_real>(pi11.at(
i)));
298 h_shear_pi_.push_back(static_cast<cl_real>(pi12.at(
i)));
299 h_shear_pi_.push_back(static_cast<cl_real>(pi13.at(
i)));
300 h_shear_pi_.push_back(static_cast<cl_real>(pi22.at(
i)));
301 h_shear_pi_.push_back(static_cast<cl_real>(pi23.at(
i)));
302 h_shear_pi_.push_back(static_cast<cl_real>(pi33.at(
i)));
314 int max_loops = 5000;
315 float total_exec_time = 0.0;
316 std::time_t timer1, timer2;
322 for (
int loop = 0; loop < max_loops; loop++) {
329 std::cout <<
"tau = " <<
tau_ <<
" fm; ";
330 std::cout <<
"max_ed = " << max_ed <<
" ";
332 total_exec_time = std::difftime(timer2, timer1);
337 if ( max_ed < 0.05 )
break;
340 std::cout << std::endl;
342 std::cout <<
"Total computing time: " << total_exec_time <<
" s; ";
343 }
catch (cl::Error &
err) {
344 std::cout << err.what() <<
" " << err.err() << std::endl;
345 std::cerr<<
"@" << __FILE__ <<
":line " << __LINE__ << std::endl;
359 const std::vector<float> &
vx,
360 const std::vector<float> &
vy,
361 const std::vector<float> &
vz);
364 const std::vector<double> &
vx,
365 const std::vector<double> &
vy,
366 const std::vector<double> &
vz);
370 const std::vector<float> &
vx,
371 const std::vector<float> &
vy,
372 const std::vector<float> &
vz,
373 const std::vector<float> & pi00,
374 const std::vector<float> & pi01,
375 const std::vector<float> & pi02,
376 const std::vector<float> & pi03,
377 const std::vector<float> & pi11,
378 const std::vector<float> & pi12,
379 const std::vector<float> & pi13,
380 const std::vector<float> & pi22,
381 const std::vector<float> & pi23,
382 const std::vector<float> & pi33);
385 const std::vector<double> &
vx,
386 const std::vector<double> &
vy,
387 const std::vector<double> &
vz,
388 const std::vector<double> & pi00,
389 const std::vector<double> & pi01,
390 const std::vector<double> & pi02,
391 const std::vector<double> & pi03,
392 const std::vector<double> & pi11,
393 const std::vector<double> & pi12,
394 const std::vector<double> & pi13,
395 const std::vector<double> & pi22,
396 const std::vector<double> & pi23,
397 const std::vector<double> & pi33);