找不到OpenCL头文件

时间:2019-06-12 19:26:24

标签: opencl

所以,如果这个问题很琐碎,请忍受。

我想安装Intel OpenCL实施以在集成的Intel GPU中进行编码。

我使用Beignet安装了OpenCL驱动程序。它已成功安装,并且clinfo显示了平台数量和其他详细信息。

我有以下代码

#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
#include <CL\cl.hpp>
#include<iostream>
int main() {
    std::vector<cl::Platform> platforms;
    cl::Platform::get(&platforms);
    std::cout << "Total platforms including cpu: " << platforms.size() << std::endl;
    if (platforms.size() == 0) {
        std::cout << " No platforms found. Check OpenCL installation!\n";
        exit(1);
    }
    for (int j = 0; j < platforms.size(); j++) {
        auto p = platforms[j];//Change platform from 0,1 and 2
        std::vector <cl::Device> devices;
        p.getDevices(CL_DEVICE_TYPE_ALL, &devices);
        for (int i = 0; i < devices.size(); i++) {
            auto device = devices[i];
            auto vendor = device.getInfo<CL_DEVICE_VENDOR>();
            std::cout << vendor << std::endl;
            auto version = device.getInfo<CL_DEVICE_VERSION>();
        }
        std::cout << "----------------------\n";
    }
}

当我使用$ g ++ -o test test.cpp -lOpenCL进行编译时,它将引发以下错误

fatal error: CL\cl.hpp: No such file or directory
 #include <CL\cl.hpp>

我按如下所示链接了库,

sudo ln -s /usr/lib/x86_64-linux-gnu/libOpenCL.so /usr/local/lib/libOpenCl.so

我不确定如何继续进行。请帮助

0 个答案:

没有答案