On Mon, 09 Sep 2013 19:39:25 +0200
Tomasz Rybak <[email protected]> wrote:
> [cut]
> You can pass architecture (option "arch"), e.g. sm_21, to compiler.
> Unfortunately it seems that many high-level functionalities,
> including GPUArray, do not allow for passing this argument
> through to pycuda.compiler.compile.
>
> Question to the group - can you see any (easy) way of extending
> PyCUDA to allow for this?
>
> The easiest way for now would be to change line 209 in
> pycuda/compiler.py, in function compile().
> Instead of
> arch = "sm_%d%d" % Context.get_device().compute_capability()
> put
> arch = "sm_10"
> or the highest computing capability you want that works.
I tried something like this:
if arch is None:
try:
from pycuda.driver import Context
arch = "sm_%d%d" % Context.get_device().compute_capability()
if "PYCUDA_MAX_CC" in os.environ:
arch = min(arch,os.environ["PYCUDA_MAX_CC"])
except RuntimeError:
pass
But it failed somewhere else :(
Well I tested with CC=10,20,21,22 and 23 (by the way, 22 and 23 have never been
described officially)
This is what I got:
LogicError Traceback (most recent call last)
/users/kieffer/<ipython-input-4-518cb032e3a7> in <module>()
----> 1 a.fill(6)
/usr/lib/python2.6/dist-packages/pycuda/gpuarray.pyc in fill(self, value,
stream)
489 def fill(self, value, stream=None):
490 """fills the array with the specified value"""
--> 491 func = elementwise.get_fill_kernel(self.dtype)
492 func.prepared_async_call(self._grid, self._block, stream,
493 value, self.gpudata, self.mem_size)
/users/kieffer/<string> in get_fill_kernel(dtype)
/usr/lib/python2.6/dist-packages/pycuda/tools.pyc in
context_dependent_memoize(func, *args)
402 context_dependent_memoized_functions.append(func)
403 arg_dict = ctx_dict.setdefault(cur_ctx, {})
--> 404 result = func(*args)
405 arg_dict[args] = result
406 return result
/usr/lib/python2.6/dist-packages/pycuda/elementwise.pyc in
get_fill_kernel(dtype)
481 },
482 "z[i] = a",
--> 483 "fill")
484
485 @context_dependent_memoize
/usr/lib/python2.6/dist-packages/pycuda/elementwise.pyc in
get_elwise_kernel(arguments, operation, name, keep, options, **kwargs)
163 """
164 func, arguments = get_elwise_kernel_and_types(
--> 165 arguments, operation, name, keep, options, **kwargs)
166
167 return func
/usr/lib/python2.6/dist-packages/pycuda/elementwise.pyc in
get_elwise_kernel_and_types(arguments, operation, name, keep, options,
use_range, **kwargs)
149
150 mod = module_builder(arguments, operation, name,
--> 151 keep, options, **kwargs)
152
153 from pycuda.tools import get_arg_type
/usr/lib/python2.6/dist-packages/pycuda/elementwise.pyc in
get_elwise_module(arguments, operation, name, keep, options, preamble,
loop_prep, after_loop)
73 "after_loop": after_loop,
74 },
---> 75 options=options, keep=keep)
76
77
/usr/lib/python2.6/dist-packages/pycuda/compiler.py in __init__(self, source,
nvcc, options, keep, no_extern_c, arch, code, cache_dir, include_dirs)
285
286 from pycuda.driver import module_from_buffer
--> 287 self.module = module_from_buffer(cubin)
288
289 self.get_global = self.module.get_global
LogicError: cuModuleLoadDataEx failed: invalid source -
--
Jérôme Kieffer
Data analysis unit - ESRF
_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda