diff options
| author | Stan Seibert <stan@mtrr.org> | 2011-09-16 19:21:57 -0400 |
|---|---|---|
| committer | Stan Seibert <stan@mtrr.org> | 2011-09-16 19:21:57 -0400 |
| commit | a2f7a3aed3eccb018dda989b5390371d6c0d6784 (patch) | |
| tree | 0e05359ad9fde4aae38e730bd0d42b0483bf996b /chroma | |
| parent | 9d792d1086f96fba91b9de6dddd73615c26652fd (diff) | |
| download | chroma-a2f7a3aed3eccb018dda989b5390371d6c0d6784.tar.gz chroma-a2f7a3aed3eccb018dda989b5390371d6c0d6784.tar.bz2 chroma-a2f7a3aed3eccb018dda989b5390371d6c0d6784.zip | |
Add a srcdir attribute to the chroma.cuda module. This consolidates the calculation of the path to the CUDA source code in one place.
Diffstat (limited to 'chroma')
| -rw-r--r-- | chroma/cuda/__init__.py | 2 | ||||
| -rw-r--r-- | chroma/gpu.py | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/chroma/cuda/__init__.py b/chroma/cuda/__init__.py index e69de29..dd87cbc 100644 --- a/chroma/cuda/__init__.py +++ b/chroma/cuda/__init__.py @@ -0,0 +1,2 @@ +import os.path +srcdir = os.path.dirname(os.path.abspath(__file__)) diff --git a/chroma/gpu.py b/chroma/gpu.py index 2b143a3..af83c75 100644 --- a/chroma/gpu.py +++ b/chroma/gpu.py @@ -34,7 +34,7 @@ def get_cu_module(name, options=None, include_source_directory=True): else: raise TypeError('`options` must be a tuple.') - srcdir = os.path.dirname(os.path.abspath(chroma.cuda.__file__)) + from chroma.cuda import srcdir if include_source_directory: options += ['-I' + srcdir] @@ -49,7 +49,7 @@ def get_cu_module(name, options=None, include_source_directory=True): def get_cu_source(name): """Get the source code for a CUDA source file located in the chroma cuda directory at src/[name].""" - srcdir = os.path.dirname(os.path.abspath(chroma.cuda.__file__)) + from chroma.cuda import srcdir with open('%s/%s' % (srcdir, name)) as f: source = f.read() return source |
