create Event from cl_event
by Gregor Thalhammer
Dear Andreas,
I am currently working on a cython based wrapper for the OpenCL FFT library from AMD: https://github.com/geggo/gpyfft
For this I need to create a pyopencl Event instance from a cl_event returned by the library. I attached a patch against recent pyopencl that adds this possibility, similar to the from_cl_mem_as_int() method of the MemoryObject class. Could you please add this to pyopencl.
Thanks for your help
Gregor
6 years, 4 months
EuroPython anyone?
by Tomasz Rybak
Hello list.
Will any of you attend EuroPython in Florence, Italy, starting
Monday 2012-07-02?
I'll be there all week and will be glad to meet other PyOpenCL users.
Regards.
--
Tomasz Rybak <tomasz.rybak(a)post.pl> GPG/PGP key ID: 2AD5 9860
Fingerprint A481 824E 7DD3 9C0E C40A 488E C654 FB33 2AD5 9860
http://member.acm.org/~tomaszrybak
7 years, 5 months
Problems with complex GPU arrays
by Andrew Miller
Hello,
I've found some unexpected errors while working with PyOpenCL, specifically
when using one-dimensional, complex arrays.
pycuda.array.dot(a,b) doesn't work with a complex vector.
pycuda.array.sum(a) also gives an error when a is complex
Are these features that will be added in the future, or is there just not
full support for complex vectors?
Thanks!
-Andrew Miller
7 years, 5 months
Re: [PyOpenCL] In-place Elementwise Array Multiplication
by Andreas Kloeckner
Hi Andrew,
Andrew Miller <ajm09c(a)acu.edu> writes:
> I have run into a question while using 1d arrays in OpenCL. I am able to
> multiply a 1d array*=scalar. When I try to multiply a 1d array by another
> 1d array, it works fine as: newarray=a*b but when I try a*=b, I run into
> problems.
Should be fixed in git, thanks for the report.
Andreas
7 years, 5 months
Binary Array ===> Vectorization
by Timo Burggraf
Hello Mr. Klöckner,
I work with your PyOpenCL Package for my own PhD at TU-Darmstadt in the
field of applied mathematics. It is great! Thank you for your effords!
Right know I try to handle a problem, and my google-Research did not work
out. I do some calculations of Voronoi-Cells (nearest neighbor-problem).
Therefore, I write into my Result array, which is quite big (Number of
Points > 250.000).
I only want to store True/False to keep the information of closest
neighbors. (i.e. Pnt 12 is Neighbour of Pnt 13 => 12/13 = 1)
I compressed this information to a uint8 linear array (Values 0-255) and I
do bit manipulations to store 8 Neighbor Informations.
Furthermore the array grows with the Gaussian sum:
0 1 2 3
0
1 0
2 0 1
3 0 1 0
Source:
nachbar = zeros(array_size, dtype=uint8)
nachbar_buf = cl.Buffer(ctx, mf.READ_WRITE | mf.USE_HOST_PTR,
hostbuf=nachbar)
int index = (cur_compare_pnt-1)*cur_compare_pnt/2 + cur_pnt;
int main_index = index / 8;
int sub_index = index % 8;
nachbar_buf[main_index] |= 1<<sub_index;
I am not sure, if this was understandable
I hope so. My problem is, that
this process is not vectorizable, since I write with different Point Tupels
into the same uint8 Entry.
My question is: Is there a way to use a bool-linear- array in OpenCL? Or is
there a better way at all?
Thank you very much. I started with OpenCL at all one year ago and your work
help a lot.
Cheers
Timo
7 years, 5 months
In-place Elementwise Array Multiplication
by Andrew Miller
Hello,
I have run into a question while using 1d arrays in OpenCL. I am able to
multiply a 1d array*=scalar. When I try to multiply a 1d array by another
1d array, it works fine as: newarray=a*b but when I try a*=b, I run into
problems.
Here is the output:
a_gpu*=b_gpu
File
"/home/andrewmiller/dev/root/pyopencl/lib/python2.6/site-packages/pyopencl-2011.2-py2.6-linux-x86_64.egg/pyopencl/array.py",
line 631, in __imul__
self._axpbz(self, scalar, self, self.dtype.type(0))
File
"/home/andrewmiller/dev/root/pyopencl/lib/python2.6/site-packages/pyopencl-2011.2-py2.6-linux-x86_64.egg/pyopencl/array.py",
line 155, in kernel_runner
knl = kernel_getter(*args)
File
"/home/andrewmiller/dev/root/pyopencl/lib/python2.6/site-packages/pyopencl-2011.2-py2.6-linux-x86_64.egg/pyopencl/array.py",
line 407, in _axpbz
a.dtype, x.dtype, b.dtype, out.dtype)
File "<string>", line 2, in get_axpbz_kernel
File
"/home/andrewmiller/dev/root/pyopencl/lib/python2.6/site-packages/pyopencl-2011.2-py2.6-linux-x86_64.egg/pyopencl/tools.py",
line 83, in first_arg_dependent_memoize
result = func(cl_object, *args)
File
"/home/andrewmiller/dev/root/pyopencl/lib/python2.6/site-packages/pyopencl-2011.2-py2.6-linux-x86_64.egg/pyopencl/elementwise.py",
line 417, in get_axpbz_kernel
"tp_a": dtype_to_ctype(dtype_a),
File
"/home/andrewmiller/dev/root/pyopencl/lib/python2.6/site-packages/pyopencl-2011.2-py2.6-linux-x86_64.egg/pyopencl/compyte/dtypes.py",
line 114, in dtype_to_ctype
raise ValueError, "unable to map dtype '%s'" % dtype
ValueError: unable to map dtype 'object'
a_gpu and b_gpu are both pyopencl arrays, and they are both 1d, 2-element,
float32
Is there a way to do this with pyopencl, and I'm just going about it wrong?
Thanks for the help!
-Andrew Miller
7 years, 6 months
strange bus error
by Massimo DiPierro
I am getting a strange bus error. It is related to opencl or numpy but it does not manifest itself inside opencl code.
My code looks like this:
….
os.system("top -l 1 | awk '/PhysMem:/ {print $10}'")
pry.run(….) # run my kernel (constant memory)
os.system("top -l 1 | awk '/PhysMem:/ {print $10}'")
print 'done'
The output is
….
1430M
1413M
Bus error: 10
It does not print 'done'.
It is 100% reproducible. It hits when the total size of my numpy arrays is 80Mbytes.
I tried to rearrange the python code in many ways and I always get the bus error in python code executed after a call to pyopencl when the size hits 80M.
I am running on OSX Lion with 8GB Ram.
Any idea?
Process: Python [20697]
Path: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier: Python
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: bash [163]
PlugIn Path: cl_kernels
PlugIn Identifier: cl_kernels
PlugIn Version: ??? (???)
Date/Time: 2012-06-03 23:47:35.913 -0500
OS Version: Mac OS X 10.7.4 (11E53)
Report Version: 9
Interval Since Last Report: 125828 sec
Crashes Since Last Report: 18
Per-App Crashes Since Last Report: 18
Anonymous UUID: 6B52EA49-91A6-491B-844A-18883AD108BA
Crashed Thread: 3 Dispatch queue: com.apple.root.low-overcommit-priority
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000105563b68
VM Regions Near 0x105563b68:
Stack 00000001054e1000-0000000105563000 [ 520K] rw-/rwx SM=COW thread 2
--> STACK GUARD 0000000105563000-0000000105564000 [ 4K] ---/rwx SM=NUL stack guard for thread 3
Stack 0000000105564000-00000001055e6000 [ 520K] rw-/rwx SM=COW thread 3
Application Specific Information:
objc[20697]: garbage collection is OFF
Thread 0:: Dispatch queue: com.apple.main-thread
0 org.python.python 0x00000001046aad93 PyEval_EvalFrameEx + 1601
1 org.python.python 0x00000001046b0df7 0x104626000 + 568823
2 org.python.python 0x00000001046ade0a PyEval_EvalFrameEx + 14008
3 org.python.python 0x00000001046b0cd8 PyEval_EvalCodeEx + 1996
4 org.python.python 0x000000010464eabf 0x104626000 + 166591
5 org.python.python 0x000000010462dd32 PyObject_Call + 97
6 org.python.python 0x000000010463c6e9 0x104626000 + 91881
7 org.python.python 0x000000010462dd32 PyObject_Call + 97
8 org.python.python 0x0000000104678484 0x104626000 + 337028
9 org.python.python 0x0000000104672b7a 0x104626000 + 314234
10 org.python.python 0x000000010462dd32 PyObject_Call + 97
11 org.python.python 0x00000001046adf63 PyEval_EvalFrameEx + 14353
12 org.python.python 0x00000001046b0df7 0x104626000 + 568823
13 org.python.python 0x00000001046ade0a PyEval_EvalFrameEx + 14008
14 org.python.python 0x00000001046b0cd8 PyEval_EvalCodeEx + 1996
15 org.python.python 0x000000010464eabf 0x104626000 + 166591
16 org.python.python 0x000000010462dd32 PyObject_Call + 97
17 org.python.python 0x00000001046ae5ec PyEval_EvalFrameEx + 16026
18 org.python.python 0x00000001046b0cd8 PyEval_EvalCodeEx + 1996
19 org.python.python 0x00000001046b0e6c 0x104626000 + 568940
20 org.python.python 0x00000001046ade0a PyEval_EvalFrameEx + 14008
21 org.python.python 0x00000001046b0df7 0x104626000 + 568823
22 org.python.python 0x00000001046ade0a PyEval_EvalFrameEx + 14008
23 org.python.python 0x00000001046b0cd8 PyEval_EvalCodeEx + 1996
24 org.python.python 0x00000001046b0d4d PyEval_EvalCode + 54
25 org.python.python 0x00000001046c808f 0x104626000 + 663695
26 org.python.python 0x00000001046c814f PyRun_FileExFlags + 157
27 org.python.python 0x00000001046c92a2 PyRun_SimpleFileExFlags + 392
28 org.python.python 0x00000001046d92af Py_Main + 2715
29 org.python.python 0x0000000104621e88 0x104621000 + 3720
Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x00007fff85ab37e6 kevent + 10
1 libdispatch.dylib 0x00007fff864ae78a _dispatch_mgr_invoke + 923
2 libdispatch.dylib 0x00007fff864ad31a _dispatch_mgr_thread + 54
Thread 2:: Dispatch queue: com.apple.root.low-overcommit-priority
0 cl_kernels 0x000000011357db1c __aux_loop_Vectorized_wrapper + 1292
1 libcldcpuengine.dylib 0x0000000105412ef9 cld_exec_workitem + 789
2 libdispatch.dylib 0x00007fff864b0688 _dispatch_apply2 + 71
3 libdispatch.dylib 0x00007fff864b05ef dispatch_apply_f + 388
4 libcldcpuengine.dylib 0x0000000105412bc6 cld_exec_kernel + 84
5 libdispatch.dylib 0x00007fff864ae2d6 _dispatch_queue_drain + 264
6 libdispatch.dylib 0x00007fff864ae132 _dispatch_queue_invoke + 54
7 libdispatch.dylib 0x00007fff864ad92c _dispatch_worker_thread2 + 198
8 libsystem_c.dylib 0x00007fff867f33da _pthread_wqthread + 316
9 libsystem_c.dylib 0x00007fff867f4b85 start_wqthread + 13
Thread 3 Crashed:: Dispatch queue: com.apple.root.low-overcommit-priority
0 cl_kernels 0x000000011357db1c __aux_loop_Vectorized_wrapper + 1292
1 libcldcpuengine.dylib 0x0000000105412ef9 cld_exec_workitem + 789
2 libdispatch.dylib 0x00007fff864b0688 _dispatch_apply2 + 71
3 libdispatch.dylib 0x00007fff864ad965 _dispatch_worker_thread2 + 255
4 libsystem_c.dylib 0x00007fff867f33da _pthread_wqthread + 316
5 libsystem_c.dylib 0x00007fff867f4b85 start_wqthread + 13
Thread 4:: Dispatch queue: com.apple.root.low-overcommit-priority
0 cl_kernels 0x000000011357db1c __aux_loop_Vectorized_wrapper + 1292
1 libcldcpuengine.dylib 0x0000000105412ef9 cld_exec_workitem + 789
2 libdispatch.dylib 0x00007fff864b0688 _dispatch_apply2 + 71
3 libdispatch.dylib 0x00007fff864ad965 _dispatch_worker_thread2 + 255
4 libsystem_c.dylib 0x00007fff867f33da _pthread_wqthread + 316
5 libsystem_c.dylib 0x00007fff867f4b85 start_wqthread + 13
Thread 5:
0 libsystem_c.dylib 0x00007fff867f4b78 start_wqthread + 0
Thread 6:
0 libsystem_kernel.dylib 0x00007fff85ab3192 __workq_kernreturn + 10
1 libsystem_c.dylib 0x00007fff867f3594 _pthread_wqthread + 758
2 libsystem_c.dylib 0x00007fff867f4b85 start_wqthread + 13
Thread 3 crashed with X86 Thread State (64-bit):
rax: 0x0000000100000000 rbx: 0x000000011342d000 rcx: 0x0000000100000000 rdx: 0x0000000000000000
rdi: 0x00000000000013c4 rsi: 0x00000001055e3c58 rbp: 0x00000001055e3d20 rsp: 0x0000000105563b70
r8: 0x0000000000000000 r9: 0x0000000040c00000 r10: 0x0000000100000000 r11: 0x0000000000000000
r12: 0x00000001055e3c58 r13: 0x00000000000013c3 r14: 0x000013c400000000 r15: 0x0000000105563b70
rip: 0x000000011357db1c rfl: 0x0000000000010202 cr2: 0x0000000105563b68
Logical CPU: 0
7 years, 6 months