TVM 踩坑记

遇到了一个错误:

tvm/src/runtime/opencl/opencl_device_api.cc:263: No OpenCL platform matched given existing options …

然后找了好多文章,找到了官方的文档,却发现2019年3月就提出了这个问题,是bug,并且被修复了。

现在是2020年3月7日,我不应该再遇到这个bug,于是看了看源代码,发现获取不到我的CL信息

终端里输入

$ clinfo

却显示

clinfo number of platforms 0

然后找了找教程,安装了一下驱动(大环境是我已经安装了 opencl-icd-dev 之类的包了)

sudo apt install mesa-opencl-icd

然后就修好了, clinfo 能打出来东西了:

Number of platforms 1
Platform Name Clover
Platform Vendor Mesa
Platform Version OpenCL 1.1 Mesa 19.2.8
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd
Platform Extensions function suffix MESA

Platform Name Clover
Number of devices 0

NULL platform behavior
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, …) Clover
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, …) Clover
clCreateContext(NULL, …) [default] No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform
clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) No devices found in platform

ICD loader properties
ICD loader Name OpenCL ICD Loader
ICD loader Vendor OCL Icd free software
ICD loader Version 2.2.11
ICD loader Profile OpenCL 2.1

然后我用RPC跑GPU测试,又遇到了

CommandLine Error: Option ‘help-list’ registered more than once!

这个问题,淦!

搜了一会,发现了这样一篇文章:https://discuss.tvm.ai/t/llvm-error-option-registered-more-than-once-while-loading-libtvm-so/269/10

其中有一段话:

This happens when you compile TVM runtime with both set(USE_OPENCL ON) and set(USE_LLVM ON)
You should enable only ONE option but not both.

我试了一下,编译的时候开着OPENCL,LLVM关掉,发现错的更离谱了

然后我把OPENCL关掉,LLVM打开,Vulkan打开,还是出错

我试试LLVM打开,OPENCL关闭,Vulkan关闭

(这不就是之前的状态吗???)

睡了一觉,第二天了,

遇到了新的错误:

Using CPU OpenCL device
No OpenCL device

按照tqchen的说法,make clean 然后 make

还是不行(我重装了llvm)

在https://askubuntu.com/questions/809450/installing-opencl-for-svga-ii-adapter

找到这么一段话:

According to the top answer to this question, the Intel SDK does not work on VMWare. It suggests instead trying to use the AMD APP SDK

Now I’m continuing meet the bug.

TVM DOES NOT SUPPORT openjdk-11 !!!

TVM DOES NOT SUPPORT openjdk-11 !!!

TVM DOES NOT SUPPORT openjdk-11 !!!

apt install openjdk-8-jdk ONLY!

Then set JAVA_HOME in your environment!

I cannot type chinese because I have decided to change my system into Ubuntu 18.04 LTS, and I havn’t install any input method yet.

Why?

Because I cannot access GPU in my VMWare system, fuck!

Finally I fix all the issues.

When you compile android_rpc, you HAVE TO specify the libOpenCL.so in jni/config.mk, which pulled from your Android phone. Then, download CL-headers from github!

READ THE OFFICIAL INSTRUCTIONS CAREFULLY!!

《TVM 踩坑记》上有1条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注