It seems that pycuda does not currently support the ** operator (pow) for
complex dtypes (complex64, complex128). Is this something that might be on
the horizon?
I am currently working on a project that would benefit from the pycuda
gpuarray working the same as the numpy array. We would like to accelerate
portions of our code, but need to maintain full compatibility on machines
that do not have a GPU. How alike is the gpuarray intended to become to
the numpy array?
I understand that this may not be on anyone else's priority list, so I may
try to make a stab at a patch for this if nobody else comes along. I don't
have much experience with the inner workings of pycuda yet, so that may
take a while, but if I get something together, can someone enlighten me on
the patch process, or point me to a link?
Thanks,
- Alex Nitz
I try something like,
import pycuda.autoinit
import pycuda.gpuarray
import numpy
cpu = numpy.array([1+1j],dtype=numpy.complex64)
gpu = pycuda.gpuarray.to_gpu(cpu)
gpu = gpu **2
and get this error
Traceback (most recent call last):
File "pc.py", line 9, in <module>
gpu = gpu **2
File
"/home/ahnitz/local/pycuda/lib/python2.7/site-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/gpuarray.py",
line 586, in __pow__
func = elementwise.get_pow_kernel(self.dtype)
File "<string>", line 2, in get_pow_kernel
File
"/home/ahnitz/local/pycuda/lib/python2.7/site-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/tools.py",
line 404, in context_dependent_memoize
result = func(*args)
File
"/home/ahnitz/local/pycuda/lib/python2.7/site-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/elementwise.py",
line 545, in get_pow_kernel
"pow_method")
File
"/home/ahnitz/local/pycuda/lib/python2.7/site-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/elementwise.py",
line 165, in get_elwise_kernel
arguments, operation, name, keep, options, **kwargs)
File
"/home/ahnitz/local/pycuda/lib/python2.7/site-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/elementwise.py",
line 151, in get_elwise_kernel_and_types
keep, options, **kwargs)
File
"/home/ahnitz/local/pycuda/lib/python2.7/site-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/elementwise.py",
line 75, in get_elwise_module
options=options, keep=keep)
File
"/home/ahnitz/local/pycuda/lib/python2.7/site-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/compiler.py",
line 282, in __init__
arch, code, cache_dir, include_dirs)
File
"/home/ahnitz/local/pycuda/lib/python2.7/site-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/compiler.py",
line 272, in compile
return compile_plain(source, options, keep, nvcc, cache_dir)
File
"/home/ahnitz/local/pycuda/lib/python2.7/site-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/compiler.py",
line 129, in compile_plain
cmdline, stdout=stdout, stderr=stderr)
pycuda.driver.CompileError: nvcc compilation of /tmp/tmpePwmmN/kernel.cufailed
[command: nvcc --cubin -arch sm_20
-I/home/ahnitz/local/pycuda/lib/python2.7/site-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/../include/pycuda
kernel.cu]
[stderr:
kernel.cu(19): error: no suitable conversion function from
"pycuda::complex<float>" to "float" exists
kernel.cu(19): error: no suitable conversion function from
"pycuda::complex<float>" to "float" exists
2 errors detected in the compilation of
"/tmp/tmpxft_000036ca_00000000-4_kernel.cpp4.ii".
_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda