[GRASS-dev] Makefile arguments for OpenCL (r.sun)

Hi,

I am (finally) working a bit on r.sun OpenCL version.

On the computer I use, I could get through compiling it with:

-----
MODULE_TOPDIR = ../..

PGM = r.sun

LIBES = $(GPROJLIB) $(RASTERLIB) $(GISLIB) $(MATHLIB) $(PROJLIB)
-lOpenCL -Wall -W -g -p -O2
DEPENDENCIES = $(GPROJDEP) $(RASTERDEP) $(GISDEP)
EXTRA_INC = $(PROJINC) -Wall -O2 -W -g -p -I/opt/cuda/include

include $(MODULE_TOPDIR)/include/Make/Module.make

default: cmd
-----

Seth Makefile had already "-lOpenCL -Wall -W -g -p -O2" in LIBES

Had to add "-I/opt/cuda/include" for some reason the GRASS configure
was positive in finding it, surely missing something here...

Yann wrote:

I am (finally) working a bit on r.sun OpenCL version.

On the computer I use, I could get through compiling it with:

-----
MODULE_TOPDIR = ../..

PGM = r.sun

LIBES = $(GPROJLIB) $(RASTERLIB) $(GISLIB) $(MATHLIB) $(PROJLIB)
-lOpenCL -Wall -W -g -p -O2
DEPENDENCIES = $(GPROJDEP) $(RASTERDEP) $(GISDEP)
EXTRA_INC = $(PROJINC) -Wall -O2 -W -g -p -I/opt/cuda/include

include $(MODULE_TOPDIR)/include/Make/Module.make

default: cmd
-----

Seth Makefile had already "-lOpenCL -Wall -W -g -p -O2" in LIBES

Had to add "-I/opt/cuda/include" for some reason the GRASS configure
was positive in finding it, surely missing something here...

trunk$ ./configure --help
...
--with-opencl support OpenCL functionality (default: no)
...
--with-opencl-includes=DIRS
OpenCL include files are in DIRS
--with-opencl-libs=DIRS OpenCL library files are in DIRS

what did your ./configure look like? what linux distro + version?
what kind of video card? (I take it nVidia of some version based on
the /opt/cuda) How much RAM does your video card have? Does it
support double precision FP for the GPU?

note CUDA SDK != OpenCL SDK, but nVidia's proprietary driver on
Linux ships with OpenCL support files by default AFAIK.

On Linux, it is looking for the include file CL/cl.h. For me on an
ubuntu system with the nVidia proprietary driver, that is at
/usr/include/nvidia-current/CL/cl.h

Additionally, on Linux ./configure is looking for libOpenCL, for me
that is at /usr/lib/nvidia-current/libOpenCL.so with symlinks
back into /usr/lib/libOpenCL.so. (I may have made that symlink by
hand, can't remember)

note the r.sun OpenCL code has not been merged from Seth's repo yet,
only the build support is in place so far. But it should make it
easier to experiement with.

regards,
Hamish

On 25 June 2013 02:17, Hamish <hamish_b@yahoo.com> wrote:

Yann wrote:

I am (finally) working a bit on r.sun OpenCL version.

On the computer I use, I could get through compiling it with:

-----
MODULE_TOPDIR = ../..

PGM = r.sun

LIBES = $(GPROJLIB) $(RASTERLIB) $(GISLIB) $(MATHLIB) $(PROJLIB)
-lOpenCL -Wall -W -g -p -O2
DEPENDENCIES = $(GPROJDEP) $(RASTERDEP) $(GISDEP)
EXTRA_INC = $(PROJINC) -Wall -O2 -W -g -p -I/opt/cuda/include

include $(MODULE_TOPDIR)/include/Make/Module.make

default: cmd
-----

Seth Makefile had already "-lOpenCL -Wall -W -g -p -O2" in LIBES

Had to add "-I/opt/cuda/include" for some reason the GRASS configure
was positive in finding it, surely missing something here...

trunk$ ./configure --help
...
  --with-opencl support OpenCL functionality (default: no)
...
  --with-opencl-includes=DIRS
                          OpenCL include files are in DIRS
  --with-opencl-libs=DIRS OpenCL library files are in DIRS

what did your ./configure look like? what linux distro + version?
what kind of video card? (I take it nVidia of some version based on
the /opt/cuda) How much RAM does your video card have? Does it
support double precision FP for the GPU?

note CUDA SDK != OpenCL SDK, but nVidia's proprietary driver on
Linux ships with OpenCL support files by default AFAIK.

On Linux, it is looking for the include file CL/cl.h. For me on an
ubuntu system with the nVidia proprietary driver, that is at
  /usr/include/nvidia-current/CL/cl.h

Additionally, on Linux ./configure is looking for libOpenCL, for me
that is at /usr/lib/nvidia-current/libOpenCL.so with symlinks
back into /usr/lib/libOpenCL.so. (I may have made that symlink by
hand, can't remember)

note the r.sun OpenCL code has not been merged from Seth's repo yet,
only the build support is in place so far. But it should make it
easier to experiement with.

regards,
Hamish

Hi Hamish,

Machine is hosted as a GPU cluster, NVIDIA 4.1 (OpenCL is there), Tesla GPU.

Configure was with:
--with-opencl --with-opencl-includes=/opt/cuda/include

so all good, but the libs (will add that), but does not help the
include not found (-I/usr/cuda/include in Makefile...), on this
machine it is CL/opencl.h

Will take all your suggestions and look into it,
Thanks,
Yann

--
----

Yann wrote:

Machine is hosted as a GPU cluster, NVIDIA 4.1 (OpenCL is there), Tesla GPU.

nice, something real to test it on. :slight_smile:

Configure was with:
--with-opencl --with-opencl-includes=/opt/cuda/include

so all good, but the libs (will add that), but does not help the
include not found (-I/usr/cuda/include in Makefile...), on this
machine it is CL/opencl.h

After ./configure, in include/Make/Platform.make what do these settings say?

#OpenCL
OCLINCPATH =
OCLLIBPATH =
OCLLIB =
USE_OPENCL =

If it is set ok there then we need to do something more than just set
EXTRA_INC = $(PROJINC) $(OCLINCPATH)
in r.sun's Makefile.

re. the libs, see also the "needed?" comment in the Makefile. Maybe
one of those need to be enabled.

thanks,
Hamish