R包gpuR安装报错opencl解决

R包gpuR安装报错opencl解决

phil 2 2024-11-06

背景

R 4.4.1

win11

安装gpuR总报错

#   .onAttach failed in attachNamespace() for 'gpuR', details:
#   call: NULL
# error: ViennaCL: FATAL ERROR: ViennaCL encountered an unknown OpenCL error. 
# Most likely your OpenCL SDK or driver is not installed properly. 
# In some cases, this error is due to an invalid global work size or several kernel compilation errors.
# If you think that this is a bug in ViennaCL, please report it at viennacl-support@lists.sourceforge.net and supply at least the following information:
#   * Operating System
# * Which OpenCL implementation (AMD, NVIDIA, etc.)
# * ViennaCL version
# Many thanks in advance!
#   Error: loading failed
# Execution halted
# ERROR: loading failed

看起来是opencl的安装问题

解决方法

降级R版本为3.6.3

因为intel的opencl sdk 2020年就不单独提供下载了.从第三方获取

opencl下载地址如下:

https://www.softpedia.com/get/Programming/SDK-DDK/Intel-SDK-for-OpenCL-Applications.shtml

安装默认就行

最后目录为:

C:\\Program Files (x86)\\IntelSWTools\\system_studio_2020\\OpenCL

开始安装gpuR

Sys.setenv(OPENCL_INC   = "C:\\Program Files (x86)\\IntelSWTools\\system_studio_2020\\OpenCL\\sdk\\include\\CL")
Sys.setenv(OPENCL_LIB32 = "C:\\Program Files (x86)\\IntelSWTools\\system_studio_2020\\OpenCL\\sdk\\lib\\x86")
Sys.setenv(OPENCL_LIB64 = "C:\\Program Files (x86)\\IntelSWTools\\system_studio_2020\\OpenCL\\sdk\\lib\\x64")

devtools::install_bitbucket(c("richierocks/assertive.base",
                              "richierocks/assertive.properties",
                              "richierocks/assertive.types",
                              "richierocks/assertive.numbers",
                              "richierocks/assertive.strings",
                              "richierocks/assertive.datetimes",
                              "richierocks/assertive.files",
                              "richierocks/assertive.sets",
                              "richierocks/assertive.matrices",
                              "richierocks/assertive.models",
                              "richierocks/assertive.data",
                              "richierocks/assertive.data.uk",
                              "richierocks/assertive.data.us",
                              "richierocks/assertive.reflection",
                              "richierocks/assertive.code"))

devtools::install_bitbucket("richierocks/assertive")

devtools::install_github('cdeterman/gpuR')

成功安装完毕.