Hi all,
If you are attending Nvidia's GPU Technology Conference next week, there are
two things I'd like to point out:
- I'll be giving a talk about PyCUDA on Friday, October 2 at 2pm, where I'll
both introduce PyCUDA and talk about some exciting new developments. The talk
will be 50 minutes in length, and I'd be happy to see you there.
- Also, I'd like to propose a PyCUDA meetup on Thursday, October 1 at noon.
(ie. lunchtime) I'll be hanging out by the "Terrace" seminar room around that
time. I'm looking forward to meeting some of you in person.
See you next week,
Andreas
Currently, any OpenCL compiler options passed to the build() method of a
Program object are ignored, as they are not passed down to the C++
wrapper code. Fix that by passing them correctly to _build().
diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py
index e4d3d7b..7a736c9 100644
--- a/pyopencl/__init__.py
+++ b/pyopencl/__init__.py
@@ -114,7 +114,7 @@ def _add_functionality():
def program_build(self, options="", devices=None):
try:
- self._build()
+ self._build(options=options, devices=devices)
except Exception, e:
build_logs = []
for dev in self.devices:
Hi all,
I recently started wondering if there's a CL equivalent of CUDA's textures
bound to global GPU memory. After quite a bit of digging, I came up empty.
The idea is that you can read any old buffer object through the device's
texture unit, thereby making use of its cache--without having to copy the data
to an image first or being subject to an image's size constraints.
Any pointers would be much appreciated.
Thanks,
Andreas
On Freitag 18 September 2009, you wrote:
> Previously, when I just passed those python integers, I actually got a
> segfault, and the backtrace was being picked up by Apple's crash
> reporter.
Do you still have the backtraces from that? I'd like to gauge if it's
something that might come back and bite users.
Andreas
Hi, I am having trouble with the basic usage of pyopencl. What is the
GLOBAL_SIZE parameter to the kernel calls? I can't seem to find a
description of this in the documentation. Perhaps it would help if anybody
knows where a few example programs could be found, outside of the three that
are included with the source?
Here's my failed attempt to multiply two square matrices:
import sys
import pyopencl as cl
from numpy import *
N = int(sys.argv[1])
precision = int(sys.argv[2])
m1 = random.rand(N,N).astype('float%s' % precision)
m2 = random.rand(N,N).astype('float%s' % precision)
print "m1:\n",m1
print "m2:\n",m2
ctx = cl.create_context_from_type(cl.device_type.ALL)
queue = cl.CommandQueue(ctx)
mf = cl.mem_flags
a_buf = cl.Buffer(ctx, mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=m1)
b_buf = cl.Buffer(ctx, mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=m2)
dest_buf = cl.Buffer(ctx, mf.WRITE_ONLY, m2.nbytes)
prg = cl.Program(ctx, """
__kernel void multwo(__global float *a,
__global float *b,
__global float *c)
{
int row = get_global_id(1);
int col = get_global_id(0);
float sum = 0.0f;
for (int i = 0; i < %d; i++) {
sum += a[row*%d+i] * b[i*%d+col];
}
c[row*%d+col] = sum;
}
"""%(N,N,N,N)).build()
prg.multwo(queue, (N,N), a_buf, b_buf, dest_buf)
product = zeros([N,N],dtype='float%s' % precision)
cl.enqueue_read_buffer(queue, dest_buf, product).wait()
print product
I get a bogus result:
[[ 1.21239019e+002 9.03297802e-315 0.00000000e+000]
[ 0.00000000e+000 0.00000000e+000 0.00000000e+000]
[ 0.00000000e+000 0.00000000e+000 0.00000000e+000]]
Hello,
I am just looking at opencl for the first time today. Looks pretty
neat. I added the following lines to benchmark-all.py:
c_result2 = numpy.empty_like(a)
time1 = time()
c_result2 = a + b
c_result2 = c_result2 * (a + b)
c_result2 = c_result2 * (a / 2.0)
time2 = time()
print "Execution time of test without OpenCL, but with numpy: ", time2
- time1, "s"
To do the same calculations the way numpy was designed to do, and got
the following results (edited for readability):
Execution time of test without OpenCL: 23.8333249092 s
Execution time of test without OpenCL, but with numpy:
7.41481781006e-05 s
Execution time of test: 0.014881 s
The numpy way is quite a bit faster. My question is, is there a use
case where the use of opencl would overtake numpy for these types of
calculations? Or maybe I just have a sucky GPU? I don't know.
Craig
Thank you very much James.
The prob is i was using MacPython wich installs in /Library/Frameworks/
PyhonFrameworks and does not build in 64bit
macports python is only 64bit
when i know run the test i get test_wrapper.py Segmentation fault
Maybe i should recapitulate for SnowLeopard:
make sure /System/Library/Frameworks/Python.framework/ python is used
or that
that file which python outputs 3 architectures
/usr/bin/python: Mach-O universal binary with 3 architectures
/usr/bin/python (for architecture x86_64): Mach-O 64-bit executable
x86_64
/usr/bin/python (for architecture i386): Mach-O executable i386
/usr/bin/python (for architecture ppc7400): Mach-O executable ppc
build boost 1.40 by first vim tools/build/v2/tools/gcc.jam , :set
number , :+378, replace
378 option = -m64 ;
by
378 if $(model) = 32_64
379 {
380 }
381 else
382 {
383 option = -m64 ;
384 }
build with sudo ./bjam -j4 variant=release link=shared
architecture=x86 address-model=32_64 install
hi
Im trying to get started with PyOpenCL but am running into some
walls. Whenever I try to build the package either by using ./
configure ... make or python setup.py build I get the following error
Jake-Ross-Computer:pyopencl-0.91 Ross$ python setup.py build
running build
running build_py
running build_ext
building '_cl' extension
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-
madd -fno-common -dynamic -I/Library/Frameworks/Python.framework/
Versions/5.0.0/include -O3 -DNDEBUG -Isrc/cpp -I/Library/Frameworks/
Python.framework/Versions/5.0.0/lib/python2.5/site-packages/numpy/core/
include -I/Library/Frameworks/Python.framework/Versions/5.0.0/include/
python2.5 -c src/wrapper/wrap_cl.cpp -o build/temp.macosx-10.3-
i386-2.5/src/wrapper/wrap_cl.o -arch i386 -arch x86_64 -isysroot /
Developer/SDKs/MacOSX10.6.sdk
cc1plus: error: unrecognized command line option "-Wno-long-double"
cc1plus: error: unrecognized command line option "-Wno-long-double"
lipo: can't figure out the architecture type of: /var/folders/HR/
HR4MJfTvGmSHMD5GW6NlvU+++TI/-Tmp-//ccBx1lvA.out
error: command 'gcc' failed with exit status 1
I followed the instructions on the wiki to install Boost but always get
...failed updating 28 targets...
dont really know where to go from here. Im pretty excited to start
working with pyopencl so any help would be great
Thanks
Jake
Jake Ross
New Mexico Geochronology Research Laboratory
jirhiker(a)nmt.edu
jirhiker(a)gmail.com
575-835-5994 (office)
On Sep 15, 2009, at 3:14 PM, Jassin MEKNASSI wrote:
> /Developer/SDKs/MacOSX10.6.sdk/usr/local/lib is just a symlink link
> to /usr/local/lib.
> won't fix the prob
> thanks.
Ah, didn't realize that was a symlink.
DYLD_LIBRARY_PATH is definitely set on the shell you're running
"python test_wrapper.py" from?
You could check if that symbol it's looking for is exported by the
boost in /usr/local/lib/libboost_python.dylib:
dyldinfo -export /usr/local/lib/libboost_python.dylib | grep
__ZNK5boost6python7objects21py_function_impl_base9max_arityEv
-jsnyder
>
> On Sep 15, 2009, at 4:04 PM, James Snyder wrote:
>
>>
>> On Sep 15, 2009, at 1:55 PM, Andreas Klöckner wrote:
>>
>>> Hi Jassin,
>>>
>>> a) please don't email me directly. Instead, please use the mailing
>>> list.
>>>
>>> b) It looks like you have a boost version mismatch, i.e. the
>>> headers for the
>>> boost library which you are using for the compilation don't match
>>> the library
>>> that gets found at run time. Check for multiple installations of
>>> Boost.
>>
>> I concur, it looks as if you might have a version of boost being
>> found at link time and one being found later when dynamic lookup
>> takes place.
>>
>> If I had to guess, based on the compiler messages and the later
>> message, you're linking against an install of boost that went into
>> your 10.6 SDK directory (not sure why), and later it is using the
>> one from /usr/local/lib.
>>
>> You could check if the dynamic lookups work if you include /
>> Developer/SDKs/MacOSX10.6.sdk/usr/local/lib in your
>> DYLD_LIBRARY_PATH. I'm not sure if that's a good idea in the long
>> run though. I might remove the boost libraries & headers from the
>> SDK dir, make sure you have the correct version in /usr/local/lib
>> or wherever you wish to have them installed, and then try
>> rebuilding things.
>>
>>>
>>> HTH,
>>> Andreas
>>>
>>> On Dienstag 15 September 2009, you wrote:
>>>> hi i tried to install opencl under macosx 10.6.1 unfortunnatly when
>>>> starting the example i get :
>>>>
>>>> python test_wrapper.py
>>>> Traceback (most recent call last):
>>>> File "test_wrapper.py", line 205, in <module>
>>>> import pyopencl
>>>> File
>>>> "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
>>>> site-pack
>>>> ages/pyopencl-0.91-py2.6-macosx-10.3-fat.egg/pyopencl/
>>>> __init__.py", line 3,
>>>> in <module> import pyopencl._cl as _cl
>>>> ImportError:
>>>> dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/
>>>> python2.6/sit
>>>> e-packages/pyopencl-0.91-py2.6-macosx-10.3-fat.egg/pyopencl/
>>>> _cl.so, 2):
>>>> Symbol not found:
>>>> __ZNK5boost6python7objects21py_function_impl_base9max_arityEv
>>>> Referenced
>>>> from:
>>>> /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
>>>> site-packa
>>>> ges/pyopencl-0.91-py2.6-macosx-10.3-fat.egg/pyopencl/_cl.so
>>>> Expected in:
>>>> dynamic lookup
>>>>
>>>>
>>>>
>>>> during make i get :
>>>>
>>>> ld: warning: in
>>>> /Developer/SDKs/MacOSX10.6.sdk/usr/local/lib/
>>>> libboost_python.dylib, file
>>>> is not of required architecture ld: warning: in
>>>> /Developer/SDKs/MacOSX10.6.sdk/usr/local/lib/
>>>> libboost_thread.dylib, file
>>>> is not of required architecture
>>>>
>>>>
>>>> what is /Developer/SDKs/MacOSX10.6.sdk/usr/local/lib ?
>>
>> That architecture complaint may be OK. I think this may just be
>> because boost is built for x86_64 and the other libraries (OpenCL,
>> Python, etc..) are fat binaries with i386 and x86_64. I get the
>> complaint that the libboost_* libraries I'm using aren't of the
>> required architecture.
>>
>> I'm not sure why they're installed in that location though. My
>> 10.6 SDK doesn't have boost libraries there.
>>
>>>>
>>>> my specs are :
>>>>
>>>> gcc version 4.2.1 (Apple Inc. build 5646)
>>>> boost 1.40 /usr/local/include and /usr/local/lib
>>
>> Looks like you've got a version installed in /Developer/SDKs/
>> MacOSX10.6.sdk/usr/local/lib as well?
>>
>>>> Python 2.6.2
>>>> Numpy 1.3.0
>>>>
>>>> did the same way you described under the wiki
>>>>
>>>> python configure.py --boost-inc-dir=/usr/local/include
>>>> --boost-lib-dir=/usr/local/lib --boost-python-
>>>> libname=boost_python
>>>> --boost-thread-libname=boost_thread --cl-libname=''
>>>> --ldflags='-Wl,-framework,OpenCL' --boost-compiler='gcc42'
>>>>
>>>> echo $DYLD_LIBRARY_PATH : /usr/local/lib:/usr/local/cuda/lib
>>>>
>>>> Any idea?
>>>>
>>>>
>>>> thank you very much in advance. I m very exited about the
>>>> pyOpencl project
>>>>
>>>
>>> _______________________________________________
>>> PyOpenCL mailing list
>>> PyOpenCL(a)tiker.net
>>> http://tiker.net/mailman/listinfo/pyopencl_tiker.net
>>
>> --
>> James Snyder
>> Biomedical Engineering
>> Northwestern University
>> jbsnyder(a)fanplastic.org
>> http://fanplastic.org/key.txt
>> ph: 847.448.0386
>>
>>
>>
>>
>
--
James Snyder
Biomedical Engineering
Northwestern University
jbsnyder(a)fanplastic.org
http://fanplastic.org/key.txt
ph: 847.448.0386