From 3c50c82458242d012216661e2e7eca2255f38207 Mon Sep 17 00:00:00 2001 From: Anthony LaTorre Date: Sat, 10 Sep 2011 13:41:30 -0400 Subject: update documentation and rename create_context -> create_cuda_context. --- gpu.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gpu.py b/gpu.py index 671c872..26ecbe7 100644 --- a/gpu.py +++ b/gpu.py @@ -15,7 +15,6 @@ from pycuda import gpuarray as ga import chroma.src from chroma.tools import timeit from chroma.geometry import standard_wavelengths -from chroma.color import map_to_color from chroma import event cuda.init() @@ -26,7 +25,7 @@ cuda_options = ('--use_fast_math',)#, '--ptxas-options=-v'] @pycuda.tools.context_dependent_memoize def get_cu_module(name, options=None, include_source_directory=True): """Returns a pycuda.compiler.SourceModule object from a CUDA source file - located in the chroma src directory at src/[name].cu.""" + located in the chroma src directory at src/[name].""" if options is None: options = [] elif isinstance(options, tuple): @@ -45,7 +44,10 @@ def get_cu_module(name, options=None, include_source_directory=True): return pycuda.compiler.SourceModule(source, options=options, no_extern_c=True) +@pycuda.tools.memoize def get_cu_source(name): + """Get the source code for a CUDA source file located in the chroma src + directory at src/[name].""" srcdir = os.path.dirname(os.path.abspath(chroma.src.__file__)) with open('%s/%s' % (srcdir, name)) as f: source = f.read() @@ -140,8 +142,6 @@ class GPUPhotons(object): self.last_hit_triangles = ga.to_gpu(photons.last_hit_triangles.astype(np.int32)) self.flags = ga.to_gpu(photons.flags.astype(np.uint32)) - #cuda_options = ('--use_fast_math', '-w')#, '--ptxas-options=-v'] - module = get_cu_module('propagate.cu', options=cuda_options) self.gpu_funcs = GPUFuncs(module) @@ -676,8 +676,8 @@ class GPUPDF(object): return hitcount, pdf_value, pdf_value * pdf_frac_uncert -def create_context(device_id=None): - """Initialize and return a GPU context on the specified device. +def create_cuda_context(device_id=None): + """Initialize and return a CUDA context on the specified device. If device_id is None, the default device is used.""" try: cuda.mem_get_info() -- cgit