Live data from Hacker News

Ask HN: How to learn OpenCL

news.ycombinator.com

1–10 of 17 posts

Ask HN: How to learn OpenCL

#1
OpenCL seems to only have minimal examples, and although there is a fair to good amount of documentation, I feel the need to ask if there are any good books/tutorials on how to use/learn OpenCL?

Re: Ask HN: How to learn OpenCL

#2
Intel and AMD both have some good documentation on their site for getting going with OpenCL, so that's a good place to start. For example:

http://developer.amd.com/tools-and-sdks/heterogeneous-comput...

The Khronos website has a huge page with a list of OpenCL tutorials and books:

https://www.khronos.org/opencl/resources

Amazon has a number of OpenCL books available:

* http://www.amazon.com/OpenCL-Action-Accelerate-Graphics-Comp...

* http://www.amazon.com/Heterogeneous-Computing-OpenCL-Second-...

* http://www.amazon.com/OpenCL-Programming-Guide-Aaftab-Munshi...

This book is available on Amazon but the previous edition is available for free:

http://www.fixstars.com/en/opencl/book/

Intel's website also has some "Getting Started" articles and optimization guides for OpenCL (for CPU, GPU, and Xeon Phi):

http://software.intel.com/en-us/vcsource/tools/opencl

Re: Ask HN: How to learn OpenCL

#4

Mess around with open-source applications (such as Rodinia benchmark suite and NAS parallel benchmarks) after going through the basic tutorials on AMD, Intel and Nvidia webpages.

A good open-source OpenCL application might be cgminer or bfgminer, might have to get an older version though, it looks like the latest ones have abandoned OpenCL/GPU support.

Re: Ask HN: How to learn OpenCL

#5

Intel and AMD both have some good documentation on their site for getting going with OpenCL, so that's a good place to start. For example: http://developer.amd.com/tools-and-sdks/heterogeneous-comput... The Khronos website has a huge page with a list of OpenCL tutorials and books: https://www.khronos.org/opencl/resources Amazon has a number of OpenCL books available: * http://www.amazon.com/OpenCL-Action-Accelerate-G…

This is just a small sample of the OpenCL kernels available in the AMD SDK (it runs everywhere, at least it did last time I checked).

  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/AESEncryptDecrypt_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/BinarySearch_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/BinomialOption_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/BitonicSort_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/BlackScholesDP_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/BlackScholes_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/BoxFilterGL_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/BoxFilter_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/BufferBandwidth_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/ConstantBandwidth_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/DCT_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/DeviceFission_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/DwtHaar1D_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/EigenValue_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/FFT_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/FastWalshTransform_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/FloydWarshall_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/FluidSimulation2D_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/GaussianNoise_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/GlobalMemoryBandwidth_Kernels.cl
  AMD-APP-SDK-v2.4-lnx64/samples/opencl/bin/x86/HelloCL_Kernels.cl
I'd hook into OpenCL from the high level language of your choice. Look at

* http://mathema.tician.de/software/pyopencl/

* http://www.drdobbs.com/open-source/easy-opencl-with-python/2...

Or JRuby or Jython with https://code.google.com/p/aparapi/ (still have to write your inner kernel in .java and send that to aparapi)

If you go the "whole-stack-in-c" route much of your time will be spent doing memory operations.

Re: Ask HN: How to learn OpenCL

#6
If you're a complete beginner in data parallel programming, and you're having trouble finding good intro material for OpenCL, it might almost be worthwhile to check out CUDA instead. In terms of the programming model, OpenCL and CUDA are identical - significant differences don't come about until you start optimizing for specific devices.

I learned CUDA first on my own, and then took an OpenCL class and found that the whole first section was completely redundant. There's also a pretty great wealth of CUDA material online and a few published books if that's your sort of thing.

Re: Ask HN: How to learn OpenCL

#7

Mess around with open-source applications (such as Rodinia benchmark suite and NAS parallel benchmarks) after going through the basic tutorials on AMD, Intel and Nvidia webpages.

A good open-source OpenCL application might be cgminer or bfgminer, might have to get an older version though, it looks like the latest ones have abandoned OpenCL/GPU support.

Any idea why they abandoned it? CPU-only mining seems to be kinda pointless these days...

Re: Ask HN: How to learn OpenCL

#8
post #7

Earlier quoted context omitted.

A good open-source OpenCL application might be cgminer or bfgminer, might have to get an older version though, it looks like the latest ones have abandoned OpenCL/GPU support.

Any idea why they abandoned it? CPU-only mining seems to be kinda pointless these days...

Cgminer and bfgminer are focused on usb based ASIC miners now. Bfgminer still supports cpu and gpu mining, it's just unsupported and not compiled by default.

Re: Ask HN: How to learn OpenCL

#10
post #9

Perhaps Apple's documentation and WWDC video might be of help: https://developer.apple.com/opencl/ To watch the video you need to be a registered Apple developer.

To clarify -- you can read the documentation and code samples without having to register as an Apple Developer. You only need to do that to watch the tutorial videos or access the developer forums.
Post reply on HN