summaryrefslogtreecommitdiff
path: root/gpu.py
diff options
context:
space:
mode:
Diffstat (limited to 'gpu.py')
-rw-r--r--gpu.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/gpu.py b/gpu.py
index 9017f20..d987789 100644
--- a/gpu.py
+++ b/gpu.py
@@ -276,6 +276,8 @@ class GPU(object):
self.earliest_time_gpu = gpuarray.GPUArray(shape=(max_pmt_id+1,), dtype=np.float32)
self.earliest_time_int_gpu = gpuarray.GPUArray(shape=self.earliest_time_gpu.shape,
dtype=np.uint32)
+ self.channel_history_gpu = gpuarray.zeros_like(self.earliest_time_int_gpu)
+ self.channel_q_gpu = gpuarray.zeros_like(self.earliest_time_int_gpu)
self.daq_pmt_rms = pmt_rms
def run_daq(self):
@@ -284,6 +286,9 @@ class GPU(object):
self.earliest_time_int_gpu,
block=(self.nthread_per_block,1,1),
grid=(len(self.earliest_time_int_gpu)//self.nthread_per_block+1,1))
+ self.channel_q_gpu.fill(0)
+ self.channel_history_gpu.fill(0)
+
#self.context.synchronize()
for first_photon, photons_this_round, blocks in chunk_iterator(self.nphotons, self.nthread_per_block, self.max_blocks):
self.daq_funcs.run_daq(self.rng_states_gpu, np.uint32(0x1 << 2),
@@ -294,7 +299,9 @@ class GPU(object):
self.last_hit_triangles_gpu,
self.solid_id_map_gpu,
np.int32(len(self.earliest_time_int_gpu)),
- self.earliest_time_int_gpu,
+ self.earliest_time_int_gpu,
+ self.channel_q_gpu,
+ self.channel_history_gpu,
block=(self.nthread_per_block,1,1), grid=(blocks,1))
#self.context.synchronize()
self.daq_funcs.convert_sortable_int_to_float(np.int32(len(self.earliest_time_int_gpu)),
@@ -306,7 +313,9 @@ class GPU(object):
def get_hits(self):
- return self.earliest_time_gpu.get()
+ return { 't': self.earliest_time_gpu.get(),
+ 'q': self.channel_q_gpu.get().astype(np.float32),
+ 'history': self.channel_history_gpu.get()}
def __del__(self):
self.context.pop()