Using Boost Compute with ArrayFire

Muhammad Hassan Khan via Boost-users <[email protected]>
Newsgroups gmane.comp.lib.boost.user
Message-ID <CAHvFBeona4KdRns65OeAAqy5_Amk9ZXL0OP+ar8vYtUMo8pzMw@mail.gmail.com>
Hi,
I am trying to run a code which uses functions from both boost compute
library and arrayfire library. I am getting the following errors when I try
to build the code:

Scanning dependencies of target hello
[ 50%] Building CXX object CMakeFiles/hello.dir/hello.cpp.o
In file included from /opt/arrayfire/include/CL/cl.h:32,
                 from /usr/include/boost/compute/cl.hpp:19,
                 from /usr/include/boost/compute/system.hpp:20,
                 from
/usr/include/boost/compute/algorithm/accumulate.hpp:17,
                 from /usr/include/boost/compute/algorithm.hpp:18,
                 from /usr/include/boost/compute.hpp:14,
                 from /home/rcms/debruijn/arrayfire/hello.cpp:2:
/opt/arrayfire/include/CL/cl_version.h:34:104: note: #pragma message:
cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220
(OpenCL 2.2)
   34 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not
defined. Defaulting to 220 (OpenCL 2.2)")
      |
                                   ^
[100%] Linking CXX executable hello
/usr/bin/ld: CMakeFiles/hello.dir/hello.cpp.o: undefined reference to
symbol 'clGetDeviceIDs@@OPENCL_1.0'
/usr/bin/ld: /opt/arrayfire/lib64/libOpenCL.so.1: error adding symbols: DSO
missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/hello.dir/build.make:85: hello] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/hello.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

The code I am using is a very simple helloworld using functions from both
libraries.

#include <iostream>
#include <boost/compute.hpp>
#include <arrayfire.h>
namespace compute = boost::compute;
using namespace af;
int main()
{
     // Boost Compute Part
    // get the default device
    compute::device device = compute::system::default_device();
    // print the device's name and platform
    std::cout << "hello from " << device.name();
    std::cout << " (platform: " << device.platform().name() << ")" <<
std::endl;
    // Array Fire Part
    std::cout<< "ArrayFire Part:" << std::endl;
    af::setDevice(0);
    af::info();
    return 0;
}

The CMakeList used to build the project is:

cmake_minimum_required(VERSION 3.0)
project(deBruijn_Graph)
find_package(ArrayFire)
add_executable(hello hello.cpp)
target_link_libraries(hello ArrayFire::afopencl)

I do not have a programming background. Please guide me on what I am doing
wrong.

Regards,
Hassan


<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

_______________________________________________
Boost-users mailing list
[email protected]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.