diff options
-rw-r--r-- | gputhread.py | 3 | ||||
-rw-r--r-- | solids/r7081.py | 2 | ||||
-rw-r--r-- | threadtest.py | 4 | ||||
-rwxr-xr-x | view.py | 2 |
4 files changed, 6 insertions, 5 deletions
diff --git a/gputhread.py b/gputhread.py index 3aa3cb2..0ee0155 100644 --- a/gputhread.py +++ b/gputhread.py @@ -75,8 +75,11 @@ class GPUThread(threading.Thread): context = device.make_context() module = SourceModule(src.kernel, options=['-I' + src.dir], no_extern_c=True, cache_dir=False) propagate = module.get_function('propagate') + init_rng = module.get_function('init_rng') texrefs = self.geometry.load(module) + init_rng(np.int32(1000000), np.int32(0), np.int32(0), block=(self.nblocks,1,1), grid=(1000000//self.nblocks,1)) + while not self.stopped(): try: job = self.jobs.get(block=False, timeout=0.5) diff --git a/solids/r7081.py b/solids/r7081.py index f91c2ab..af9c2f0 100644 --- a/solids/r7081.py +++ b/solids/r7081.py @@ -6,7 +6,7 @@ dir = os.path.split(os.path.realpath(__file__))[0] sys.path.append(dir + '/..') import models -from mesh import mesh_from_stl +from stl import mesh_from_stl from geometry import * from materials import * diff --git a/threadtest.py b/threadtest.py index 08a1b42..0111bc7 100644 --- a/threadtest.py +++ b/threadtest.py @@ -12,7 +12,7 @@ jobs = Queue() output = Queue() def create_job(position=(0,0,0), nphotons=10000, max_steps=10): - positions = np.tile(gpuarray.vec.make_float3(*position), (nphotons,1)) + positions = np.tile(position, nphotons).reshape((nphotons, 3)) directions = uniform_sphere(nphotons) polarizations = uniform_sphere(nphotons) wavelengths = np.random.uniform(200, 800, size=nphotons) @@ -23,7 +23,6 @@ def create_job(position=(0,0,0), nphotons=10000, max_steps=10): return Job(positions, directions, wavelengths, polarizations, times, states, last_hit_triangles, max_steps) -#@profile def generate_event(position=(0,0,0), nphotons=10000): jobs.put(create_job(position, nphotons)) jobs.join() @@ -48,7 +47,6 @@ def generate_event(position=(0,0,0), nphotons=10000): return np.array(event_times) -#@profile def likelihood(event_times, position=(0,0,0), nphotons=10000, neval=100): for i in range(neval): jobs.put(create_job(position, nphotons)) @@ -180,7 +180,7 @@ if __name__ == '__main__': import sys import optparse - from mesh import * + from stl import * import solids import detectors |