That's probably because CMake on Ubuntu 14 doesn't come with a FindOpenCL.cmake.
You can probably work around it by transplanting a copy of that file from a 
newer version of CMake into the cmake modules directory.
The reason I kept that bit of logic around is because ViennaCL can work without 
an OpenCL backend as well, I wanted to force the check for existence of OpenCL.

I didn't have any AMD devices to test my code on, but the unit tests pass on 
Nvidia GPUs.
The failure of Gaussian, etc tests is a known issue on Intel CPUs and other 
OpenCL implementations such as POCL.
The main reason for the failure, is that Nvidia is apparently the only vendor 
to correctly align and transfer a 4-int32 struct.
I was hoping it would 'just work' with AMD but I guess they didn't do it right 
either...
I have a fix in mind, I should probably get around to it.

Regards,
TAN Li Boon

-----Original Message-----
From: [email protected] [mailto:[email protected]] 
Sent: Monday, November 21, 2016 10:01 PM
To: [email protected]
Subject: Fwd: Build from source with OpenCL

Hi all,

I'm trying to build Singa from source with OpenCL support on my Ubuntu
14.04 with AMD Radeon Mobility HD5650. Compilation and installation of ViennaCL 
works alright.
Trying cmake -DUSE_MODULES=ON -DUSE_PYTHON=ON -DUSE_OPENCL=ON ..
in the build directory gives me the error:

    "CMake Error at cmake/Dependencies.cmake:95 (FIND_PACKAGE):
      By not providing "FindOpenCL.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by
    "OpenCL", but
      CMake did not find one.

      Could not fi..."

although I set several paths in environment variables in .bashrc:

    export
    
CMAKE_INCLUDE_PATH=/opt/AMDAPPSDK-3.0/include:/usr/local/include:$CMAKE_INCLUDE_PATH
    export
    
CMAKE_LIBRARY_PATH=/opt/AMDAPPSDK-3.0/lib:/usr/local/lib/cmake/viennacl:$CMAKE_LIBRARY_PATH
    export
    
LD_LIBRARY_PATH="/opt/AMDAPPSDK-3.0/lib/x86:/opt/AMDAPPSDK-3.0/lib/x86_64:/usr/local/lib/cmake/viennacl":$LD_LIBRARY_PATH
    export PATH=~/Downloads/ViennaCL-1.7.1:$PATH
    export OpenCL_DIR="/opt/AMDAPPSDK-3.0:/usr/local/lib/cmake/viennacl"
    export OPENCL_ROOT_DIR=/opt/AMDAPPSDK-3.0
    export AMDAPPSDKROOT="opt/AMDAPPSDK-3.0"

Somewhere I found, that adding a line to the cmake/Dependencies.cmake:
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/usr/local/lib/cmake/viennacl") 
will help, and something changed while executing cmake -DUSE...

    "-- Found OPENCL: /usr/lib/x86_64-linux-gnu/libOpenCL.so
    CMake Error at cmake/Dependencies.cmake:97 (MESSAGE):
      OpenCL was requested, but not found."

So OpenCL was found but on the next line again not recognized.
A further hack of the Dependencies.cmake, commenting out the following
lines:
      FIND_PACKAGE(OpenCL REQUIRED)
      IF(NOT OpenCL_FOUND)
#        MESSAGE(SEND_ERROR "OpenCL was requested, but not found.")
#    ELSE()
         #MESSAGE(STATUS "Found OpenCL headers at ${OpenCL_INCLUDE_DIRS}")
         INCLUDE_DIRECTORIES(SYSTEM ${OpenCL_INCLUDE_DIR})

lead to a successful cmake and make compilation (although with much "unused 
variables" warnings).
Executing the unit tests with ./bin/test_singa then give me much code output 
and 3 failed tests:
    [  FAILED  ] OpenCL_TensorMath.Bernoulli
    [  FAILED  ] OpenCL_TensorMath.Gaussian
    [  FAILED  ] OpenCL_TensorMath.Uniform

So my question: Is it a problem of the cmake configuration or do I have i.e. 
only to add another directory to the environment variables or what is wrong? :)

Best regards,
Holger

Reply via email to