On Sunday 02 March 2008 09:55:17 am Dylan Beaudette wrote:
On Sunday 02 March 2008 02:41:07 am Maciej Sieczka wrote:
> Dylan Beaudette pisze:
> > Some starters:
>
> Also look at Glynn's comments not so long time ago:
>
> http://www.nabble.com/forum/ViewPost.jtp?post=15573024&framed=y
>
> Maciek
Thanks for the reminder Maciek.
However, (although I am not a GPU programmer) it looks like the concept of
stream programming might fit into the GRASS approach of using simple
formulations over optimized ones-- and here is why:
many raster operations use constructs like the following:
for x in rows:
for y in cols:
get_cell_value(x,y,)
do_something(x,y, value)
end
end
Based on my reading of the GPGPU documents it appears that it is possible
to give the (libSh/Brook) library the do_something(x, y, value) function
(called a kernel in stream processing) and the GPU will limplicitly perform
the loop in parallel.
If the functionality used in the inner-most loop can be reduced to simple
operations, it shouldn't be too hard to "drop-in" GPGPU extensions.
Some more findings:
1. the Brook stream language relies on NVIDIA's Cg Compiler, which may not
work with anything but the latest video cards / drivers.
2. NVIDIA's CUDA SDK: this relies on very recent cards / drivers, and the
license agreement is a little vague. Also- code running on GPU's that are
used for display can only run for 5 seconds. Therefore real code running on
the GPU would require a secondary dedicated GPU that is not being used to
display anything.
3. libSh: this appears the be the most flexible/open implementation of GPGPU,
such that many NVIDIA/ATI cards are supported. It is a C++ extension, so
there is a deviation from the ANSI C standards used in GRASS.
I was able to compile libSh from their SVN source, after installing the
'freeglut3-dev' package (Debian/Unstable). The example files seem to compile
fine, although I cannot test them until I am back in my office. libSh and the
examples *seem* to be able to use my 4-yr old video card (GeForce FX
5600XT)-- so many of the cards in circulation should be supported by now.
The examples distributed with libSh are writted around standard GPU type
concepts -- streams of particles etc. There is a good page [1] which
describes the more general concept of implementing stream processing with
libSh.
1 .http://libsh.org/wiki/index.php/How_Sh_Works
Getting to the limit of my C++ knowledge, so I have not been able to create a
simple test case yet. There appears to be extensive documentation on the
available matrix/geometry/trig methods, but they are in such small snippets
that it would take someone with more experience to stitch them into a
complete program.
I wonder if Soren's groundwater flow routines could benefit from what libSh
has to offer?
Dylan
--
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341