Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When writing openCL code, how does it perform on a single-core machine without a GPU?

Hey all, I Am currently porting a raytracer from FORTRAN 77 to C for a research project.

After having ported the essentials, the question is how we proceed to parallelization.
In the lab, I have access to a couple of different Opteron machines, with between 2 and 8 cores, but no GPUs (for now). We are running 64b gentoo.

A GPGPU version would be (very) desirable, but with only one programmer on the project, maintaining separate non-GPU and GPU versions isn't an option.
Also, the code will be GPLed, and we'd like to see it being used by others that may have vastly different hardware.

So the entire program has to be easy to compile/run without having a GPU or even a multicore system.
OpenCl seems like a good option, as it can be run on machines without GPUs, but how will this code perform on a single-core or 32b system?
Would it be possible to write the code in such a way that it can easily be compiled without openCL?

like image 637
Emanuel Ey Avatar asked Dec 28 '22 02:12

Emanuel Ey


1 Answers

Currently there are four major OpenCL implementations: AMD, nVidia (Cuda), Apple, Intel and there will be more soon probably: OpenCL implementations. OpenCL is not a language specifically targeted at GPU computing, it was designed as generic computing language for heterogeneous devices. E.g. you can use the AMD implementation even with no GPU and any non-AMD CPU (x86 of course).

Would it be possible to write the code in such a way that it can easily be compiled without openCL?

As you say it's a one man project I doubt it will be worth the effort.

How will this code perform on a single-core or 32b system?

As good as any native program would run. You have access to SIMD through OpenCL vector types. And you can handle the threading through the work group configuration.

But don't expect that you can get 100% performance out of every device with the same kernel/ work group settings. There's a lot of device specific tweaking possible (OpenCL CPU Tutorial for a start).

I would say go for OpenCL. It provides more possibilities for your application and it's platform independet.

like image 197
tauran Avatar answered Jan 14 '23 14:01

tauran