Skip to content

Instantly share code, notes, and snippets.

@jyegerlehner
Last active November 19, 2016 17:27
Show Gist options
  • Save jyegerlehner/d184bf65bbc280fdd277 to your computer and use it in GitHub Desktop.
Save jyegerlehner/d184bf65bbc280fdd277 to your computer and use it in GitHub Desktop.
Build issues
1) #include <tuple> requires c++11, added compiler flag not specified in CMakeLists.txt.
2) -DUSE_GREENTEA -DVIENNACL_WITH_OPENCL not defined in CMakelists.txt
3) libviennacl required (though ViennaCL claims to be header-only). Get viennacl from github,
build to create the library, fix cmake files because it was hopelessly unable to find the
OpenCL installation, copy in libviennacl.so and .h to /usr/local/*.
Modify caffe cmake files to find the library and header.
4) undefined reference Caffe::GetDeviceCOntext because CPU_ONLY is defined,
though not in the cmake file. Due to:
if(NOT HAVE_CUDA)
set(HAVE_CUDA FALSE)
list(APPEND Caffe_DEFINITIONS -DCPU_ONLY)
endif()
in ConfigGen.cmake and in Dependencies.cmake. Commented the above Cmake code out.
5) On this OpenCL-only machine there is no CUDA.
So this stuff in device_alternate.hpp fails to compile:
#include <cublas_v2.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <curand.h>
#include <driver_types.h> // cuda driver types
Seems like an OpenCL port ought to have a way to build on a machine without Cuda.
6) What combinations of various flags USE_GREENTEA, VIENNACL_WITH_OPENCL, CPU_ONLY are meant to be valid?
7) How is this meant to be able to build for clBlas instead of vienna cl? I started out trying that
since I already had clBlas installed. But saw code depending on ViennaCLBackend or some
such that required libviennacl.so.
@naibaf7
Copy link

naibaf7 commented Apr 21, 2015

  1. CMakeLists not uptodate yet, only Makefile is working as intended (WIP).
  2. See 1)
  3. libviennacl and ViennaCL are two different things. ViennaCL is used for its highlevel convenience functions over OpenCL, which would have to be re-written otherwise. libviennacl is a lowlevel BLAS1,2,3 library, and can be used as an alternative to clBLAS. It definitely is slower than clBLAS on AMD hardware, but may be useful as a fallback and usually delivers good performance on CPUs.
  4. see 1)
  5. Currently working on it, thanks. I will redirect the CU files to g++ instead of nvcc in the OpenCL-only build version, and exclude CUDA specific code with #ifdef tags (WIP).
  6. & 7) CPU_ONLY will/should disable both the OpenCL and CUDA backend. USE_GREENTEA requires VIENNACL_WITH_OPENCL, and USE_VIENNACLBLAS (xor) USE_CLBLAS can be used to select the OpenCL-BLAS-Backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment