[GRASS-dev] Parallel computing for r.sun

Hamish hamish_b at yahoo.com
Tue Jan 29 23:37:05 PST 2013


Hamish wrote:
>> the first step is to get support for OpenCL build into grass7's
>> ./configure next to pthreads and OpenMP which are already there.
>> I welcome help with that, my copious free time hasn't been
>> very good lately.

Yann wrote:
> I am heading to the code sprint in Genoa on Sunday,
> Could you spend a little time explaining me the directions
> to do that? (URL, PDF, anything welcome)

basically I'd start with the OpenMP part of configure.in and
duplicate + modify from there. You'll want to allow it to accept
options for the libs dir and the includes dir, and test for the
various headers and libraries needed. Just sticking with the C
headers to begin with (but r.viewshed might like the C++ ones
too, and be the best next canditate for GPU support after r.sun),
the AMD/ATI SDK includes I'd look for are CL/cl.h and CL/opencl.h,
and the shared *nix library is called libOpenCL.so(.1).

You'll see in the trunk/lib/gmath/ Makefile the adding of
$(OMPLIB) and $(OMPCFLAGS). The difference there though is
that OpenMP mainly uses #pragma macros and not specific function
calls, so maybe look at the pthreads support in r.mapcalc's
Makefile and map.c for some inspiration. Perhaps Soeren and
Glynn can comment a bit more.


The intel Ivy Bridge GPU drivers only provide the OpenCL on Linux
for Xeon chips, but you can do OpenCL+CPU there, or OpenCL+GPU+CPU
on the Windows7/8 side of things. Because of that I didn't bother
to download their SDK and see what they were calling the headers
and the libs. Maybe Khronos specify standard names, if so that
would make things easier and we can assume they'll always be
the same as the names that AMD uses. I've no idea about Mac and
MS Windows build environments, but from the forum chatter I take
it that Apple have done a nice job supporting it.

On the nVidia side I'd have to update the driver on a working
machine, so I didn't bother looking into that, but someone else
with one of those might post what headers and libs are available.
It's a bit easier at runtime since the newer nVidia drivers have
all the OpenCL support built in. Lots of their help pages just
redirect to CUDA and high level marketing stuff, so I found it
a bit confusing to find what you're looking for.


.. and finally make sure to use autoconf2.13 when compiling
configure.in to 'configure', not a newer one.


thanks,
Hamish


ps- I'd encourage all the fine folks heading to the code-a-thon
to help test things on the OSGeo Live GIS DVD, as we're just
getting ready for final testing on that. There'll be a 48 hr
test-a-thon starting soon (thursday), but an extended dance
version coming live from Italy a few days later would be very
welcome too:
  http://lists.osgeo.org/pipermail/live-demo/2013-January/006960.html
(just wait a few hours from now for the 6.5beta2 iso to be posted)
especially with a good collection of translation-able GISers on
hand.


More information about the grass-dev mailing list