在Linux的多个平台上启用OpenCL? 如何处理ICD文件?

细节

为了在多种平台上启用OpenCL,必须安装哪些驱动程序/软件包:CPU(英特尔),集成GPU(英特尔),专用GPU(NVIDIA)?
拥有运行OpenCL 1.2或更高版本的所有平台将是非常好的

我知道这可能是一个简单的修复,也许只是正确的库/ SKDselect,但我有一些麻烦得到更多的一个平台上class。

运行Ubuntu 14.04:我有一个英特尔核心I5与集成的英特尔graphics和专用的NVIDIA GeForce 710m板。


我用过的资源

https://wiki.tiker.net/OpenCLHowTo
这里(在Debian下)它告诉我,我只需要:

  1. ICD装载机的包装:(你只需要其中的一个)
  2. ICD的软件包
  3. 包头

我已经尝试过了

  1. 安装的CUDA7.5(是的所有)
    • 有一个黑屏由于司机冲突
      • 解决所有的NVIDIA驱动程序和安装352
      • 还剩下Cuda SDK安装
  2. From: 如何让OpenCL在14.10 + Nvidia 331.89驱动上运行?
    • sudo apt-get install nvidia-331 nvidia-331-uvm nvidia-opencl-dev nvidia-modprobe
    • 这些软件包将我的司机降级到331和340
  3. 同样来自: 如何使OpenCL在14.10 + Nvidia 331.89驱动程序上工作?
    • 链接库与:
      • sudo ln -s /usr/include/nvidia-352/GL /usr/local/include
      • sudo ln -s /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 /usr/local/lib/libOpenCL.so
    • OpenCL 1.1为NVIDIA GPU工作
    • 无法获得OpenCL 1.2,因此决定卸载331和340并再次安装352
  4. 安装了352(再次)
    • NVIDIA®(英伟达™)GPU 停止运行 OpenCL 1.1(并且仍然不起作用)
  5. 安装了英特尔opencl_runtime_14.2_x64_4.5.0.8.tgz

    • 与intel ICD创build了一个simbolic链接:

      • sudo ln -s /opt/intel/opencl-1.2-4.5.0.8/etc/intel64.icd
    • OpenCL 1.2为CPU工作(仍然有效)

  6. 安装clinfo sudo apt-get install clinfo

    • 只有英特尔CPU平台被检测到
  7. 试图安装几个不同的NVIDIA软件包,以再次获得NVIDIA GPU的工作,但没有运气

安装软件包和一些信息:

ICD在供应商?

 ls -l /etc/OpenCL/vendors/ total 4 -rw-r--r-- 1 root root 15 Out 22 2015 Altera.icd lrwxrwxrwx 1 root root 45 Abr 28 13:48 intel64.icd -> /opt/intel/opencl-1.2-4.5.0.8/etc/intel64.icd 

注意缺less的nvidia.icd

