diff options
Diffstat (limited to 'gpu.py')
-rw-r--r-- | gpu.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -278,6 +278,7 @@ 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.daq_pmt_rms = pmt_rms def run_daq(self): @@ -286,6 +287,8 @@ 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_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), @@ -296,7 +299,8 @@ 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_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)), @@ -308,7 +312,9 @@ class GPU(object): def get_hits(self): - return self.earliest_time_gpu.get() + return { 't': self.earliest_time_gpu.get(), + 'q': np.ones(shape=len(self.earliest_time_int_gpu), dtype=np.float32), + 'history': self.channel_history_gpu.get()} def __del__(self): self.context.pop() |