[GRASS-dev] [GRASS GIS] #1446: add --with-opencl support to ./configure

#1446: add --with-opencl support to ./configure
------------------------------------------------+---------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: task | Status: new
Priority: major | Milestone: 7.0.0
Component: Compiling | Version: svn-trunk
Keywords: OpenCL, configure, smp, gpu, r.sun | Platform: All
      Cpu: All |
------------------------------------------------+---------------------------
This is akin to task #657 (add --with-openmp support to ./configure),
which I still am very keen to see happen as we already have OpenMP-aware
code in trunk. See that report for a basic summary & philosophy of
approach.

For now the OepnCL support would mainly be used for Seth's 2010 GSoC
project to make r.sun use OpenCL, making it some hundreds of times faster,
which we'd like to merge into trunk in the near future.

note that even if you don't have a fancy GPU the OpenCL spec allows you to
run the code on a multi-core CPU instead, so it's still nice. (maybe even
both multi-core CPU '''and''' GPU ??)

any help with the autoconf magic would be greatly appreciated.

thanks,
Hamish

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1446&gt;
GRASS GIS <http://grass.osgeo.org>

+1 for OpenMP standard support
+1 for OpenCL standard support

-----Original Message-----
From: grass-dev-bounces@lists.osgeo.org on behalf of GRASS GIS
Sent: Thu 9/8/2011 2:57 PM
To: undisclosed-recipients
Subject: [GRASS-dev] [GRASS GIS] #1446: add --with-opencl support to./configure

#1446: add --with-opencl support to ./configure
------------------------------------------------±--------------------------
Reporter: hamish | Owner: grass-dev@.
Type: task | Status: new
Priority: major | Milestone: 7.0.0
Component: Compiling | Version: svn-trunk
Keywords: OpenCL, configure, smp, gpu, r.sun | Platform: All
Cpu: All |
------------------------------------------------±--------------------------
This is akin to task #657 (add --with-openmp support to ./configure),
which I still am very keen to see happen as we already have OpenMP-aware
code in trunk. See that report for a basic summary & philosophy of
approach.

For now the OepnCL support would mainly be used for Seth’s 2010 GSoC
project to make r.sun use OpenCL, making it some hundreds of times faster,
which we’d like to merge into trunk in the near future.

note that even if you don’t have a fancy GPU the OpenCL spec allows you to
run the code on a multi-core CPU instead, so it’s still nice. (maybe even
both multi-core CPU ‘’‘and’‘’ GPU ??)

any help with the autoconf magic would be greatly appreciated.

thanks,
Hamish


Ticket URL: <http://trac.osgeo.org/grass/ticket/1446>
GRASS GIS <http://grass.osgeo.org>

#1446: add --with-opencl support to ./configure
------------------------------------------------+---------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: task | Status: new
Priority: major | Milestone: 7.0.0
Component: Compiling | Version: svn-trunk
Keywords: OpenCL, configure, smp, gpu, r.sun | Platform: All
      Cpu: All |
------------------------------------------------+---------------------------

Comment(by hamish):

I've got these headers in the /opt/AMDAPP/include/CL directory; which
should we search for as part of the ./configure --with-opencl check?

{{{
cl.h
cl.hpp
cl_ext.h
cl_gl.h
cl_gl_ext.h
cl_platform.h
opencl.h
}}}

my i7 3770 intel driver is not a Xeon, so no OpenCL support for linux yet,
and my nvidia system + proprietary driver supplies:
{{{
/usr/lib/libOpenCL.so
/usr/include/nvidia-current/CL/cl.h
/usr/include/nvidia-current/CL/cl_platform.h
/usr/include/nvidia-current/CL/cl_gl.h
}}}

from the nvidia-current-dev package.

so the 3 header files from the nvidia package seem to be the common ones
to check for. maybe cl.h is enough to look for?

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1446#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1446: add --with-opencl support to ./configure
------------------------------------------------+---------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: task | Status: new
Priority: major | Milestone: 7.0.0
Component: Compiling | Version: svn-trunk
Keywords: OpenCL, configure, smp, gpu, r.sun | Platform: All
      Cpu: All |
------------------------------------------------+---------------------------

Comment(by hamish):

Hi,

