Comments on: Adventures in PyOpenCL: Part 1 Getting Started with Python http://enja.org/2011/02/22/adventures-in-pyopencl-part-1-getting-started-with-python/ casin' the joint since '85 Thu, 03 Mar 2016 20:39:33 +0000 hourly 1 https://wordpress.org/?v=4.4.2 By: Allan Douglas R. de Oliveira http://enja.org/2011/02/22/adventures-in-pyopencl-part-1-getting-started-with-python/comment-page-1/#comment-1932 Tue, 08 May 2012 03:40:40 +0000 http://enja.org/?p=424#comment-1932 pm,

You need to run the test 1000 times. Like:
time1 = time()
for i in range(1000):
c_result = (a + b) * (a + b) * (a / 2.0)
time2 = time()
print(“Execution time with numpy: “, time2 – time1, “s”)

You will see OpenCL performs better than NumPy (but NumPy is still pretty good, IMHO). On my machine:

(‘Execution time of test without OpenCL: ‘, 9.549367904663086, ‘s’)
(‘Execution time with numpy: ‘, 0.01725006103515625, ‘s’)
===============================================================
(‘Platform name:’, ‘Intel(R) OpenCL’)
(‘Platform profile:’, ‘FULL_PROFILE’)
(‘Platform vendor:’, ‘Intel(R) Corporation’)
(‘Platform version:’, ‘OpenCL 1.1 LINUX’)
—————————————————————
(‘Device name:’, ‘ Intel(R) Core(TM) i7-2630QM CPU @ 2.00GHz’)
(‘Device type:’, ‘CPU’)
(‘Device memory: ‘, 5864, ‘MB’)
(‘Device max clock speed:’, 2000, ‘MHz’)
(‘Device compute units:’, 8)
Execution time of test: 0.000382 s
Results OK
===============================================================
(‘Platform name:’, ‘NVIDIA CUDA’)
(‘Platform profile:’, ‘FULL_PROFILE’)
(‘Platform vendor:’, ‘NVIDIA Corporation’)
(‘Platform version:’, ‘OpenCL 1.1 CUDA 4.2.1’)
—————————————————————
(‘Device name:’, ‘GeForce GT 540M’)
(‘Device type:’, ‘GPU’)
(‘Device memory: ‘, 2047, ‘MB’)
(‘Device max clock speed:’, 1344, ‘MHz’)
(‘Device compute units:’, 2)
Execution time of test: 0.000624512 s
Results OK

]]>
By: Parallel programming in Python | TeachMeLinuxOnline official blog http://enja.org/2011/02/22/adventures-in-pyopencl-part-1-getting-started-with-python/comment-page-1/#comment-1709 Tue, 07 Feb 2012 03:07:14 +0000 http://enja.org/?p=424#comment-1709 […] great pointer to OpenCL programming in Python…   If you enjoyed this article, please consider sharing […]

]]>
By: pm http://enja.org/2011/02/22/adventures-in-pyopencl-part-1-getting-started-with-python/comment-page-1/#comment-1610 Fri, 13 Jan 2012 10:13:25 +0000 http://enja.org/?p=424#comment-1610 the benchmark you mention is so wrong.

you have to compare to numpy operations, not pure python on CPU.
with numpy you can write directly
c_result = (a + b) * (a+b) * (a/2)

my results:
(‘Execution time of test without OpenCL: ‘, 11.889606952667236, ‘s’)
(‘Execution time of test within numpy ‘, 0.00010013580322265625, ‘s’)
===============================================================
(‘Platform name:’, ‘NVIDIA CUDA’)
(‘Platform profile:’, ‘FULL_PROFILE’)
(‘Platform vendor:’, ‘NVIDIA Corporation’)
(‘Platform version:’, ‘OpenCL 1.1 CUDA 4.0.1’)
—————————————————————
(‘Device name:’, ‘Quadro NVS 290’)
(‘Device type:’, ‘GPU’)
(‘Device memory: ‘, 255L, ‘MB’)
(‘Device max clock speed:’, 918, ‘MHz’)
(‘Device compute units:’, 2)
Execution time of test: 0.0360267 s
Results OK

]]>
By: Adventures in OpenCL Part 3: Constant Memory Structs | enj http://enja.org/2011/02/22/adventures-in-pyopencl-part-1-getting-started-with-python/comment-page-1/#comment-768 Fri, 01 Apr 2011 21:52:24 +0000 http://enja.org/?p=424#comment-768 […] is just a slight adaption of my Part 1 (C++, Python) tutorial code, so check those out if you need help getting […]

]]>
By: Adventures in PyOpenCL: Part 2, Particles with PyOpenGL | enj http://enja.org/2011/02/22/adventures-in-pyopencl-part-1-getting-started-with-python/comment-page-1/#comment-726 Thu, 24 Mar 2011 15:17:10 +0000 http://enja.org/?p=424#comment-726 […] loadProgram is the same as in Part 1 where we simply read in the file to instantiate and build a program object. So lets skip that and […]

]]>
By: enj http://enja.org/2011/02/22/adventures-in-pyopencl-part-1-getting-started-with-python/comment-page-1/#comment-715 Sat, 19 Mar 2011 23:43:45 +0000 http://enja.org/?p=424#comment-715 @Al – thanks! installing with setuptools (easy_install) will work, but that note is for Mac users who want GL interop (which is only available in the latest source for now)

