Ok, I'll expand on the previous bug report. I'm running 0.94rc HEAD on both my MacBook (CUDA 2.3, Leopard, Python 2.5, gcc) and Windows XP machine (CUDA 2.3, Python 2.6, Microsoft Visual Studio 2008/VS9).
In the previous email I stated 'VC8' - that's wrong, I'm using Visual Studio 2008 AKA VS9. I also stated that all complex demos crash on Windows, that's also wrong. The older demos work fine, it is only the new functions that cause a problem. I'm going to continue investigating on Monday, I'll just state the current situation in case anyone can shed light on it. On both the Mac and Windows the older complex demos (demo_complex.py, mandelbrot.py [wiki]) work fine. On both the Mac and Windows I can use cumath.exp(numpy.compex64(...)) and cumath.log(numpy.complex64(...)) just fine along with the ElementwiseKernel equivalent (i.e. using exp and log in the ElementwiseKernel given in my first email). On my Mac I can also now use: sin, tan, sinh, pow (with a float second arg), exp, sqrt which is awesome (many thanks Andreas). On Windows with VS9 these functions cause a compiler error. I've read pycuda-complex-impl.hpp for the last few hours and I can't see any obvious problems (and the same code works fine on the Mac) so I'm a touch stumped. Here's an example: # complex_test.py import pycuda.driver as drv import pycuda.autoinit import pycuda.gpuarray as gpuarray import pycuda.cumath import numpy a = numpy.array(numpy.complex64(1-1j)) a_gpu = gpuarray.to_gpu(a) # works with exp and log, fails with sin etc print pycuda.cumath.sin(a_gpu) # should produce (1.29-0.63j) And this results in: ---- C:\Panalytical\pycuda_git\pycuda0.94\examples>python complex_test.py kernel.cu C:/Python26/lib/site-packages/pycuda-0.94rc-py2.6-win32.egg/pycuda/../include/pycuda\pycuda-complex-impl.hpp(350) : fata l error C1001: An internal error has occurred in the compiler. (compiler file 'msc1.cpp', line 1411) To work around this problem, try simplifying or changing the program near the locations listed above. Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information Internal Compiler Error in C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.exe. You will be prompted to send an error report to Microsoft later. C:\DOCUME~1\parc\LOCALS~1\Temp\tmpxft_00000fb8_00000000-6_kernel.cpp1.ii The process cannot access the file because it is being used by another process. Traceback (most recent call last): File "complex_test.py", line 14, in <module> print pycuda.cumath.sin(a_gpu) # should produce (1.29-0.63j) File "C:\Python26\lib\site-packages\pycuda-0.94rc-py2.6-win32.egg\pycuda\cumath.py", line 14, in f func = elementwise.get_unary_func_kernel(func_name, array.dtype) File "<string>", line 1, in <lambda> File "C:\Python26\lib\site-packages\pycuda-0.94rc-py2.6-win32.egg\pycuda\tools.py", line 484, in context_dependent_mem oize result = func(*args) File "C:\Python26\lib\site-packages\pycuda-0.94rc-py2.6-win32.egg\pycuda\elementwise.py", line 486, in get_unary_func_ kernel "%s_kernel" % func_name) File "C:\Python26\lib\site-packages\pycuda-0.94rc-py2.6-win32.egg\pycuda\elementwise.py", line 99, in get_elwise_kerne l arguments, operation, name, keep, options, **kwargs) File "C:\Python26\lib\site-packages\pycuda-0.94rc-py2.6-win32.egg\pycuda\elementwise.py", line 85, in get_elwise_kerne l_and_types keep, options, **kwargs) File "C:\Python26\lib\site-packages\pycuda-0.94rc-py2.6-win32.egg\pycuda\elementwise.py", line 74, in get_elwise_modul e options=options, keep=keep) File "C:\Python26\lib\site-packages\pycuda-0.94rc-py2.6-win32.egg\pycuda\compiler.py", line 226, in __init__ arch, code, cache_dir, include_dirs) File "C:\Python26\lib\site-packages\pycuda-0.94rc-py2.6-win32.egg\pycuda\compiler.py", line 216, in compile return compile_plain(source, options, keep, nvcc, cache_dir) File "C:\Python26\lib\site-packages\pycuda-0.94rc-py2.6-win32.egg\pycuda\compiler.py", line 107, in compile_plain cmdline, stdout=stdout, stderr=stderr) pycuda.driver.CompileError: nvcc compilation of c:\docume~1\parc\locals~1\temp\tmpehg6bh\kernel.cu failed [command: nvcc --cubin -arch sm_11 -IC:\Python26\lib\site-packages\pycuda-0.94rc-py2.6-win32.egg\pycuda\..\include\pycud a kernel.cu] ---- I suspect that for some reason a number of the functions (sin, tan, singh, pow, sqrt etc) are not being recognised by the compiler - if I put in a nonsense name (e.g. sinfhfhfhfhf) then I get the same error, if I miss out a function name then I get the same error. If anyone has suggestions I'd be happy to hear them! Cheers, Ian. On 7 May 2010 14:57, Ian Ozsvald <i...@ianozsvald.com> wrote: > Much obliged Andreas - on my MacBook I confirm that: > a = numpy.array(numpy.complex64(1-1j)) # make list of 1 complex element > a_gpu = gpuarray.to_gpu(a) > print pycuda.cumath.sin(a_gpu) # will print (1.29-0.63j) > now prints out the sin (and log) of a complex number. Thanks for the > extended code, I'll use your templates as my guide if I need to write > more. > > I do have an error though - on Windows with VC8 the compiler crashes > for complex support (for all uses of complex numbers). Since the same > code runs on my MacBook via gcc I'm assuming this is another MS VC > problem, I'll try to diagnose the problematic line(s) and see if I can > post a fix. > > Cheers (and I hope the thesis defense went well?), > Ian. > > On 7 May 2010 00:11, Andreas Klöckner <li...@informa.tiker.net> wrote: >> On Montag 19 April 2010, Ian Ozsvald wrote: >>> I find myself out of my depth again. I'm playing with complex numbers >>> using 0.94rc (on Windows XP with CUDA 2.3). I've successfully used >>> simple operations (addition, multiplication) on complex numbers, that >>> resulted in the Mandelbrot example in the wiki. >>> >>> Now I'm trying sin and log and I'm getting errors and one positive >>> result (see the end). I'm not sure if these functions are supported >>> yet? If anyone can point me in the right direction (and perhaps >>> suggest what needs implementing) then I'll have a go at fixing the >>> problem. >>> >>> For reference, you can do the following using numpy on the CPU for >>> verification: In [117]: numpy.sin(numpy.array(numpy.complex64(1-1j))) >>> Out[117]: (1.2984576-0.63496387j) >>> >>> Here are two pieces of test code. At first I used multiplication >>> (rather than sin()) to confirm that the code ran as expected. >>> >>> Next I tried creating a simple complex64 array, passing it to the GPU >>> and then asking for pycuda.cumath.sin() - this results in "Error: >>> External calls are not supported". Here's the code and error: >> >> Fixed/added in git, both for cumath and elwise. >> >>> I replaced: >>> pycuda.cumath.sin(a_gpu) # should produce (1.29-0.63j) >>> with: >>> pycuda.cumath.log(a_gpu) # should produce (0.34-0.78j) >>> and the code ran without an error...but produced the wrong result. It >>> generates (1-1j) which looks like a no-op. >> >> cumath ops aren't in-place--you need to print the returned value. >> >> HTH, >> Andreas >> > > > > -- > Ian Ozsvald (A.I. researcher, screencaster) > i...@ianozsvald.com > > http://IanOzsvald.com > http://morconsulting.com/ > http://TheScreencastingHandbook.com > http://ProCasts.co.uk/examples.html > http://twitter.com/ianozsvald > -- Ian Ozsvald (A.I. researcher, screencaster) i...@ianozsvald.com http://IanOzsvald.com http://morconsulting.com/ http://TheScreencastingHandbook.com http://ProCasts.co.uk/examples.html http://twitter.com/ianozsvald _______________________________________________ PyCUDA mailing list PyCUDA@tiker.net http://lists.tiker.net/listinfo/pycuda