before touching configure.in, I notice there are a number of recent edits
to configure which were done out of sync with configure.in. As soon as I
run autoconf2.13 they'll be lost. :frowning:

  https://trac.osgeo.org/grass/log/grass/trunk/configure
  https://trac.osgeo.org/grass/log/grass/trunk/configure.in

?,
Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1446#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1446: add --with-opencl support to ./configure
------------------------------------------------+---------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: task | Status: new
Priority: major | Milestone: 7.0.0
Component: Compiling | Version: svn-trunk
Keywords: OpenCL, configure, smp, gpu, r.sun | Platform: All
      Cpu: All |
------------------------------------------------+---------------------------

Comment(by neteler):

Replying to [comment:2 hamish]:
> before touching configure.in, I notice there are a number of recent
edits to configure which were done out of sync with configure.in. As soon
as I run autoconf2.13 they'll be lost. :frowning:

Concretely: r55521, r55487, r55487 (FreeBSD, netbsd, Solaris, AIX
support), they
need to be implemented in configure.in. From that configure has to be
generated
with autoconf-2.13.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1446#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1446: add --with-opencl support to ./configure
------------------------------------------------+---------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: task | Status: new
Priority: major | Milestone: 7.0.0
Component: Compiling | Version: svn-trunk
Keywords: OpenCL, configure, smp, gpu, r.sun | Platform: All
      Cpu: All |
------------------------------------------------+---------------------------

Comment(by hamish):

r55413 too, "Remove unused variables"

(but maybe the mods to aclocal.m4 and Platform.make.in get included so no
change in configure.in needed for that one?)

thanks,
Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1446#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1446: add --with-opencl support to ./configure
------------------------------------------------+---------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: task | Status: new
Priority: major | Milestone: 7.0.0
Component: Compiling | Version: svn-trunk
Keywords: OpenCL, configure, smp, gpu, r.sun | Platform: All
      Cpu: All |
------------------------------------------------+---------------------------

Comment(by mmetz):

Replying to [comment:3 neteler]:
> Replying to [comment:2 hamish]:
> > before touching configure.in, I notice there are a number of recent
edits to configure which were done out of sync with configure.in. As soon
as I run autoconf2.13 they'll be lost. :frowning:
>
> Concretely: r55521, r55487, r55487 (FreeBSD, netbsd, Solaris, AIX
support), they
> need to be implemented in configure.in.

These were implemented in aclocal.m4.

> From that configure has to be generated
> with autoconf-2.13.

Configure '''was''' generated with autoconf-2.13 after changing
aclocal.m4. Are you sure that configure.in needs to be touched for support
of different platforms?

Markus M

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1446#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1446: add --with-opencl support to ./configure
------------------------------------------------+---------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: task | Status: new
Priority: major | Milestone: 7.0.0
Component: Compiling | Version: svn-trunk
Keywords: OpenCL, configure, smp, gpu, r.sun | Platform: All
      Cpu: All |
------------------------------------------------+---------------------------
Changes (by hamish):

* cc: sprice (added)

Comment:

Replying to [comment:5 mmetz]:
> Are you sure that configure.in needs to be touched for support of
different
> platforms?

nope!

In that case, proceeding...

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1446#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#1446: add --with-opencl support to ./configure
------------------------------------------------+---------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: task | Status: new
Priority: major | Milestone: 7.0.0
Component: Compiling | Version: svn-trunk
Keywords: OpenCL, configure, smp, gpu, r.sun | Platform: All
      Cpu: All |
------------------------------------------------+---------------------------

Comment(by hamish):

OpenCL infrastructure support added to configure[.in],
include/Make/Platform.make, and raster/r.sun/Makefile,main.c in r55949,50.

It could do with a little more work,
  - my libOpenCL.so is in /opt and listed in '`ldconfig -p`', but
autoconf's gcc conftest doesn't find -lOpenCL. Symlinking into
/usr/local/lib works, but why is that needed?
  - OCLLIBPATH is not being set from --with-opencl-libs= (see trac #1943)
  - to use LOC_CHECK_FUNC(,LOC_CHECK_LIBS()) or just LOC_CHECK_LIBS()?
  - remove unused variables from r.sun's Makefile

have fun,
Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1446#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>