CL和GL – GL有一个有效的链接…现在是在红色

 ls -l /usr/local/include total 4 lrwxrwxrwx 1 root root 31 Abr 28 12:48 CL -> /usr/local/cuda-7.5/include/CL/ lrwxrwxrwx 1 root root 26 Abr 27 11:44 GL -> /usr/include/nvidia-352/GL (IN RED COLOR - folder doesn't exist anymore) 

.so文件

 ls -l /usr/local/lib/ | grep CL lrwxrwxrwx 1 root root 40 Abr 27 11:45 libOpenCL.so -> /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 

安装软件包

 dpkg --get-selections | grep nvidia nvidia-340 deinstall nvidia-352 install nvidia-libopencl1-340 deinstall nvidia-libopencl1-340-updates deinstall nvidia-libopencl1-352 deinstall nvidia-libopencl1-352-updates install nvidia-modprobe install nvidia-opencl-icd-340 deinstall nvidia-opencl-icd-352 deinstall nvidia-prime install nvidia-settings install dpkg --get-selections | grep opencl nvidia-libopencl1-340 deinstall nvidia-libopencl1-340-updates deinstall nvidia-libopencl1-352 deinstall nvidia-libopencl1-352-updates install nvidia-opencl-icd-340 deinstall nvidia-opencl-icd-352 deinstall ocl-icd-libopencl1:amd64 deinstall ocl-icd-libopencl1:i386 deinstall opencl-headers install unity-scope-openclipart install 

clinfo

 clinfo Number of platforms: 1 Platform Profile: FULL_PROFILE Platform Version: OpenCL 1.2 LINUX Platform Name: Intel(R) OpenCL Platform Vendor: Intel(R) Corporation Platform Extensions: cl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_spir cl_intel_exec_by_local_thread cl_khr_depth_images cl_khr_3d_image_writes cl_khr_fp64 Platform Name: Intel(R) OpenCL Number of devices: 1 Device Type: CL_DEVICE_TYPE_CPU Device ID: 32902 Max compute units: 4 Max work items dimensions: 3 Max work items[0]: 8192 Max work items[1]: 8192 Max work items[2]: 8192 Max work group size: 8192 Preferred vector width char: 1 Preferred vector width short: 1 Preferred vector width int: 1 Preferred vector width long: 1 Preferred vector width float: 1 Preferred vector width double: 1 Native vector width char: 16 Native vector width short: 8 Native vector width int: 4 Native vector width long: 2 Native vector width float: 8 Native vector width double: 4 Max clock frequency: 1800Mhz Address bits: 64 Max memory allocation: 2040185856 Image support: Yes Max number of images read arguments: 480 Max number of images write arguments: 480 Max image 2D width: 16384 Max image 2D height: 16384 Max image 3D width: 2048 Max image 3D height: 2048 Max image 3D depth: 2048 Max samplers within kernel: 480 Max size of kernel argument: 3840 Alignment (bits) of base address: 1024 Minimum alignment (bytes) for any datatype: 128 Single precision floating point capability Denorms: Yes Quiet NaNs: Yes Round to nearest even: Yes Round to zero: No Round to +ve and infinity: No IEEE754-2008 fused multiply-add: No Cache type: Read/Write Cache line size: 64 Cache size: 262144 Global memory size: 8160743424 Constant buffer size: 131072 Max number of constant args: 480 Local memory type: Global Local memory size: 32768 Error correction support: 0 Unified memory for Host and Device: 1 Profiling timer resolution: 1 Device endianess: Little Available: Yes Compiler available: Yes Execution capabilities: Execute OpenCL kernels: Yes Execute native function: Yes Queue properties: Out-of-Order: Yes Profiling : Yes Platform ID: 0x1659390 Name: Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz Vendor: Intel(R) Corporation Device OpenCL C version: OpenCL C 1.2 Driver version: 1.2.0.8 Profile: FULL_PROFILE Version: OpenCL 1.2 (Build 8) Extensions: cl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_spir cl_intel_exec_by_local_thread cl_khr_depth_images cl_khr_3d_image_writes cl_khr_fp64 

所以…

我怎样才能获得NVIDIA GPU也显示为一个OPENCL 1.2(或更高)的平台? 集成的英特尔graphics如何?
AMD图书馆会使用我的硬件吗?
为什么大部分的nvidia软件包都被标记为deinstall

如前所述,有三件事是必要的:

https://wiki.tiker.net/OpenCLHowTo

  • ICD装载机的包装:(你只需要其中的一个)
  • ICD的软件包
  • 包头

因此,对于英特尔CPU和NVIDIA GPU

  • ICD装载机的软件包:
    • OCL-ICD-libopencl1
  • ICD的软件包
    • 安装了英特尔OpenCL运行时
    • NVIDIA-的OpenCL-ICD-352
  • 包头
    • OpenCL的报头

但是,要使其正常工作,必须确保软件包被标记为由dpkg --get-selections | grep opencl安装dpkg --get-selections | grep opencl dpkg --get-selections | grep opencl

 sudo apt-get install --reinstall nvidia-opencl-icd-352 opencl-headers ocl-icd-libopencl1 

最重要的是,您必须确保intel64.icd和nvidia.icd位于/etc/OpenCL/vendorsls -l /etc/OpenCL/vendors )中。

这就是说,我不得不把intel64.icd与:

 cd /etc/OpenCL/vendors/ sudo ln -s /opt/intel/opencl-1.2-XXXX/etc/intel64.icd 

而且,由于nvidia.icd不在文件夹中(即使在安装正确的软件包之后),我必须将其解压并手动从deb软件包中移出

 dpkg -x /var/cache/apt/archives/nvidia-opencl-icd-352_352.63-0ubuntu0.14.04.1_amd64.deb ~/tempfolder sudo mv ~/tempfolder/etc/OpenCL/vendors/nvidia.icd /etc/OpenCL/vendors/nvidia.icd rm -r ~/tempfolder 

最后,确保nvidia是活跃的GPU

 sudo prime-select nvidia sudo reboot -r now 

安装并执行clinfo,并显示两个平台。

 clinfo Number of platforms: 2 Platform Profile: FULL_PROFILE Platform Version: OpenCL 1.2 CUDA 7.5.23 Platform Name: NVIDIA CUDA Platform Vendor: NVIDIA Corporation Platform Extensions: cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts Platform Profile: FULL_PROFILE Platform Version: OpenCL 1.2 LINUX Platform Name: Intel(R) OpenCL Platform Vendor: Intel(R) Corporation Platform Extensions: cl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_spir cl_intel_exec_by_local_thread cl_khr_depth_images cl_khr_3d_image_writes cl_khr_fp64