Menu

Enabling ViennaCL GPU

2014-09-15
2014-09-16
  • Yaroslav V Bulatov

    I've been trying to get ViennaCL's GPU examples building and ran into some snags.
    I wanted to get ViennaCL working with a custom build system, and my plan was to try to get it working with Cmake, and then figure out the dependencies from build logs.

    1. By default none of the GPU examples get built. The tutorial says that instructions to enable OpenCL or Cuda are in in CMakeLists.txt, but I couldn't find these instructions in that file

    2. Then I tried to untangle the dependencies manually starting with rand.cpp example. However, I get following unresolved dependency rand/utils.hpp -> linalg/kernels/rand_kernels.h. I can not find rand_kernels.h anywhere, either 1.5.2 version or the latest version from git

     
  • Karl Rupp

    Karl Rupp - 2014-09-15

    OpenCL is enabled by default with CMake. The easiest way to customize the configuration is to run the CMake-GUI using
    $> cmake-gui ..
    from the build subfolder and toggle ENABLE_CUDA, ENABLE_OPENCL, ENABLE_OPENMP as needed.

    As for rand.cpp: That functionality has been removed, unfortunately we missed to remove the respective .cpp file in the examples folder. Please try any of the other examples, e.g. blas1.cpp. If you want to compile from the command line, run e.g.
    $ build> g++ ../examples/tutorial/blas1.cpp -I..
    to obtain a plain host-based execution. To enable OpenCL, pass -DVIENNACL_WITH_OPENCL. For CUDA, just use nvcc with -DVIENNACL_WITH_CUDA.

    Hope this helps :-)

     
  • Yaroslav V Bulatov

    Thanks, it helps
    I got 2 arbitrary examples (custom-context.cpp, custom-kernel.cpp) working on K40c with nvidia driver 340.29 by adding all the headers in viennacl and compiling with -DVIENNACL_WITH_OPENCL

    One minor annoyance, our systems don't build stuff with warnings by default, so I had to manually suppress this warning

    /viennacl/device_specific/templates/reduction_template.hpp:150:11: error: 'class viennacl::device_specific::reduction_template::generate_impl(const string&, const viennacl::device_specific::statements_container&, const std::vector<std::map<std::pair<long unsigned="" int,="" viennacl::device_specific::leaf_t="">, viennacl::tools::shared_ptr<viennacl::device_specific::mapped_object> > >&, unsigned int) const::loop_body' has virtual functions and accessible non-virtual destructor

     
  • Karl Rupp

    Karl Rupp - 2014-09-16

    Thanks for the feedback, Yaroslav.

    Am I correct that you used the viennacl-dev repository? Which compiler did you use? We usually clean up all warnings up to -Wextra on GCC and Clang for each release, so you might want to try the latest 1.5.2 release in the meanwhile.

    Best regards,
    Karli

     

Log in to post a comment.