@David – thanks for that link. I’ve been planning on a tutorial about timing and what kind of things benefit from OpenCL. I’ll cover it after I writeup my Part 2 (OpenGL particles)

]]>
By: David http://enja.org/2011/02/22/adventures-in-pyopencl-part-1-getting-started-with-python/comment-page-1/#comment-714 Sat, 19 Mar 2011 20:35:19 +0000 http://enja.org/?p=424#comment-714 Hi Again:

I think I figured out the problem (thanks to a nice benchmark program I found online:http://git.tiker.net/pyopencl.git/blob_plain/HEAD:/examples/benchmark-all.py). Here’s the result.

Thanks again for the great work. I’m impressed at how easy it was to get this up and running. Nice job!

Cheers,

David.

(‘Execution time of test without OpenCL: ‘, 9.6666891574859619, ‘s’)
===============================================================
(‘Platform name:’, ‘Apple’)
(‘Platform profile:’, ‘FULL_PROFILE’)
(‘Platform vendor:’, ‘Apple’)
(‘Platform version:’, ‘OpenCL 1.0 (Dec 26 2010 12:52:21)’)
—————————————————————
(‘Device name:’, ‘ATI Radeon HD 6750M’)
(‘Device type:’, ‘GPU’)
(‘Device memory: ‘, 512L, ‘MB’)
(‘Device max clock speed:’, 150, ‘MHz’)
(‘Device compute units:’, 5)
Execution time of test: 0.0126587 s
Results OK
===============================================================
(‘Platform name:’, ‘Apple’)
(‘Platform profile:’, ‘FULL_PROFILE’)
(‘Platform vendor:’, ‘Apple’)
(‘Platform version:’, ‘OpenCL 1.0 (Dec 26 2010 12:52:21)’)
—————————————————————
(‘Device name:’, ‘Intel(R) Core(TM) i7-2720QM CPU @ 2.20GHz’)
(‘Device type:’, ‘CPU’)
(‘Device memory: ‘, 6144L, ‘MB’)
(‘Device max clock speed:’, 2200, ‘MHz’)
(‘Device compute units:’, 8)
Execution time of test: 0.00191466 s
Results OK

]]>
By: David http://enja.org/2011/02/22/adventures-in-pyopencl-part-1-getting-started-with-python/comment-page-1/#comment-713 Sat, 19 Mar 2011 20:15:36 +0000 http://enja.org/?p=424#comment-713 Hi:

Thanks for the great tutorial. This is a great toolkit and very easy to use. The only problem I have is that using pyopencl is *slower* than numpy! I’ve been struggling for the last few hours to find a combination of data size/kernel that would show the power of OpenCL. So far no luck..

Any thoughts? (Btw I’m using pyopencl on a MacBook Pro 2.2GHz, running python2.6, and the latest version of pyopencl).

Thanks,

David.

]]>
By: Al http://enja.org/2011/02/22/adventures-in-pyopencl-part-1-getting-started-with-python/comment-page-1/#comment-710 Wed, 16 Mar 2011 05:46:32 +0000 http://enja.org/?p=424#comment-710 Great` tutorial!
easy_install works fine on mac for pyopencl

The enthought python distro is an easy way to install a stack of packages (numpy, mathplot etc etc) no opencl in there yet.

Would love to get this working on gumstix overo and pandaboard.

Its a shame no python on iOS.

]]>
By: georgebastille http://enja.org/2011/02/22/adventures-in-pyopencl-part-1-getting-started-with-python/comment-page-1/#comment-686 Sun, 06 Mar 2011 23:43:49 +0000 http://enja.org/?p=424#comment-686 Brilliant tutorial, please put up more, I am really excited about using OpenCL with Python, seems like the perfect combination and your tutorial is really helpful, please please continue with part 1.5 (and the rest!)

Thank you

]]>