Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have found a benchmark from computerbase.de (http://www.computerbase.de/artikel/grafikkarten/2013/intel-haswell-grafik-fuer-desktop-pcs-im-test/3/ in german) where in one case a task (here video transcoding) is done by the CPU and in the other case by the (integrated) GPU:

enter image description here

How can I assign a task (for example video transcoding) explicitly to the GPU in linux?

share|improve this question
4  
Well, first off, whatever application you want to run on the GPU would have to be in code that the GPU can run. That's not necessarily the same machine language as that of the CPU, which is a pretty serious hurdle for running a random task in the GPU. –  Michael Kjörling Jul 18 '13 at 20:52

1 Answer 1

up vote 3 down vote accepted

I think the best way to make use of your cores in GPU is to use OpenCL. The idea is quite simple. You write a kernel (a small block of code, where you can use only basic C code without libraries). For example, if you want to filter a frame, you have to do some calculations on each pixel and that is what the kernel code will do.

Then you have to compile the kernel, allocate the memory on GPU and copy data from the main memory there. You also have to allocate memory for the result. Then you create threads and send the kernel into execution on GPU (I think you can also use both CPU and GPU cores at once to execute kernels). So each thread executes the kernel once for every pixel. After you copy the result back to main memory and continue working with the CPU.

This is the simplest way I can explain this, but there is still a million details you have to know, so you better start learning ;) You can start with your graphics card manufacturer developer web site. There you will find the libraries and tutorials on how to start developing in OpenCL.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.