diff options
Diffstat (limited to 'gpu.py')
-rw-r--r-- | gpu.py | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -16,7 +16,6 @@ from pycuda import gpuarray as ga import chroma.src from chroma.tools import timeit, profile_if_possible from chroma.geometry import standard_wavelengths -from chroma.color import map_to_color from chroma import event cuda.init() @@ -27,7 +26,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): @@ -46,7 +45,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() @@ -166,8 +168,6 @@ class GPUPhotons(object): self.last_hit_triangles[:nphotons].set(photons.last_hit_triangles.astype(np.int32)) self.flags[:nphotons].set(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) @@ -775,8 +775,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() |