0

I am trying to install OpenCL for BEAGLE. First, I have downloaded intel_sdk_for_opencl_applications_2020.3.494.tar.gz from here. Then I unzipped it & run install.sh. Installation was successful. I have BEAGLE installed so I have decided to go to build folder in beagle-lib & run cmake -DCMAKE_INSTALL_PREFIX:PATH=$HOME .. in order to go on to run make install but I get the next message:

-- JAVA_HOME=
-- JNI_INCLUDE_DIRS=/usr/lib/jvm/java/include;/usr/lib/jvm/java/include/linux;/usr/lib/jvm/java/include
-- JNI_LIBRARIES=/usr/lib/jvm/java/lib/libjawt.so;/usr/lib/jvm/java/lib/server/libjvm.so
-- Not using libtools for plugins
-- Could NOT find OpenCL (missing: OpenCL_LIBRARY OpenCL_INCLUDE_DIR)
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY)
-- Configuring done
-- Generating done
-- Build files have been written to: /export/home/rinkman/beagle-lib/build

I have tried to set variables both environmental & shell to

OpenCL_LIBRARY=~/intel/system_studio_2020/opencl/SDK/include/CL/cl.h

OpenCL_INCLUDE_DIR=True

But the result of running cmake is the same. I have verified that variables were set up right. So I cannot understand what is wrong. I want to use OpenCL framework in BEAGLE when I am running BEAST 2 software. Please, could anyone help with this?

P.S. I am a noviciate in Linux.

My result of running beast -beagle-info:

                        BEAST v2.6.6, 2002-2021
             Bayesian Evolutionary Analysis Sampling Trees
                       Designed and developed by
 Remco Bouckaert, Alexei J. Drummond, Andrew Rambaut & Marc A. Suchard

                   Centre for Computational Evolution
                         University of Auckland
                       r.bouckaert@auckland.ac.nz
                        alexei@cs.auckland.ac.nz

                   Institute of Evolutionary Biology
                        University of Edinburgh
                           a.rambaut@ed.ac.uk

                    David Geffen School of Medicine
                 University of California, Los Angeles
                           msuchard@ucla.edu

                      Downloads, Help & Resources:
                           http://beast2.org/

  Source code distributed under the GNU Lesser General Public License:
                   http://github.com/CompEvol/beast2

                           BEAST developers:
   Alex Alekseyenko, Trevor Bedford, Erik Bloomquist, Joseph Heled,
 Sebastian Hoehna, Denise Kuehnert, Philippe Lemey, Wai Lok Sibon Li,
Gerton Lunter, Sidney Markowitz, Vladimir Minin, Michael Defoin Platel,
          Oliver Pybus, Tim Vaughan, Chieh-Hsi Wu, Walter Xie

                               Thanks to:
          Roald Forsberg, Beth Shapiro and Korbinian Strimmer


--- BEAGLE RESOURCES ---

0 : CPU
    Flags: PRECISION_SINGLE PRECISION_DOUBLE COMPUTATION_SYNCH EIGEN_REAL EIGEN_COMPLEX SCALING_MANUAL SCALING_AUTO SCALING_ALWAYS SCALERS_RAW SCALERS_LOG VECTOR_SSE VECTOR_NONE THREADING_NONE PROCESSOR_CPU FRAMEWORK_CPU

One on my computer with Windows for comparison:

                        BEAST v2.6.6, 2002-2021
             Bayesian Evolutionary Analysis Sampling Trees
                       Designed and developed by
 Remco Bouckaert, Alexei J. Drummond, Andrew Rambaut & Marc A. Suchard

                   Centre for Computational Evolution
                         University of Auckland
                       r.bouckaert@auckland.ac.nz
                        alexei@cs.auckland.ac.nz

                   Institute of Evolutionary Biology
                        University of Edinburgh
                           a.rambaut@ed.ac.uk

                    David Geffen School of Medicine
                 University of California, Los Angeles
                           msuchard@ucla.edu

                      Downloads, Help & Resources:
                           http://beast2.org/

  Source code distributed under the GNU Lesser General Public License:
                   http://github.com/CompEvol/beast2

                           BEAST developers:
   Alex Alekseyenko, Trevor Bedford, Erik Bloomquist, Joseph Heled,
 Sebastian Hoehna, Denise Kuehnert, Philippe Lemey, Wai Lok Sibon Li,
Gerton Lunter, Sidney Markowitz, Vladimir Minin, Michael Defoin Platel,
          Oliver Pybus, Tim Vaughan, Chieh-Hsi Wu, Walter Xie

                               Thanks to:
          Roald Forsberg, Beth Shapiro and Korbinian Strimmer


--- BEAGLE RESOURCES ---

0 : CPU
    Flags: PRECISION_SINGLE PRECISION_DOUBLE COMPUTATION_SYNCH EIGEN_REAL EIGEN_COMPLEX SCALING_MANUAL SCALING_AUTO SCALING_ALWAYS SCALERS_RAW SCALERS_LOG VECTOR_SSE VECTOR_NONE THREADING_NONE PROCESSOR_CPU FRAMEWORK_CPU

