Hi,
the Udacity course on GPU computing CS344 is pretty good. It is
Cuda-centric but it is great introduction to GPU computing with common
patterns explained and everything explained there is directly
transposable to OpenCL. Thanks to PyOpenCL, you "just" have to learn
how to write kernels.
I hope this helps
--
Jérôme Kieffer
Hi,
I want to run my computationally expensive AI algorithms on gpu. PyOpenCL
is the best option for me coz all my AI code is in python. I have never
used GPUs before. I dont know how to learn pyOpenCL . The official
documentation assumes i know openCL i guess. Should I first learn OpenCL
and then PyOpenCL? I have ordered 2 books on openCL, OpenCL in Action and
Heterogenous computing with OpenCL. I have a Mac Pro with 2 GPUs. so should
i start reading openCL for AMD MAC users where they show how to use OPENCL
with XCode. I have read all tutorials on Andreas page including his 2011
youtube webseries which is comprehensible in beginning. Currently I am
watching OpenCL for AMD Mac video tutorials.
If any one could point me towards right materials to read as I am sure some
one you may have been through this initial non comprehending frustration.
thanks
Aseem
Tobias Schulmann <tobias.schulmann(a)pg.canterbury.ac.nz> writes:
> So I'm trying to get pyopencl to run on Ubuntu 16.04 with latest AMD APP SDK, but running into the error below when trying to run the demo script (from the documentation):
>
> ```
> [0] <pyopencl.Platform 'Clover' at 0x7f9adde43c00>
> Choice [0]:0
> Set the environment variable PYOPENCL_CTX='0' to avoid being asked again.
> .Traceback (most recent call last):
> File "./opencl.py", line 21, in <module>
> """).build()
> File "env/lib/python3.5/site-packages/pyopencl/__init__.py", line 474, in build
> options_bytes=options_bytes, source=self._source)
> File "env/lib/python3.5/site-packages/pyopencl/__init__.py", line 509, in _build_and_catch_errors
> raise err
> pyopencl.cffi_cl.RuntimeError: clbuildprogram failed: BUILD_PROGRAM_FAILURE -
>
> Build on <pyopencl.Device 'AMD HAWAII (DRM 2.43.0 / 4.4.0-36-generic, LLVM 3.9.0)' on 'Clover' at 0x22bf7c8>:
>
> <unknown>:0:0: in function sum void (float addrspace(1)*, float addrspace(1)*, float addrspace(1)*): unsupported call to function get_local_size
> ```
Clover (Mesa's Open-source implementation of OpenCL) may not yet support
get_local_size(). I'd consider Clover to be highly experimental at this stage.
If you'd like "production-grade" support, you would need to use AMD's
video driver.
Andreas
> I'm relatively sure the SDK is installed correctly, and `/opt/AMDAPPSDK-3.0/bin/x86_64/clinfo` seems to produce sensible output:
> ```
> Number of platforms: 1
> Platform Profile: FULL_PROFILE
> Platform Version: OpenCL 1.1 Mesa 12.1.0-devel (git-f65187b 2016-09-16 xenial-oibaf-ppa)
> Platform Name: Clover
> Platform Vendor: Mesa
> Platform Extensions: cl_khr_icd
>
>
> Platform Name: Clover
> Number of devices: 1
> Device Type: CL_DEVICE_TYPE_GPU
> ......
> ```
>
> Not sure if I missed a crucial step somewhere along the way or stumbled across some odd bug/incompatibility issue? Any help would be appreciated.
>
> -- Tobi
So I'm trying to get pyopencl to run on Ubuntu 16.04 with latest AMD APP SDK, but running into the error below when trying to run the demo script (from the documentation):
```
[0] <pyopencl.Platform 'Clover' at 0x7f9adde43c00>
Choice [0]:0
Set the environment variable PYOPENCL_CTX='0' to avoid being asked again.
.Traceback (most recent call last):
File "./opencl.py", line 21, in <module>
""").build()
File "env/lib/python3.5/site-packages/pyopencl/__init__.py", line 474, in build
options_bytes=options_bytes, source=self._source)
File "env/lib/python3.5/site-packages/pyopencl/__init__.py", line 509, in _build_and_catch_errors
raise err
pyopencl.cffi_cl.RuntimeError: clbuildprogram failed: BUILD_PROGRAM_FAILURE -
Build on <pyopencl.Device 'AMD HAWAII (DRM 2.43.0 / 4.4.0-36-generic, LLVM 3.9.0)' on 'Clover' at 0x22bf7c8>:
<unknown>:0:0: in function sum void (float addrspace(1)*, float addrspace(1)*, float addrspace(1)*): unsupported call to function get_local_size
```
I'm relatively sure the SDK is installed correctly, and `/opt/AMDAPPSDK-3.0/bin/x86_64/clinfo` seems to produce sensible output:
```
Number of platforms: 1
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 1.1 Mesa 12.1.0-devel (git-f65187b 2016-09-16 xenial-oibaf-ppa)
Platform Name: Clover
Platform Vendor: Mesa
Platform Extensions: cl_khr_icd
Platform Name: Clover
Number of devices: 1
Device Type: CL_DEVICE_TYPE_GPU
......
```
Not sure if I missed a crucial step somewhere along the way or stumbled across some odd bug/incompatibility issue? Any help would be appreciated.
-- Tobi
This email may be confidential and subject to legal privilege, it may
not reflect the views of the University of Canterbury, and it is not
guaranteed to be virus free. If you are not an intended recipient,
please notify the sender immediately and erase all copies of the message
and any attachments.
Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more
information.
I'm failing to compile programs, using the write_imagef() functions on
Nvidia implementations.
Working with a 'Tesla K10.G2.8GB' using the driver version 367.35 on
python 2.7 with PyopenCL 2016.1,
I'm trying to compile the following program, which fails with a build
error:
Host Code
import pyopencl as cl
platform = cl.get_platforms()[0]
devs = platform.get_devices()
device1 = devs[1]
mf = cl.mem_flags
ctx = cl.Context([device1])
Queue1 = cl.CommandQueue(ctx)
f = open('Minimal.cl', 'r')
fstr = "".join(f.readlines())
prg = cl.Program(ctx, fstr).build()
Kernel (Minimal.cl)
__kernel void test(image2d_t d_output){
write_imagef(d_output,(int2)(1,1),(float4)(1.0f,1.0f,1.0f,1.0f));
}
The error I get is:
pyopencl.cffi_cl.RuntimeError: clbuildprogram failed:
BUILD_PROGRAM_FAILURE -
I checked, if my device has image support and that it supports reading
and writing to
texture buffers in the specified format. I think, that the same case
won't work for the 3d case,
because the extension 'cl_khr_3d_image_writes' is not supported on any
of our Nvidia device,
but I don't understand the problem for the 2D case.
Hello.
When building Debian packages, I noticed few issues. Those are not even
problems
(they do not prevent building) but some tools complain about them.
1. examples/download-examples-from-wiki.py
It has #! only as third line - first two are "from __future__ import ...".
Can you fix that?
2. pyopencl/scan.py contains copyright pointing to Thrust at
code.google.com.
While URL still contains source code, it is now archival - i.e. it has old
release, etc.
Would it be better to point to Thrust at GitHub:
https://github.com/thrust/thrust
(similarly for PyCUDA)
3. NDArray (from compyte) has some non-Python3 code:
byte-compiling
/home/admin/A/pyopencl-2016.1/debian/tmp/usr/lib/python3/dist-packages/pyope
ncl/compyte/ndarray/test_gpu_ndarray.py to test_gpu_ndarray.cpython-35.pyc
File
"usr/lib/python3/dist-packages/pyopencl/compyte/ndarray/test_gpu_ndarray.py",
line 314
print shp, dtype, offseted, order1, order2
^
SyntaxError: Missing parentheses in call to 'print'
byte-compiling
/home/admin/A/pyopencl-2016.1/debian/tmp/usr/lib/python3/dist-packages/pyope
ncl/compyte/ndarray/gen_elemwise.py to gen_elemwise.cpython-35.pyc
File
"usr/lib/python3/dist-packages/pyopencl/compyte/ndarray/gen_elemwise.py",
line 955
print sio.getvalue()
^
SyntaxError: invalid syntax
Again - nothing critical (only test and dead-function code), but prevents
pre-compiling Python3 code.
Thanks in advance for fixing.
Best regards.
Tomasz Rybak
Marmaduke,
I would also be interested in making PyOpenCL self contained enough that it can be installed without any further dependencies, in particular no OpenCL implementation. Ideally, 'pip install PyOpenCL' would just succeed no matter what. Pocl seems like a reasonable vehicle for that. The problem is that it has a nontrivial build system... And then there's LLVM... It feels like a substantial amount of engineering effort.
Another avenue I explored for a bit was a conda package. I even got to the point of making that work. I can dig those package recipes up if you're interested. I believe I also put them up on github. For those I did the thing that you asked about, which is link PyOpenCL directly to pocl.
Hope that helps, and let me know if you'd like to try and work together to engineer something.
Andreas
Am 18. Mai 2016 03:16:04 GMT-05:00, schrieb Marmaduke Woodman <mmwoodman(a)gmail.com>:
>hi
>
>I'm curious if anyone has succeeded in building and using PyOpenCL,
>linked
>directly to the Beignet or PortableCL runtimes?
>
>In my case, I'm writing a library using PyOpenCL, and it would be
>useful to
>fall-back on such an alternative, if the user of my library does not
>have
>an OpenCL installation such as Intel's or Nvidia's.
>
>
>Thanks,
>Marmaduke
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>PyOpenCL mailing list
>PyOpenCL(a)tiker.net
>https://lists.tiker.net/listinfo/pyopencl
Hi all,
I am not quite getting the function of the event system together with
non-blocking copies.
I want to enqueue a non-blocking copy function which returns an event
for a kernel to wait on:
wev1 = cl.enqueue_copy(IOqueue, device_image, host_image,
is_blocking=False, origin=(0,0,0), region=host_image_shape)
program.kernel_name(workqueue,(work_group_shape,),None,device_image,wait_for
= [wev1])
Both queues are defined as OoO queues in the same context on the same
device.
In my profiling I can see the start of the kernel, before the copying is
finished. Does that mean, I have to use blocking copies,
or am I doing something else wrong?
Thanks for any help
Jonathan