ATLAS Offline Software
Loading...
Searching...
No Matches
CaloGpuGeneral Namespace Reference

Functions

void * Rand4Hits_init (long long, unsigned short, unsigned long long, bool)
void Rand4Hits_finish (void *)
void simulate_hits (float, int, Chain0_Args &, bool)

Function Documentation

◆ Rand4Hits_finish()

void CaloGpuGeneral::Rand4Hits_finish ( void * rd4h)

Definition at line 41 of file CaloGpuGeneral.cxx.

41 {
42 if ( (Rand4Hits*)rd4h ) delete (Rand4Hits*)rd4h;
43}

◆ Rand4Hits_init()

void * CaloGpuGeneral::Rand4Hits_init ( long long maxhits,
unsigned short maxbin,
unsigned long long seed,
bool  )

Definition at line 8 of file CaloGpuGeneral.cxx.

9 {
10
11 auto t0 = std::chrono::system_clock::now();
12 Rand4Hits* rd4h = new Rand4Hits;
13 auto t1 = std::chrono::system_clock::now();
14
15 // By default, generate random numbers on GPU, unless macro RNDGEN_CPU is set
16 // This is controlled by cmake parameter -DRNDGEN_CPU
17 constexpr bool genOnCPU{false};
18
19 auto t2 = std::chrono::system_clock::now();
20 // use CPU rand num gen to be able to compare GPU implementations
21 rd4h->create_gen( seed, 3 * maxhits, genOnCPU );
22 auto t3 = std::chrono::system_clock::now();
23 rd4h->set_t_a_hits( maxhits );
24 rd4h->set_c_hits( 0 );
25 auto t4 = std::chrono::system_clock::now();
26
27 rd4h->allocate_simulation( maxhits, maxbin, 2000, 200000 );
28 auto t5 = std::chrono::system_clock::now();
29
30 std::chrono::duration<double> diff1 = t1 - t0;
31 std::chrono::duration<double> diff2 = t2 - t1;
32 std::chrono::duration<double> diff3 = t3 - t2;
33 std::chrono::duration<double> diff4 = t4 - t3;
34 std::chrono::duration<double> diff5 = t5 - t4;
35 std::cout << "Time of R4hit: " << diff1.count() << "," << diff2.count() << "," << diff3.count() << ","
36 << diff4.count() << "," << diff5.count() << " s" << std::endl;
37
38 return (void*)rd4h;
39}
static Double_t t0
void create_gen(unsigned long long seed, size_t numhits, bool useCPU=false)
void set_c_hits(int nhits)
Definition Rand4Hits.h:30
void allocate_simulation(long long maxhits, unsigned short maxbins, unsigned short maxhitct, unsigned long n_cells)
void set_t_a_hits(int nhits)
Definition Rand4Hits.h:29

◆ simulate_hits()

void CaloGpuGeneral::simulate_hits ( float E,
int nhits,
Chain0_Args & args,
bool reweight )

Definition at line 45 of file CaloGpuGeneral.cxx.

45 {
46
47 Rand4Hits* rd4h = (Rand4Hits*)args.rd4h;
48
49 float* r = rd4h->rand_ptr( nhits );
50
51 rd4h->add_a_hits( nhits );
52 args.rand = r;
53
54 args.maxhitct = MAXHITCT;
55
56 args.cells_energy = rd4h->get_cells_energy(); // Hit cell energy map , size of ncells(~200k float)
57 args.hitcells_E = rd4h->get_cell_e(); // Hit cell energy map, moved together
58 args.hitcells_E_h = rd4h->get_cell_e_h(); // Host array
59
60 args.hitcells_ct = rd4h->get_ct(); // single value, number of uniq hit cells
61
62 CaloGpuGeneral_cu::simulate_hits( E, nhits, args , reweight);
63}
#define MAXHITCT
Definition Args.h:13
int r
Definition globals.cxx:22
void simulate_hits(float, int, Chain0_Args &, bool)