1 : NVIDIA GeForce 940MX
    Global memory (MB): 2048
    Clock speed (Ghz): 1.19
    Number of cores: 384
    Flags: PRECISION_SINGLE PRECISION_DOUBLE COMPUTATION_SYNCH COMPUTATION_ASYNCH EIGEN_REAL EIGEN_COMPLEX SCALING_MANUAL SCALING_AUTO SCALING_ALWAYS SCALERS_RAW SCALERS_LOG VECTOR_NONE THREADING_NONE PROCESSOR_GPU FRAMEWORK_CUDA

2 : Intel(R) HD Graphics 620 (OpenCL 2.1 )
    Global memory (MB): 3219
    Clock speed (Ghz): 1.00
    Number of compute units: 24
    Flags: PRECISION_SINGLE PRECISION_DOUBLE COMPUTATION_SYNCH COMPUTATION_ASYNCH EIGEN_REAL EIGEN_COMPLEX SCALING_MANUAL SCALING_AUTO SCALING_ALWAYS SCALERS_RAW SCALERS_LOG VECTOR_NONE THREADING_NONE PROCESSOR_GPU FRAMEWORK_OPENCL

3 : Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz (OpenCL 2.1 (Build 10))
    Global memory (MB): 8067
    Clock speed (Ghz): 2.50
    Number of compute units: 4
    Flags: PRECISION_SINGLE PRECISION_DOUBLE COMPUTATION_SYNCH COMPUTATION_ASYNCH EIGEN_REAL EIGEN_COMPLEX SCALING_MANUAL SCALING_AUTO SCALING_ALWAYS SCALERS_RAW SCALERS_LOG VECTOR_NONE THREADING_NONE PROCESSOR_CPU FRAMEWORK_OPENCL
Vovin
  • 720
  • 4
  • 16
  • 1
    Set variable `CMAKE_PREFIX_PATH` to installation prefix of OpenCL (the one you have passed to `CMAKE_INSTALL_PREFIX` when install the library). That way CMake itself should set variables `OpenCL_LIBRARY` and `OpenCL_INCLUDE_DIR`. These variables are **CMake** ones, so setting them in the *environment* has no sense. See also that question: https://stackoverflow.com/questions/34795816/hinting-findname-cmake-files-with-a-custom-directory – Tsyvarev Mar 17 '22 at 13:23
  • @Tsyvarev: `CMAKE_INSTALL_PREFIX` is where the build should eventually be installed **to**, not where to look for dependencies. – DevSolar Mar 17 '22 at 13:24

2 Answers2

2
Could NOT find OpenCL (missing: OpenCL_LIBRARY OpenCL_INCLUDE_DIR)

This means that the CMake variables OpenCL_LIBRARY and OpenCL_INCLUDE_DIR are missing, because OpenCL could not be found.

Setting those two as environment variables changes nothing.

You need to tell CMake where things are, if they are not installed in standard directories (as seems to be the case with your OpenCL installation).

Try adding -DOCL_ROOT=path/to/base/of/your/OpenCL to your call to CMake for a package-specific hint, or -DCMAKE_LIBRARY_PATH=path/to/... to make CMake search in that path (in addition to standard paths) for any package it might be looking for. Make sure you cleaned away all cached files beforehand, so that CMake runs clean and does not use cached values.

DevSolar
  • 67,862
  • 21
  • 134
  • 209
0

The solution was to set variables through -D in cmake as cmake -DOpenCL_INCLUDE_DIR=~/intel/system_studio_2020/opencl/SDK/include/ -DOpenCL_LIBRARY=~/intel/system_studio_2020/opencl/SDK/lib64/libOpenCL.so.1.2 -DCMAKE_INSTALL_PREFIX:PATH=$HOME ... The compiling was successful after that. make test was executed without any problems. I detected the file libhmsbeagle-opencl.so.40.0.0 in ~/lib folder.

Vovin
  • 720
  • 4
  • 16
  • That's the workaround, not the solution. – DevSolar Mar 18 '22 at 07:13
  • @DevSolar You are rather right! But what is the difference between your `-DOCL_ROOT` & `-DCMAKE_LIBRARY_PATH` path specification & mine? I put my answer only because this is the single one that helped me out, so I have working **beagle** as the result, & I would like to put it here for other noviciates akin me, who would like to overcome this hamper & make their phylogenetic research with Bayessian tools. – Vovin Apr 17 '22 at 13:39
  • 1
    For one, setting `-DOCL_ROOT=~/intel/system_studio_2020/opencl/SDK` is shorter than setting both `OpenCL_INCLUDE_DIR` and `OpenCL_LIBRARY`. Your solution will *only* work on a 64bit Linux, the solution for any other platform will require changing the `.../lib64/libOpenCL.so.1.2` part in platform-specific ways -- whereas changing `OCL_ROOT` to another path is patform-independent. You are basically bypassing the logic of FindOpenCL.cmake with hardcoded values. It's not "bad", but setting `OCL_ROOT` is "better". This is *your* answer, `OCL_ROOT` would be "the" answer. ;-) – DevSolar Apr 17 '22 at 16:44