当前位置:   article > 正文

VPU?APU?GPU?折腾从AMD-GPU回到Intel核显+OpenCL+Linux环境搭建_rzexvpu

rzexvpu

大神说:



也就是说APU比较适合计算部分少,但传输耗时多的情况;而GPU相反。


请注意APU的一些细节, 如何才能做到无传输.

 因为APU上稍微不注意, 按照传统写法很容易造成一次内存内部的传输的.
 (也就是内存到内存)。就是普通的BUFFER, 然后write和read回来它.用ALLOC_HOST_PTR或者正确对齐后的USE标志,可以无任何传输的.
 (也就是集成的GPU部分像CPU那样的就地访问这块内存)
使用OpenCL 2.0的话, 可以无任何Map,因为2.0开始有了SVM. 
 (APU或者Intel的核显, 可以就地访问内存.

https://software.intel.com/en-us/articles/getting-the-most-from-opencl-12-how-to-increase-performance-by-minimizing-buffer-copies-on-intel-processor-graphics

另外VPU是个好东西,目前谷歌和大疆无人机在使用,但太贵了就先不说了。


*******************************************心累******************************************************

从好好的AMD-GPU回到Intel核显,想以此来避免data transfer的耗时。因为我们买不起贵的AMD-GPU。

machine:Intel HD graphics 4600 + AMD Rx560 (已成功安装的driver) +CentOS7

终端输入 lspci | grep VGA 但只显示了AMD显卡信息,并没有看到Intel核显相关信息。。。

按照某大神说:The Intel video drivers are already included in CentOS 7: just yum install xorg-x11-drv-intel   然后重启后还是没看到Intel的相关信息。

或者按照 https://xpressrazor.wordpress.com/2013/01/13/how-to-setup-amdintel-hybrid-graphics-cards-in-linux-ubuntu/  但仍旧dont work

然而:有人说 My CPU is intel i5-4590 of which GPU is Intel HD Graphics 4600. However, it's said that Intel SDK for OpenCL 2.0 doesn't support HD Graphics 4600, while download of SDK for OpenCL 1.2 seems to be removed from intel website.

这就尴尬了。。。


不管如何,我还是决定自己试一试。。。

https://software.intel.com/en-us/articles/getting-started-with-opencl-code-builder

一、 去官网下Intel SDK for OpenCL

https://registrationcenter.intel.com/en/products/postregistration/?sn=c69g-kd7n5h3j&EmailID=1603926823@qq.com&Sequence=2151318&dnld=t



1、解压 tar zxvf intel_sdk_for_....tgz

2、进入这个解压后的文件夹:sh install.sh  然后会出现很多说明 按空格键跳过 后续又会出现很多选择问你接不接受等等 按1或者accept即可

然后按提示来,最后安装完成时会显示'Thank you for installing and for using the Intel R SDK for OpenCL TM Applications ...' 表示安装成功。

然而重启时 出问题了  老是叫我Log out 进不去图形界面。。。只能进入shell界面,


后续看来只能在shell界面安装了。

二、去官网下载intel driver

https://software.intel.com/en-us/articles/opencl-drivers  

但只看到OpenCL2.0的driver?貌似我的是Intel graphics HD 4600只支持OpenCL1.2?但一点点看着,终于在网页下看到:

然后了解了下这个Release Notes选择了第二个package 根据Installation instructions 进行下载安装。

但shell界面我是没有连接网络的,于是 按照 http://www.jb51.net/article/98539.htm 先把网络连接好 

到“cat /etc/sysconfig/network-scripts/ifcfg-enp2s0”修改最后一个no为yes重启后  就表示网络已经连接上了。

这时才能下载driver。。。

下载后解压安装:

然而:

很无奈。。。

然后不管继续:

  1. $ mkdir intel-opencl
  2. $ tar -C intel-opencl -Jxf intel-opencl-r4.0-BUILD_ID.x86_64.tar.xz
  3. $ tar -C intel-opencl -Jxf intel-opencl-devel-r4.0-BUILD_ID.x86_64.tar.xz
  4. $ tar -C intel-opencl -Jxf intel-opencl-cpu-r4.0-BUILD_ID.x86_64.tar.xz
  5. $ sudo cp -R intel-opencl/* /
  6. $ sudo ldconfig
然后又重回去输入刚刚Error的那条信息:依旧还是error:intel-opencl is needed by intel-opencl-cpu-r4.0-58481.x86_64  于是又下另一个driver:  intel-opencl-r5.0 (SRB5.0) Linux driver package  也是按照和上面差不多的步骤安装,但依旧是同样的问题。。。乱试了下:sudo yum install tar libpciaccess numactl-libs  

然后重启,然后直接输入clinfo 结果发现:不再是显示AMD的相关信息了!!!??而是显示的Intel的:

这样应该就是成功了吧?!!!!

三、下载安装runtime:

 https://software.intel.com/en-us/articles/opencl-drivers#latest_linux_SDK_release  我下的是比较新的runtime

解压这个tgz文件,然后可以看到解压出来有install.sh 直接运行sh install.sh

结果


然后我按了2,查看了下原因,说lsb-core>=4.0 于是我:

yum install redhat-lsb-core

然后再重新 sh install.sh 即重新安装这个runtime。

重启后仍然是只能进shell界面。。。尴尬。。。再次输入clinfo 显示的和之前一样,为什么不是显示Intel HD graphics作为我的device?Intel核显是集成CPU和GPU的,那么应该可以检测出Intel CPU和Intel GPU啊,可是现在只显示Intel CPU?我就在想那些用APU的人怎么用的,APU也是集成CPU和GPU,查到 https://community.amd.com/thread/158884  还是不明白。。。资料好少?


于是我又将我安装的东西全部卸载。。。然后依旧进不去图形界面,只能依旧是shell界面。。。

过了一个周末时间回来,竟然莫名其妙可以进去图形界面了。。。然后我在图形界面输入:clinfo 或者运行监测平台设备的那个程序:

  1. Number of platforms: 2
  2. CL_PLATFORM_PROFILE: FULL_PROFILE
  3. CL_PLATFORM_VERSION: OpenCL 2.0 AMD-APP (2442.7)
  4. CL_PLATFORM_VENDOR: Advanced Micro Devices, Inc.
  5. CL_PLATFORM_EXTENSIONS: cl_khr_icd cl_amd_event_callback cl_amd_offline_devices
  6. Number of devices: 1
  7. CL_DEVICE_TYPE: CL_DEVICE_TYPE_GPU
  8. CL_DEVICE_VENDOR_ID: 4098
  9. CL_DEVICE_MAX_COMPUTE_UNITS: 16
  10. CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
  11. CL_DEVICE_MAX_WORK_ITEM_SIZES: 256 256 256
  12. CL_DEVICE_MAX_WORK_GROUP_SIZE: 256
  13. CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR: 4
  14. CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT: 2
  15. CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT: 1
  16. CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG: 1
  17. CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT: 1
  18. CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE: 1
  19. CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF: 1
  20. CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR: 4
  21. CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT: 2
  22. CL_DEVICE_NATIVE_VECTOR_WIDTH_INT: 1
  23. CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG: 1
  24. CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT: 1
  25. CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE: 1
  26. CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF: 1
  27. CL_DEVICE_MAX_CLOCK_FREQUENCY: 1326
  28. CL_DEVICE_ADDRESS_BITS: 64
  29. CL_DEVICE_MAX_MEM_ALLOC_SIZE: 2836475904
  30. CL_DEVICE_IMAGE_SUPPORT: 1
  31. CL_DEVICE_MAX_READ_IMAGE_ARGS: 128
  32. CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 8
  33. CL_DEVICE_IMAGE2D_MAX_WIDTH: 16384
  34. CL_DEVICE_IMAGE2D_MAX_WIDTH: 16384
  35. CL_DEVICE_IMAGE2D_MAX_HEIGHT: 16384
  36. CL_DEVICE_IMAGE3D_MAX_WIDTH: 2048
  37. CL_DEVICE_IMAGE3D_MAX_HEIGHT: 2048
  38. CL_DEVICE_IMAGE3D_MAX_DEPTH: 2048
  39. CL_DEVICE_MAX_SAMPLERS: 16
  40. CL_DEVICE_MAX_PARAMETER_SIZE: 1024
  41. CL_DEVICE_MEM_BASE_ADDR_ALIGN: 2048
  42. CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE: 128
  43. CL_DEVICE_SINGLE_FP_CONFIG: CL_FP_INF_NAN | CL_FP_ROUND_TO_NEAREST | CL_FP_ROUND_TO_ZERO | CL_FP_ROUND_TO_INF | CL_FP_FMA
  44. CL_DEVICE_SINGLE_FP_CONFIG: CL_READ_WRITE_CACHE
  45. CL_DEVICE_GLOBAL_MEM_CACHE_TYPE: CL_READ_WRITE_CACHE
  46. CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE: 64
  47. CL_DEVICE_GLOBAL_MEM_CACHE_SIZE: 16384
  48. CL_DEVICE_GLOBAL_MEM_SIZE: 3998490624
  49. CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 2836475904
  50. CL_DEVICE_MAX_CONSTANT_ARGS: 8
  51. CL_DEVICE_LOCAL_MEM_TYPE:
  52. CL_DEVICE_LOCAL_MEM_SIZE: 32768
  53. CL_DEVICE_ERROR_CORRECTION_SUPPORT: 0
  54. CL_DEVICE_HOST_UNIFIED_MEMORY: 0
  55. CL_DEVICE_PROFILING_TIMER_RESOLUTION: 1
  56. CL_DEVICE_ENDIAN_LITTLE: 1
  57. CL_DEVICE_AVAILABLE: 1
  58. CL_DEVICE_COMPILER_AVAILABLE: 1
  59. CL_DEVICE_EXECUTION_CAPABILITIES: CL_EXEC_KERNEL
  60. CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_PROFILING_ENABLE
  61. CL_DEVICE_PLATFORM: 0x7fbb5e7ec478
  62. CL_DEVICE_NAME: Baffin
  63. CL_DEVICE_VENDOR: Advanced Micro Devices, Inc.
  64. CL_DRIVER_VERSION: 2442.7
  65. CL_DEVICE_PROFILE: FULL_PROFILE
  66. CL_DEVICE_VERSION: OpenCL 1.2 AMD-APP (2442.7)
  67. CL_DEVICE_OPENCL_C_VERSION: OpenCL C 1.2
  68. CL_DEVICE_EXTENSIONS: cl_khr_fp64 cl_amd_fp64 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_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_khr_spir cl_khr_gl_event
  69. CL_PLATFORM_PROFILE: FULL_PROFILE
  70. CL_PLATFORM_VERSION: OpenCL 2.0
  71. CL_PLATFORM_VENDOR: Intel(R) Corporation
  72. CL_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_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64 cl_khr_image2d_from_buffer
  73. Number of devices: 1
  74. CL_DEVICE_TYPE: CL_DEVICE_TYPE_CPU
  75. CL_DEVICE_VENDOR_ID: 32902
  76. CL_DEVICE_MAX_COMPUTE_UNITS: 4
  77. CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
  78. CL_DEVICE_MAX_WORK_ITEM_SIZES: 8192 8192 8192
  79. CL_DEVICE_MAX_WORK_GROUP_SIZE: 8192
  80. CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR: 1
  81. CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT: 1
  82. CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT: 1
  83. CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG: 1
  84. CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT: 1
  85. CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE: 1
  86. CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF: 0
  87. CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR: 32
  88. CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT: 16
  89. CL_DEVICE_NATIVE_VECTOR_WIDTH_INT: 8
  90. CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG: 4
  91. CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT: 8
  92. CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE: 4
  93. CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF: 0
  94. CL_DEVICE_MAX_CLOCK_FREQUENCY: 3200
  95. CL_DEVICE_ADDRESS_BITS: 64
  96. CL_DEVICE_MAX_MEM_ALLOC_SIZE: 4152202240
  97. CL_DEVICE_IMAGE_SUPPORT: 1
  98. CL_DEVICE_MAX_READ_IMAGE_ARGS: 480
  99. CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 480
  100. CL_DEVICE_IMAGE2D_MAX_WIDTH: 16384
  101. CL_DEVICE_IMAGE2D_MAX_WIDTH: 16384
  102. CL_DEVICE_IMAGE2D_MAX_HEIGHT: 16384
  103. CL_DEVICE_IMAGE3D_MAX_WIDTH: 2048
  104. CL_DEVICE_IMAGE3D_MAX_HEIGHT: 2048
  105. CL_DEVICE_IMAGE3D_MAX_DEPTH: 2048
  106. CL_DEVICE_MAX_SAMPLERS: 480
  107. CL_DEVICE_MAX_PARAMETER_SIZE: 3840
  108. CL_DEVICE_MEM_BASE_ADDR_ALIGN: 1024
  109. CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE: 128
  110. CL_DEVICE_SINGLE_FP_CONFIG: CL_FP_DENORM | CL_FP_INF_NAN | CL_FP_ROUND_TO_NEAREST
  111. CL_DEVICE_SINGLE_FP_CONFIG: CL_READ_ONLY_CACHE | CL_READ_WRITE_CACHE
  112. CL_DEVICE_GLOBAL_MEM_CACHE_TYPE: CL_READ_WRITE_CACHE
  113. CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE: 64
  114. CL_DEVICE_GLOBAL_MEM_CACHE_SIZE: 262144
  115. CL_DEVICE_GLOBAL_MEM_SIZE: 16608808960
  116. CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 131072
  117. CL_DEVICE_MAX_CONSTANT_ARGS: 480
  118. CL_DEVICE_LOCAL_MEM_TYPE: CL_LOCAL | CL_GLOBAL
  119. CL_DEVICE_LOCAL_MEM_SIZE: 32768
  120. CL_DEVICE_ERROR_CORRECTION_SUPPORT: 0
  121. CL_DEVICE_HOST_UNIFIED_MEMORY: 1
  122. CL_DEVICE_PROFILING_TIMER_RESOLUTION: 1
  123. CL_DEVICE_ENDIAN_LITTLE: 1
  124. CL_DEVICE_AVAILABLE: 1
  125. CL_DEVICE_COMPILER_AVAILABLE: 1
  126. CL_DEVICE_EXECUTION_CAPABILITIES: CL_EXEC_KERNEL | CL_EXEC_NATIVE_KERNEL
  127. CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLE
  128. CL_DEVICE_PLATFORM: 0x12292c0
  129. CL_DEVICE_NAME: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
  130. CL_DEVICE_VENDOR: Intel(R) Corporation
  131. CL_DRIVER_VERSION: 1.2.0.400
  132. CL_DEVICE_PROFILE: FULL_PROFILE
  133. CL_DEVICE_VERSION: OpenCL 2.0 (Build 400)
  134. CL_DEVICE_OPENCL_C_VERSION: OpenCL C 2.0
  135. CL_DEVICE_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_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_fp64 cl_khr_image2d_from_buffer
现在可以检测出来2个平台了,这算成功还是失败?之前我的AMD安装环境就是直接将OpenCL的环境与AMD的device绑定的,无论platform还是device都只会检测出AMD的;而现在竟然两个都可以检测出来了?!哈哈哈无心插柳柳成荫?

哦不对,AMD检测到的是 :任何一家的CPU+ AMD GPU。 对我电脑来说 目前是:Intel CPU+AMD GPU Rx560

下面部分Intel检测到的是:Intel的CPU+Intel的CPU (我依旧是没安装正确,如果正确,这里应该是Intel graphics HD 4600)。也就是说应该检测到Intel核显的GPU部分即HD 4600作为Intel的GPU部分(OpenCL的kernel运行环境)

路漫漫。。。。。。。。等公司买来sky lake系列,我再重装一次Intel 核显的OpenCL环境!!!!!!!!!!!!!

终于找到: https://software.intel.com/en-us/forums/opencl/topic/714946  这个 https://software.intel.com/en-us/articles/sdk-for-opencl-gsg  这个教程!等买来就可以试了。。。







*********************************烦躁**************************************************

大神建议我先在windows 7上测试,machine:windows7 + Intel HD graphics 4600 ,core i5-6500 + Nvidia 750 Ti

先下载合适的Intel驱动:https://downloadcenter.intel.com/product/80939/Graphics-Drivers

but 我windows 7 的电脑上安装不成功,后来去同事windows 10的电脑上才安装成功。哎如果要试,只能在他windows10上安装VS,然后运行OpenCL程序。。。



终于知道原因了:刚刚看到官网上给的4个版本的Linux的intel-driver的install instruction: Installation of the intel-opencl-r3.1 driver requires a 5th, 6th or 7th generation Intel® processor with Intel®Processor Graphics Technology not previously disabled by the BIOS or motherboard settings or Intel PentiumJ4000 and Intel Celeron J3000 processors. 

而我的HD 4600( core i5-6500) 是属于4th 而不是5th!!!所以不适合我的电脑,和我电脑型号不对!!!!!!!!!!!!!!!天哪郁闷!!!所以如果公司不买个新的Intel核显,是无法继续的。。。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/395593
推荐阅读
相关标签
  

闽ICP备14008679号