Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCL: Running CPU/GPU multiple devices

Tags:

opencl

I want to run parallel tasks on GPU and CPU with OpenCL multiple devices. The standard examples from AMD SDK are not very clear on this subject. Can you advise any additional tutorials or examples on this subject? Any advice will do.

Thank you.

like image 385
Inso Reiges Avatar asked Apr 13 '11 10:04

Inso Reiges


2 Answers

Running parallel tasks on multiple devices requires dynamic scheduling for good effeciency because you never know exact performance of any device - it depends from current load (not only by your program but all others too), current clock (it may change significantly on most CPUs and GPUs depending on current energy saving profile or load). Also, real-world performance may depend on your input data.

Of course, you can write all neccessary code yourself like all other answers suggest, but in my opinion it is waste of time and it is much better idea to use existing solution. I recommend to use StarPU. I have used StarPU in my OpenCL project and it worked pretty well. StarPU comes with examples how to write code capable of using multiple GPUs and CPUs efficiently.

StarPU:

Traditional processors have reached architectural limits which heterogeneous multicore designs and hardware specialization (e.g. coprocessors, accelerators, ...) intend to address. However, exploiting such machines introduces numerous challenging issues at all levels, ranging from programming models and compilers to the design of scalable hardware solutions. The design of efficient runtime systems for these architectures is a critical issue. StarPU typically makes it much easier for high performance libraries or compiler environments to exploit heterogeneous multicore machines possibly equipped with GPGPUs or Cell processors: rather than handling low-level issues, programmers may concentrate on algorithmic concerns.

There is also another project, SkePU, but I did not try it myself:

SkePU:

SkePU is such a skeleton programming framework for multicore CPUs and multi-GPU systems. It is a C++ template library with six data-parallel and one task-parallel skeletons, two container types, and support for execution on multi-GPU systems both with CUDA and OpenCL. Recently, support for hybrid execution, performance-aware dynamic scheduling and load balancing is developed in SkePU by implementing a backend for the StarPU runtime system.

If you Google for "dynamic scheduling gpu cpu opencl" you can find even more possibly useful free or commercial projects and documentation.

like image 119
Lissanro Rayen Avatar answered Sep 28 '22 10:09

Lissanro Rayen


For tutorial and details on using multiple devices, you may want to refer section 4.12 of the AMD-APP-SDK Programming guide

like image 42
Divij Avatar answered Sep 28 '22 10:09

Divij