Author Topic: OpenCL vs. CUDA  (Read 24936 times)

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
OpenCL vs. CUDA
« on: 2009 April 29 06:57:49 »
Hi,

You may have read about OpenCL here http://www.khronos.org/opencl/ and here http://en.wikipedia.org/wiki/OpenCL . It promises to allow thread creation on both CPU and GPU which would allow PCL to spread the processing load across all available processing resources. CUDA is Nvidia specific and therefore less interesting for us. ATI is on board with OpenCL even if they don't have a driver yet. Nvidia already published the first version.

I've reviewed some of the documentation and it looks pretty straight forward to initialize buffers on the GPU, fill them, upload code to process the data and then retrieve the result. Clearly it won't make sense to process all data this way. The copy operations while fast (PCI-E DMA after all) are still an extra operation that can be skipped if the data is processed by the host CPU. It's also not quite clear to me how OpenCL allows you to use CPU and GPU as 'similar' resources. This all requires investigation. I'm starting this thread to gauge interest and see if anyone has experience in these matters already.

Juan suggested making this thread sticky but I don't have permission to do so.
« Last Edit: 2009 April 29 07:19:29 by Pleiades »
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: OpenCL vs. CUDA
« Reply #1 on: 2009 April 30 10:13:35 »
Sander,

I am watching the GP-GPU arena in my professional life as a software developer.

- It has a lot of potential, in particular if you algorithm is CPU bound and has a fairly simple control flow (such as many image processing algorithms)
- Memory bound algorithms can benefit as well, if they have simple access patterns (basically linear access).
- An important bottleneck currently is the data transfer between graphics card and main memory. If you have only short problems to compute on the GPU, this can kill any speedup.
- In some cases, it is necessary to design your implementation specifically for GPUs. Algorithms working well on normal CPUs (often tuned to optimize L2-cache access) sometimes dont work well on GPUs.

If you want to experiment with GPUs, I would stick to CUDA for the moment. The first OpenCL implementations lack maturity, and at the current stage OpenCL does not even have mandatory support for floats (see the spec, or http://de.wikipedia.org/wiki/OpenCL). Also, CUDA is sufficiently similar to OpenCL, so you should not have much trouble in moving to OpenCL later.

Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Nocturnal

  • PixInsight Jedi Council Member
  • *******
  • Posts: 2727
    • http://www.carpephoton.com
Re: OpenCL vs. CUDA
« Reply #2 on: 2009 April 30 10:26:17 »
Hi Georg,

thanks for your comments on this topic. I agree with your conclusions regarding suitability of GPU vs. CPU.

It'll be interesting to experiment with this stuff. Unfortunately my own machine has an ATI card but my work laptop has a discrete Nvidia chip that supports CUDA so I can at least play.
Best,

    Sander
---
Edge HD 1100
QHY-8 for imaging, IMG0H mono for guiding, video cameras for occulations
ASI224, QHY5L-IIc
HyperStar3
WO-M110ED+FR-III/TRF-2008
Takahashi EM-400
PIxInsight, DeepSkyStacker, PHD, Nebulosity

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: OpenCL vs. CUDA
« Reply #3 on: 2009 April 30 10:29:50 »
Make sure you install the latest driver on your laptop. See http://www.laptopvideo2go.com/ if your supplier does not provide one.

Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: OpenCL vs. CUDA
« Reply #4 on: 2009 September 21 03:45:55 »
Just to inform you about some news regarding this topic: I have now a CUDA-enabled nVidia driver installed and working for my Quadro FX 570 on my Fedora 11 workstation.

Don't expect CUDA-based features implemented in PixInsight very soon though, as we have lots and lots of priorities before this. But a first step has been made  8)
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Yuriy Toropin

  • PixInsight Addict
  • ***
  • Posts: 209
Re: OpenCL vs. CUDA
« Reply #5 on: 2010 March 27 04:05:26 »
As you probably have heard already, after half year delay NVidia finally released GTX 480 & 470 "Fermi"-based cards.
Here is the first report on performance in computing-intensive applciation (both Open CL & CUDA-based).
Benchmarks demonstrated significant jump over GTX 285 performance, 480 shaders do their job in GTX480 quite well...