Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
test.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file test.cc
2 #include "include/clideal.h"
3 #include <iostream>
4 
7  cfg.block_size = 64;
8  cfg.nx = 200;
9  cfg.ny = 200;
10  cfg.nz = 1;
11  cfg.nxskip = 2;
12  cfg.nyskip = 2;
13  cfg.nzskip = 2;
14  cfg.tau0 = 0.6;
15  cfg.dt = 0.02;
16  cfg.dx = 0.16;
17  cfg.dy = 0.16;
18  cfg.dz = 0.16;
19  cfg.etaos_xmin = 0.15;
20  cfg.etaos_ymin = 0.15;
21  cfg.etaos_left_slop = 0.0;
22  cfg.etaos_right_slop = 0.0;
23  cfg.result_directory = "./";
24  return cfg;
25 }
26 
27 
28 std::vector<clvisc::cl_real> trivial_initial_condition(const clvisc::Config & cfg) {
29  std::vector<clvisc::cl_real> ini;
30  long ngrids = cfg.nx * cfg.ny * cfg.nz;
31  ini.reserve(ngrids);
32  for (long idx = 0; idx < ngrids; idx++) {
33  clvisc::cl_real const_ed = 30.0f;
34  ini.push_back(const_ed);
35  }
36  return ini;
37 }
38 
39 int main(int argc, char ** argv) {
40  auto backend0 = clvisc::OpenclBackend("cpu", 0);
41  backend0.DeviceInfo();
42 
43  auto backend1 = clvisc::OpenclBackend("gpu", 1);
44  backend1.DeviceInfo();
45 
46  auto cfg = set_hydro_config();
47  std::string device_type = "gpu";
48  int device_id = 1;
49  clvisc::CLIdeal ideal(cfg, device_type, device_id);
50  auto ini = trivial_initial_condition(cfg);
51  ideal.read_ini(ini);
52  ideal.evolve();
53  return 0;
54 }