Toybrick

标题: RK3399Pro入门教程(12)OpenGL/CL在Debian10上的安装和使用 [打印本页]

作者: jefferyzhang    时间: 2020-3-20 11:31
标题: RK3399Pro入门教程(12)OpenGL/CL在Debian10上的安装和使用
本帖最后由 jefferyzhang 于 2020-3-31 10:41 编辑

安装准备:

安装前请务必先更新Debian10到最新版本,参考:
http://t.rock-chips.com/forum.php?mod=viewthread&tid=1319&extra=page%3D1


安装步骤:


1. 安装Toybrick GBM mali组件
  1. sudo apt install toybrick-gbm-dev libgbm-dev
复制代码


2. 安装OpenGL测试工具glmark2
  1. sudo apt install glmark2
复制代码


3. 安装OpenCL和clinfo
  1. sudo apt install ocl-icd-opencl-dev ocl-icd-dev clinfo
复制代码


4. 链接mali库
  1. sudo toybrick-mali.sh link
复制代码



5. 如果有任何GL/CL库的操作,记得操作之前先unlink mali库
  1. sudo toybrick-mali.sh unlink
复制代码



测试验证:

1. OpenGL性能测试
  1. glmark2-es2-drm
复制代码


可以看到画面出现OpenGL 3D图像测试程序正在运行。完整运行指标如下:
toybrick@debian10:~$ glmark2-es2-drm
=======================================================
    glmark2 2017.07
=======================================================
    OpenGL Information
    GL_VENDOR:     ARM
    GL_RENDERER:   Mali-T860
    GL_VERSION:    OpenGL ES 3.2 v1.r18p0-01rel0.5630b190419266e7fe8b09ec0007fb39
=======================================================
[build] use-vbo=false: FPS: 59 FrameTime: 16.949 ms
[build] use-vbo=true: FPS: 59 FrameTime: 16.949 ms
[texture] texture-filter=nearest: FPS: 60 FrameTime: 16.667 ms
[texture] texture-filter=linear: FPS: 60 FrameTime: 16.667 ms
[texture] texture-filter=mipmap: FPS: 60 FrameTime: 16.667 ms
[shading] shading=gouraud: FPS: 60 FrameTime: 16.667 ms
[shading] shading=blinn-phong-inf: FPS: 59 FrameTime: 16.949 ms
[shading] shading=phong: FPS: 60 FrameTime: 16.667 ms
[shading] shading=cel: FPS: 59 FrameTime: 16.949 ms
[bump] bump-render=high-poly: FPS: 59 FrameTime: 16.949 ms
[bump] bump-render=normals: FPS: 59 FrameTime: 16.949 ms
[bump] bump-render=height: FPS: 59 FrameTime: 16.949 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 31 FrameTime: 32.258 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 27 FrameTime: 37.037 ms
[pulsar] light=false:quads=5:texture=false: FPS: 59 FrameTime: 16.949 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 26 FrameTime: 38.462 ms
[desktop] effect=shadow:windows=4: FPS: 30 FrameTime: 33.333 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 20 FrameTime: 50.000 ms
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 20 FrameTime: 50.000 ms
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 29 FrameTime: 34.483 ms
[ideas] speed=duration: FPS: 30 FrameTime: 33.333 ms
[jellyfish] <default>: FPS: 32 FrameTime: 31.250 ms
[terrain] <default>: FPS: 11 FrameTime: 90.909 ms
[shadow] <default>: FPS: 29 FrameTime: 34.483 ms
[refract] <default>: FPS: 29 FrameTime: 34.483 ms
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 59 FrameTime: 16.949 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 30 FrameTime: 33.333 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 60 FrameTime: 16.667 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 59 FrameTime: 16.949 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 31 FrameTime: 32.258 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 59 FrameTime: 16.949 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 59 FrameTime: 16.949 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 30 FrameTime: 33.333 ms
=======================================================
                                  glmark2 Score: 44
=======================================================





2. OpenCL环境验证
  1. clinfo
复制代码


输出正确的Mali CL环境:

toybrick@debian10:~$ clinfo
Number of platforms                               1
  Platform Name                                   ARM Platform
  Platform Vendor                                 ARM
  Platform Version                                OpenCL 1.2 v1.r18p0-01rel0.5630b190419266e7fe8b09ec0007fb39
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             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_3d_image_writes cl_khr_fp64 cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp16 cl_khr_icd cl_khr_egl_image cl_khr_image2d_from_buffer cl_arm_core_id cl_arm_printf cl_arm_thread_limit_hint cl_arm_non_uniform_work_group_size cl_arm_import_memory
  Platform Extensions function suffix             ARM

  Platform Name                                   ARM Platform
Number of devices                                 1
  Device Name                                     Mali-T860
  Device Vendor                                   ARM
  Device Vendor ID                                0x8602000
  Device Version                                  OpenCL 1.2 v1.r18p0-01rel0.5630b190419266e7fe8b09ec0007fb39
  Driver Version                                  1.2
  Device OpenCL C Version                         OpenCL C 1.2 v1.r18p0-01rel0.5630b190419266e7fe8b09ec0007fb39
  Device Type                                     GPU
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               4
  Max clock frequency                             5MHz
  Device Partition                                (core)
    Max number of sub-devices                     0
    Supported partition types                     None
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             256x256x256
  Max work group size                             256
  Preferred work group size multiple              4
  Preferred / native vector sizes                 
    char                                                16 / 16      
    short                                                8 / 8      
    int                                                  4 / 4      
    long                                                 2 / 2      
    half                                                 8 / 8        (cl_khr_fp16)
    float                                                4 / 4      
    double                                               2 / 2        (cl_khr_fp64)
  Half-precision Floating-point support           (cl_khr_fp16)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Single-precision Floating-point support         (core)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
    Correctly-rounded divide and sqrt operations  No
  Double-precision Floating-point support         (cl_khr_fp64)
    Denormals                                     Yes
    Infinity and NANs                             Yes
    Round to nearest                              Yes
    Round to zero                                 Yes
    Round to infinity                             Yes
    IEEE754-2008 fused multiply-add               Yes
    Support is emulated in software               No
  Address bits                                    64, Little-Endian
  Global memory size                              4029341696 (3.753GiB)
  Error Correction support                        No
  Max memory allocation                           1007335424 (960.7MiB)
  Unified memory for Host and Device              Yes
  Minimum alignment for any data type             128 bytes
  Alignment of base address                       1024 bits (128 bytes)
  Global Memory cache type                        Read/Write
  Global Memory cache size                        262144 (256KiB)
  Global Memory cache line size                   64 bytes
  Image support                                   Yes
    Max number of samplers per kernel             16
    Max size for 1D images from buffer            65536 pixels
    Max 1D or 2D image array size                 2048 images
    Base address alignment for 2D image buffers   32 bytes
    Pitch alignment for 2D image buffers          16 pixels
    Max 2D image size                             65536x65536 pixels
    Max 3D image size                             65536x65536x65536 pixels
    Max number of read image args                 128
    Max number of write image args                8
  Local memory type                               Global
  Local memory size                               32768 (32KiB)
  Max number of constant args                     8
  Max constant buffer size                        65536 (64KiB)
  Max size of kernel argument                     1024
  Queue properties                                
    Out-of-order execution                        Yes
    Profiling                                     Yes
  Prefer user sync for interop                    No
  Profiling timer resolution                      1000ns
  Execution capabilities                          
    Run OpenCL kernels                            Yes
    Run native kernels                            No
  printf() buffer size                            1048576 (1024KiB)
  Built-in kernels                                (n/a)
  Device Extensions                               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_3d_image_writes cl_khr_fp64 cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_fp16 cl_khr_icd cl_khr_egl_image cl_khr_image2d_from_buffer cl_arm_core_id cl_arm_printf cl_arm_thread_limit_hint cl_arm_non_uniform_work_group_size cl_arm_import_memory

NULL platform behavior
  clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  ARM Platform
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [ARM]
  clCreateContext(NULL, ...) [default]            Success [ARM]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 ARM Platform
    Device Name                                   Mali-T860
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 ARM Platform
    Device Name                                   Mali-T860
  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)  Success (1)
    Platform Name                                 ARM Platform
    Device Name                                   Mali-T860





GL/CL Sample 教程参考:

* GL可以参考glmark2的源码,写的非常好 https://github.com/glmark2/glmark2
* CL支持到1.2,可以参考CL官方教程 https://www.khronos.org/developers/reference-cards/


作者: newcomer3399    时间: 2020-3-20 18:50
我使用fedora,安装命令:
dnf install toybrick-gbm-dev
报错,为找到匹配的参数
CL的so本地源已经装好了
作者: newcomer3399    时间: 2020-3-20 19:03
dnf install ocl-icd-opencl-dev
报错:未找到匹配的参数
作者: jefferyzhang    时间: 2020-3-20 22:05
newcomer3399 发表于 2020-3-20 19:03
dnf install ocl-icd-opencl-dev
报错:未找到匹配的参数

注意审题,本文仅适用于debian10
作者: newcomer3399    时间: 2020-3-23 12:55
jefferyzhang 发表于 2020-3-20 22:05
注意审题,本文仅适用于debian10

何时推出fedola的安装opencl教程?
作者: jefferyzhang    时间: 2020-3-23 14:23
newcomer3399 发表于 2020-3-23 12:55
何时推出fedola的安装opencl教程?

fedola之前就有人问过,有回复过。
教程不会单独出了。
作者: newcomer3399    时间: 2020-3-24 12:28
我在fedora系统下安装opencl,首先添加Rockhip官方源:
dnf localinstall --nogpgcheck http://repo.rock-chips.com/fedor ... -4.fc28.aarch64.rpm
然后升级:
dnf clean all
dnf update
安装包:
dnf install ocl-icd-devel.aarch64
readlink -f /usr/lib64/libOpenCL.so  /usr/lib64/libmali.so.r18p0
安装clinfo:
dnf install clinfo
最后使用命令:
clinfo
出现结果:
Number of platforms                               1
  Platform Name                                   ARM Platform
  Platform Vendor                                 ARM
  Platform Version                                OpenCL 1.2 v1.r18p0-01rel0.42aa65ae5fdfdec464479cb891075220
  Platform Profile                                FULL_PROFILE
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
  Platform Extensions                             <printPlatformInfo:4: get CL_PLATFORM_EXTENSIONS size : error -6>
Failed creating base context during opening of kernel driver.
Kernel module may not have been loaded
printPlatformInfo:488: number of devices : error -6
不知道是哪里有问题?始终没有显现mali的信息
作者: jefferyzhang    时间: 2020-3-24 16:06
newcomer3399 发表于 2020-3-24 12:28
我在fedora系统下安装opencl,首先添加Rockhip官方源:
dnf localinstall --nogpgcheck http://repo.rock-c ...

Fedora的我就不是很清楚了,当时应该只要安装ocl就可以,不需要你链接,默认已经换了。
当然也要看你硬件是不是Toybrick的/
作者: newcomer3399    时间: 2020-3-24 16:21
jefferyzhang 发表于 2020-3-24 16:06
Fedora的我就不是很清楚了,当时应该只要安装ocl就可以,不需要你链接,默认已经换了。
当然也要看你硬件 ...

我的硬件是toybrick的,tb-rk3399proD
作者: jefferyzhang    时间: 2020-3-24 16:23
newcomer3399 发表于 2020-3-24 16:21
我的硬件是toybrick的,tb-rk3399proD

是toybrick的话就太好办了,烧debian10把。不然你rknn都没办法更新到最新。。
作者: newcomer3399    时间: 2020-3-26 09:57
jefferyzhang 发表于 2020-3-24 16:23
是toybrick的话就太好办了,烧debian10把。不然你rknn都没办法更新到最新。。

谢谢,给个烧debian10的教程链接吧。。。
作者: jefferyzhang    时间: 2020-3-26 10:14
newcomer3399 发表于 2020-3-26 09:57
谢谢,给个烧debian10的教程链接吧。。。

置顶整合贴里就有,wiki里有烧写教程。切勿擦除FLASH就好,其他随便怎么烧
作者: newcomer3399    时间: 2020-3-26 10:18
jefferyzhang 发表于 2020-3-24 16:23
是toybrick的话就太好办了,烧debian10把。不然你rknn都没办法更新到最新。。

谢谢,刚才发重复了
作者: newcomer3399    时间: 2020-3-26 10:51
jefferyzhang 发表于 2020-3-26 10:14
置顶整合贴里就有,wiki里有烧写教程。切勿擦除FLASH就好,其他随便怎么烧 ...

没有找到置顶帖呢,wiki里面有,但是不完整,按照wiki里面的可以吗
作者: jefferyzhang    时间: 2020-3-26 10:56
newcomer3399 发表于 2020-3-26 10:51
没有找到置顶帖呢,wiki里面有,但是不完整,按照wiki里面的可以吗

http://t.rock-chips.com/forum.ph ... &extra=page%3D1
置顶整合贴里有发布debian10固件啊。
配合wiki的烧写方法烧就可以了
作者: newcomer3399    时间: 2020-3-26 11:32
jefferyzhang 发表于 2020-3-26 10:56
http://t.rock-chips.com/forum.php?mod=viewthread&tid=390&extra=page%3D1
置顶整合贴里有发布debian10 ...

我再烧录时提示miniloaderall下载项不存在,停止执行!
该如何?
作者: newcomer3399    时间: 2020-3-26 12:14
jefferyzhang 发表于 2020-3-26 10:56
http://t.rock-chips.com/forum.php?mod=viewthread&tid=390&extra=page%3D1
置顶整合贴里有发布debian10 ...

烧录debian成功,开始安装opencl,执行命令sudo apt install toybrick-gbm-devel时,报错:

Err:1 http://repo.rock-chips.com/debian buster/main arm64 toybrick-gbm arm64 18.3.6-1
  404  Not Found [IP: 120.27.214.227 80]

作者: jefferyzhang    时间: 2020-3-26 12:25
newcomer3399 发表于 2020-3-26 12:14
烧录debian成功,开始安装opencl,执行命令sudo apt install toybrick-gbm-devel时,报错:

Err:1 http: ...

直接开能开的了么?我这里看是可以访问的
作者: jefferyzhang    时间: 2020-3-26 12:25
newcomer3399 发表于 2020-3-26 12:14
烧录debian成功,开始安装opencl,执行命令sudo apt install toybrick-gbm-devel时,报错:

Err:1 http: ...

哦,你刚烧完debian需要更新下,看debian10更新说明,update upgrade完再装
作者: newcomer3399    时间: 2020-3-26 13:15
jefferyzhang 发表于 2020-3-26 12:25
哦,你刚烧完debian需要更新下,看debian10更新说明,update upgrade完再装

apt upgrade下载速度0%
作者: newcomer3399    时间: 2020-3-26 13:42
jefferyzhang 发表于 2020-3-26 12:25
哦,你刚烧完debian需要更新下,看debian10更新说明,update upgrade完再装

半小时过去了,下载进度依然是0%,服务器那边有问题了吗
作者: newcomer3399    时间: 2020-3-26 14:06
jefferyzhang 发表于 2020-3-26 12:25
哦,你刚烧完debian需要更新下,看debian10更新说明,update upgrade完再装

toybrick@debian10:~$ sudo apt update
[sudo] password for toybrick:
Hit:1 http://repo.rock-chips.com/debian buster InRelease
Err:2 http://ftp.cn.debian.org/debian buster InRelease
  Could not connect to ftp.cn.debian.org:80 (45.125.0.6), connection timed out
Reading package lists... Done                    
Building dependency tree      
Reading state information... Done
6 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: Failed to fetch http://ftp.cn.debian.org/debian/dists/buster/InRelease  Could not connect to ftp.cn.debian.org:80 (45.125.0.6), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.
debian服务器连不上。。。
作者: jefferyzhang    时间: 2020-3-26 14:27
newcomer3399 发表于 2020-3-26 14:06
toybrick@debian10:~$ sudo apt update
[sudo] password for toybrick:
Hit:1 http://repo.rock-chips.c ...

多试试,这个官方源网络不一定稳定。。。
这个我也没办法
作者: kaishi    时间: 2020-3-27 15:07
I follow your instruction on debian 10, got the following error when checking clinf:

clinfo: /lib/aarch64-linux-gnu/libOpenCL.so.1: version `OPENCL_1.0' not found (required by clinfo)

Do you know why?
作者: kaishi    时间: 2020-3-27 15:09
I am not able to install glmark2 on debian 10

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package glmark2

作者: jefferyzhang    时间: 2020-3-27 16:29
kaishi 发表于 2020-3-27 15:09
I am not able to install glmark2 on debian 10

Reading package lists... Done

update debian10 first:

sudo apt update --fix-missing
sudo apt -y upgrade
作者: kaishi    时间: 2020-3-28 06:45
Got an error when I dod sudo apt update --fix-missing

Hit:1 http://repo.rock-chips.com/debian buster InRelease
Err:2 http://ftp.cn.debian.org/debian buster InRelease
  Could not connect to ftp.cn.debian.org:80 (45.125.0.6), connection timed out
Reading package lists... Done
Building dependency tree
Reading state information... Done
70 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: Failed to fetch http://ftp.cn.debian.org/debian/dists/buster/InRelease  Could not connect to ftp.cn.debian.org:80 (45.125.0.6), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.

作者: jefferyzhang    时间: 2020-3-28 11:16
kaishi 发表于 2020-3-28 06:45
Got an error when I dod sudo apt update --fix-missing

Hit:1 http://repo.rock-chips.com/debian buste ...

Please check your connect to ftp.cn.debian.org, or try again after another time.
作者: kaishi    时间: 2020-3-28 13:11
I am able to apt update now.
However, I am still get the same error to install glmark2 as below:

sudo apt install glmark2
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package glmark2

Also clinfo reports zero device as below:

clinfo: /lib/aarch64-linux-gnu/libOpenCL.so.1: version `OPENCL_1.0' not found (required by clinfo)


作者: jefferyzhang    时间: 2020-3-28 13:38
kaishi 发表于 2020-3-28 13:11
I am able to apt update now.
However, I am still get the same error to install glmark2 as below:

try:
sudo toybrick-mali.sh link

before executing glmark2
作者: kaishi    时间: 2020-3-28 13:46
I have 2 issues here:
clinfo reports no device as below:
clinfo: /lib/aarch64-linux-gnu/libOpenCL.so.1: version `OPENCL_1.0' not found (required by clinfo)

The other one is: not able to install glmark2 because the package is not found when I do:
sudo apt install glamrk2

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package glamrk2


作者: jefferyzhang    时间: 2020-3-28 13:55
kaishi 发表于 2020-3-28 13:46
I have 2 issues here:
clinfo reports no device as below:
clinfo: /lib/aarch64-linux-gnu/libOpenCL.so ...

Have you upgraded debian10 ?
After apt update, you need execute "sudo apt -y upgrade" to upgrade it for toybrick repo.
作者: kaishi    时间: 2020-3-28 13:59
My debian is relatively new. How can I find out build version. Below is lsb_release -a which tells me nothing about build version.

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

作者: jefferyzhang    时间: 2020-3-28 14:05
本帖最后由 jefferyzhang 于 2020-3-28 14:07 编辑
kaishi 发表于 2020-3-28 13:59
My debian is relatively new. How can I find out build version. Below is lsb_release -a which tells m ...

So where did you get this debian10 firmware?
If you got it from our toybrick site, it contains our toybrick deb/pipy repo which contains glmark2 built by ourselves.

作者: kaishi    时间: 2020-3-28 14:07
I believe my debian version is the latest one:
toybrick-debian10-prod-v1.0.tar

作者: kaishi    时间: 2020-3-28 14:14
jefferyzhang 发表于 2020-3-28 14:05
So where did you get this debian10 firmware?
If you got it from our toybrick site, it contains our  ...

I believe it was downloaded from your onedrive


作者: jefferyzhang    时间: 2020-3-28 16:47
kaishi 发表于 2020-3-28 14:14
I believe it was downloaded from your onedrive

That is weird. Did you see the message want you press 'Y' when you 'apt upgrade' about updating '/etc/apt/sources.list.d/toybrick.list'?
Check the '/etc/apt/sources.list.d/toybrick.list' is exist?
作者: kaishi    时间: 2020-3-29 03:24
jefferyzhang 发表于 2020-3-28 16:47
That is weird. Did you see the message want you press 'Y' when you 'apt upgrade' about updating '/e ...

Yes, my system has  /etc/apt/sources.list.d/toybrick.list and its content is:

deb http://repo.rock-chips.com/debian buster main

作者: jefferyzhang    时间: 2020-3-29 10:44
kaishi 发表于 2020-3-29 03:24
Yes, my system has  /etc/apt/sources.list.d/toybrick.list and its content is:

deb http://repo.roc ...

I will ask our engineer tomorrow.
Maybe you can try to compile glmark2 by yourself for workaround...
作者: kaishi    时间: 2020-3-29 15:44
How about opencl issue which no device found?

clinfo reports no device as below:
clinfo: /lib/aarch64-linux-gnu/libOpenCL.so.1: version `OPENCL_1.0' not found (required by clinfo)
作者: jefferyzhang    时间: 2020-3-30 09:02
kaishi 发表于 2020-3-29 15:44
How about opencl issue which no device found?

clinfo reports no device as below:

If you execute 'sudo toybrick-mali.sh link' successfully, the libOpenCL.so will be linked to libmali as below,

toybrick@debian10:~$ ll /usr/lib/aarch64-linux-gnu/libOpenCL.so*
lrwxrwxrwx 1 root root 18 Dec 17  2018 /usr/lib/aarch64-linux-gnu/libOpenCL.so -> libOpenCL.so.1.0.0
lrwxrwxrwx 1 root root 18 Dec 17  2018 /usr/lib/aarch64-linux-gnu/libOpenCL.so.1 -> libOpenCL.so.1.0.0
lrwxrwxrwx 1 root root 25 Mar 20 03:06 /usr/lib/aarch64-linux-gnu/libOpenCL.so.1.0.0 -> libmali-toybrick.so.r18p0
作者: newcomer3399    时间: 2020-3-30 11:22
jefferyzhang 发表于 2020-3-26 14:27
多试试,这个官方源网络不一定稳定。。。
这个我也没办法

已经upgrade完成,按照帖子说的进行了一系列安装,最后clinfo报以下信息:
clinfo: /lib/aarch64-linux-gnu/libOpenCL.so.1: version `OPENCL_1.0' not found (required by clinfo)
如何处理呢?
作者: jefferyzhang    时间: 2020-3-30 11:49
kaishi 发表于 2020-3-29 03:24
Yes, my system has  /etc/apt/sources.list.d/toybrick.list and its content is:

deb http://repo.roc ...

Your sources.list.d is wrong, it is NOT latest list.
So the upgrade is failure. You need upgrade again.
作者: jefferyzhang    时间: 2020-3-30 11:50
newcomer3399 发表于 2020-3-30 11:22
已经upgrade完成,按照帖子说的进行了一系列安装,最后clinfo报以下信息:
clinfo: /lib/aarch64-linux-g ...

看下link的是不是libmali
作者: newcomer3399    时间: 2020-3-30 13:21
jefferyzhang 发表于 2020-3-30 11:50
看下link的是不是libmali

sudo toybrick-mali.sh link
显示:
/home/toybrick
作者: jefferyzhang    时间: 2020-3-30 14:06
newcomer3399 发表于 2020-3-30 13:21
sudo toybrick-mali.sh link
显示:
/home/toybrick

看这个:
toybrick@debian10:~$ ll /usr/lib/aarch64-linux-gnu/libOpenCL.so*
lrwxrwxrwx 1 root root 18 Dec 17  2018 /usr/lib/aarch64-linux-gnu/libOpenCL.so -> libOpenCL.so.1.0.0
lrwxrwxrwx 1 root root 18 Dec 17  2018 /usr/lib/aarch64-linux-gnu/libOpenCL.so.1 -> libOpenCL.so.1.0.0
lrwxrwxrwx 1 root root 25 Mar 20 03:06 /usr/lib/aarch64-linux-gnu/libOpenCL.so.1.0.0 -> libmali-toybrick.so.r18p0

作者: kaishi    时间: 2020-3-30 15:43
jefferyzhang 发表于 2020-3-30 14:06
看这个:
toybrick@debian10:~$ ll /usr/lib/aarch64-linux-gnu/libOpenCL.so*
lrwxrwxrwx 1 root root 1 ...

Sam issue after sudo toybrick-mail.sh link.
Here is what I have from my system with your instruction:

sudo toybrick-mali.sh link
[sudo] password for toybrick:
/home/toybrick

ll /usr/lib/aarch64-linux-gnu/libOpenCL.so*
lrwxrwxrwx 1 root root 18 Dec 17  2018 /usr/lib/aarch64-linux-gnu/libOpenCL.so -> libOpenCL.so.1.0.0
lrwxrwxrwx 1 root root 18 Dec 17  2018 /usr/lib/aarch64-linux-gnu/libOpenCL.so.1 -> libOpenCL.so.1.0.0
lrwxrwxrwx 1 root root 25 Mar 27 07:02 /usr/lib/aarch64-linux-gnu/libOpenCL.so.1.0.0 -> libmali-toybrick.so.r18p0
toybrick@debian10:~$ clinfo
clinfo: /lib/aarch64-linux-gnu/libOpenCL.so.1: version `OPENCL_1.0' not found (required by clinfo)
作者: jefferyzhang    时间: 2020-3-30 16:35
kaishi 发表于 2020-3-30 15:43
Sam issue after sudo toybrick-mail.sh link.
Here is what I have from my system with your instructi ...

I have asked our engineer, he says you have to reinstall clinfo to fix this problem.

CHECK THIS:

toybrick@debian10:~$ dpkg -l | grep clinfo
ii  clinfo                                 2.2.18.04.06-2                      arm64        Query OpenCL system information


作者: jefferyzhang    时间: 2020-3-30 16:45
newcomer3399 发表于 2020-3-30 11:22
已经upgrade完成,按照帖子说的进行了一系列安装,最后clinfo报以下信息:
clinfo: /lib/aarch64-linux-g ...

我问了工程师了,upgrade完debian10,需要重装clinfo,当你看到的版本是以下一样 2.2.18.04.06-2 就没问题了,如果是-1,说明clinfo是错的,需要重装。

toybrick@debian10:~$ dpkg -l | grep clinfo
ii  clinfo                                 2.2.18.04.06-2                      arm64        Query OpenCL system information
作者: kaishi    时间: 2020-3-30 16:50
jefferyzhang 发表于 2020-3-30 16:45
我问了工程师了,upgrade完debian10,需要重装clinfo,当你看到的版本是以下一样 2.2.18.04.06-2 就没问 ...

Yes, my clinfo version is 2.2.18.04.06-1 which is older than 2.2.18.04.06-2.
However, I am not able to get new version of clinfo via apt install after I uninstall clinfo and reinstall.
How can I install newer clinfo?

Thanks,

作者: jefferyzhang    时间: 2020-3-30 17:06
kaishi 发表于 2020-3-30 16:50
Yes, my clinfo version is 2.2.18.04.06-1 which is older than 2.2.18.04.06-2.
However, I am not abl ...

I think your source.list is not correct.
If you upgrade toybrick debian10 successful, your source.list will be written as below,

toybrick@debian10:~$ cat /etc/apt/sources.list.d/toybrick.list
deb http://repo.rock-chips.com/debian buster main
deb http://repo.rock-chips.com/toybrick/auth-debian buster main
作者: kaishi    时间: 2020-3-31 02:26
jefferyzhang 发表于 2020-3-30 17:06
I think your source.list is not correct.
If you upgrade toybrick debian10 successful, your source. ...

After adding  to source list and the issue is resolved
deb http://repo.rock-chips.com/toybrick/auth-debian buster main.

Thanks for all helps.
作者: newcomer3399    时间: 2020-3-31 10:00
jefferyzhang 发表于 2020-3-30 16:45
我问了工程师了,upgrade完debian10,需要重装clinfo,当你看到的版本是以下一样 2.2.18.04.06-2 就没问 ...

我卸载了clinfo:
sudo apt remove clinfo
然后重新安装
sudo apt install clinfo
然后dpkg -l | grep clinfo
发现软件仍然是-1不是-2
ii  clinfo                                2.2.18.04.06-1                      arm64        Query OpenCL system information
如何解决?
作者: jefferyzhang    时间: 2020-3-31 10:01
newcomer3399 发表于 2020-3-31 10:00
我卸载了clinfo:
sudo apt remove clinfo
然后重新安装

先更新debian10, update完upgrade,出现提示问你更新source.list点Y,
然后再更新这些就有了
作者: newcomer3399    时间: 2020-3-31 10:07
jefferyzhang 发表于 2020-3-31 10:01
先更新debian10, update完upgrade,出现提示问你更新source.list点Y,
然后再更新这些就有了 ...

我都更新过了。。。难道是我没搞好?
那我再更新一次
作者: jefferyzhang    时间: 2020-3-31 10:11
newcomer3399 发表于 2020-3-31 10:07
我都更新过了。。。难道是我没搞好?
那我再更新一次

你往上看51楼回复,不行就手动加。
估计是当时更新你把它写了N
作者: newcomer3399    时间: 2020-3-31 10:15
jefferyzhang 发表于 2020-3-31 10:01
先更新debian10, update完upgrade,出现提示问你更新source.list点Y,
然后再更新这些就有了 ...

非常感谢,clinfo信息正常了,但是glmark2不行:
toybrick@debian10:~$ glmark2-es2-drm
glmark2-es2-drm: error while loading shared libraries: libgbm.so: cannot open shared object file: No such file or directory
如何解决
作者: jefferyzhang    时间: 2020-3-31 10:17
本帖最后由 jefferyzhang 于 2020-3-31 10:18 编辑
newcomer3399 发表于 2020-3-31 10:15
非常感谢,clinfo信息正常了,但是glmark2不行:
toybrick@debian10:~$ glmark2-es2-drm
glmark2-es2-drm ...

你少装了toybrick gbm。
apt里search下应该是这个没装把
sudo apt install toybrick-gbm-dev


作者: newcomer3399    时间: 2020-3-31 10:27
jefferyzhang 发表于 2020-3-31 10:17
你少装了toybrick gbm。
apt里search下应该是这个没装把
sudo apt install toybr ...

sudo apt search toybrick-gbm-dev
Sorting... Done
Full Text Search... Done
toybrick-gbm-dev/stable,now 18.3.6-3 arm64 [installed]
  Development package for Toybrick gbm Libraries
装过了
作者: jefferyzhang    时间: 2020-3-31 10:30
newcomer3399 发表于 2020-3-31 10:27
sudo apt search toybrick-gbm-dev
Sorting... Done
Full Text Search... Done

sudo apt install libgbm-dev
这个试试
作者: newcomer3399    时间: 2020-3-31 10:33
jefferyzhang 发表于 2020-3-31 10:30
sudo apt install libgbm-dev
这个试试

非常感谢!可以了
作者: newcomer3399    时间: 2020-4-8 11:31
请问arm 的computelirary如何安装?
作者: jefferyzhang    时间: 2020-4-8 11:41
newcomer3399 发表于 2020-4-8 11:31
请问arm 的computelirary如何安装?

参看arm官网安装哦,这个arm的东西我们没去集成
作者: cr7jj    时间: 2020-6-18 17:15
jefferyzhang 发表于 2020-4-8 11:41
参看arm官网安装哦,这个arm的东西我们没去集成

你好我用的是Debian10系统,安照教程安装了所需的库
运行出现这样的错误,请问怎么解决
  1. root@debian10:~# glmark2-es2-drm
  2. gbm: failed to open any driver (search paths /usr/lib/aarch64-linux-gnu/dri:\${ORIGIN}/dri:/usr/lib/dri)
  3. gbm: Last dlopen error: /usr/lib/dri/rockchip_dri.so: cannot open shared object file: No such file or directory
  4. failed to load driver: rockchip
  5. Error: eglCreateWindowSurface failed with error: 0x3009
  6. Error: eglCreateWindowSurface failed with error: 0x3009
  7. Error: CanvasGeneric: Invalid EGL state
  8. Error: main: Could not initialize canvas
  9. root@debian10:~#
复制代码
]

作者: jefferyzhang    时间: 2020-6-18 18:06
cr7jj 发表于 2020-6-18 17:15
你好我用的是Debian10系统,安照教程安装了所需的库
运行出现这样的错误,请问怎么解决
]

glmark2要在板子上编译
作者: cr7jj    时间: 2020-6-19 10:13
jefferyzhang 发表于 2020-6-18 18:06
glmark2要在板子上编译

你好,我用apt install glmark2,还要怎么编译?
作者: zhangjunhui    时间: 2020-7-13 21:32
我按照这个方式在debian上使用cmake编译调用OpenGL时候报错,说找不到OpenGL
Could NOT find OpenGL (missing: OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY
  OPENGL_INCLUDE_DIR)
作者: jefferyzhang    时间: 2020-7-14 10:10
zhangjunhui 发表于 2020-7-13 21:32
我按照这个方式在debian上使用cmake编译调用OpenGL时候报错,说找不到OpenGL
Could NOT find OpenGL (missi ...

自己写cmake found文件
作者: supchao    时间: 2020-9-9 17:06
toybrick rk3399pro debian10安装opencl,之前按贴子已经刷机安装过很多次也都能成功。
今天尝试重新刷机安装opencl多次均报错
clinfo: /lib/aarch64-linux-gnu/libOpenCL.so.1: version `OPENCL_1.0' not found (required by clinfo)

把贴子里其它回复都查了下

更新source.list 也是没问题的
toybrick@debian10:~$ cat /etc/apt/sources.list.d/toybrick.list
deb http://repo.rock-chips.com/debian buster main
deb http://repo.rock-chips.com/toybrick/auth-debian buster main

这个也显示正确
toybrick@debian10:~$ ll /usr/lib/aarch64-linux-gnu/libOpenCL.so*
lrwxrwxrwx 1 root root 18 Dec 17  2018 /usr/lib/aarch64-linux-gnu/libOpenCL.so -> libOpenCL.so.1.0.0
lrwxrwxrwx 1 root root 18 Dec 17  2018 /usr/lib/aarch64-linux-gnu/libOpenCL.so.1 -> libOpenCL.so.1.0.0
lrwxrwxrwx 1 root root 25 Mar 20 03:06 /usr/lib/aarch64-linux-gnu/libOpenCL.so.1.0.0 -> libmali-toybrick.so.r18p0

但是这里是 -3
toybrick@debian10:~$ dpkg -l | grep clinfo
ii  clinfo                                 2.2.18.04.06-3                      arm64        Query OpenCL system information



重新来 更新debian10, update完upgrade 都提示 0 upgraded  删除重新安装clinfo 也是一样报错

请问下问题在哪啊?
作者: jefferyzhang    时间: 2020-9-9 17:12
supchao 发表于 2020-9-9 17:06
toybrick rk3399pro debian10安装opencl,之前按贴子已经刷机安装过很多次也都能成功。
今天尝试重新刷机安 ...

不用太纠结于这个吧,你自己开发CL程序时候直接link mali.so就好了。
clinfo只是给开发者看下证明我们板子上是支持CL的,你把clinfo跑通和你自己程序跑通没有任何关系呀。。
作者: cxjrk    时间: 2020-10-28 14:24
这边安装的opencl库是1.2版本的吗
作者: jefferyzhang    时间: 2020-10-28 15:48
cxjrk 发表于 2020-10-28 14:24
这边安装的opencl库是1.2版本的吗

toybrick提供的mali就是1.2的
作者: tecsai    时间: 2020-11-3 10:33
supchao 发表于 2020-9-9 17:06
toybrick rk3399pro debian10安装opencl,之前按贴子已经刷机安装过很多次也都能成功。
今天尝试重新刷机安 ...

你好,我遇到了和你一样的情况。你的cl程序能跑通吗?
作者: tecsai    时间: 2020-11-3 10:33
楼主,我遇到的情况和69楼的情况一样。这是个问题吧,怎么解决呢?
作者: tecsai    时间: 2020-11-6 14:28
楼主,我这边安装了OpenCL,但是执行cinfo时,报错:clinfo: /lib/aarch64-linux-gnu/libOpenCL.so.1: version `OPENCL_1.0' not found (required by clinfo)
按照你的说法,我没有关心这个,直接跑以前写的算子,链接的时候,-lOpenCL.
这个时候程序也是跑不通,总是在不同的地方Abort.
作者: jefferyzhang    时间: 2020-11-6 14:38
tecsai 发表于 2020-11-6 14:28
楼主,我这边安装了OpenCL,但是执行cinfo时,报错:clinfo: /lib/aarch64-linux-gnu/libOpenCL.so.1: vers ...

链接时候要-lmali库,不是-lopencl
作者: tecsai    时间: 2020-11-6 14:44
jefferyzhang 发表于 2020-11-6 14:38
链接时候要-lmali库,不是-lopencl

-lmali显示cannot find -lmali。
作者: jefferyzhang    时间: 2020-11-6 14:46
tecsai 发表于 2020-11-6 14:44
-lmali显示cannot find -lmali。

。。。话说你知道-l的意思么。。。

1. 你的板子型号是什么?
2. 有没有mali库?有的话编译时候link这个mali库即可
3. 按我这篇教程做哪步出现问题?
作者: tecsai    时间: 2020-11-6 14:50
jefferyzhang 发表于 2020-11-6 14:46
。。。话说你知道-l的意思么。。。

1. 你的板子型号是什么?

首先,知道-l是什么意思。但是我这里执行find并没有找到mali.so或者libmali.so。
1. 板子是TB96AI
2. 没有mali库
3. 按照帖子里说的,从头到尾,没有乱序。甚至重刷了系统,一样的问题。
求教大神再一次指教-l的意思。
作者: tecsai    时间: 2020-11-6 15:00
/usr/lib/aarch64-linux-gnu路径下libOpenCL.so最终连接的是libmali-toybrick.so.r18p0, 请问楼主-lOpenCL和-lmali都是链接的这个库吗?
作者: tecsai    时间: 2020-11-6 15:13
楼主,你说要执行-lmali库,我的本能思考是应该有一个类似于libmali.so的库,但实际上没有。麻烦楼主给解答一下。
作者: jefferyzhang    时间: 2020-11-6 15:21
tecsai 发表于 2020-11-6 15:00
/usr/lib/aarch64-linux-gnu路径下libOpenCL.so最终连接的是libmali-toybrick.so.r18p0, 请问楼主-lOpenCL ...

是的
作者: tecsai    时间: 2020-11-17 19:35
问题解决了,问题解决了,问题解决了,重要的事情说三遍。
作者: Jasper    时间: 2020-12-8 22:42
请问clinfo: /lib/aarch64-linux-gnu/libOpenCL.so.1: version `OPENCL_1.0' not found (required by clinfo)这个问题是怎么解决的。完全是按照教程里的方法来的,但是依然出现了这个问题,查看 ll /usr/lib/aarch64-linux-gnu/libOpenCL.so*显示的也正确,系统是debian10 网站V1.8版本烧录的。板子是RK3399proD。有知道的大神能不能说一下这个,感谢!
作者: jefferyzhang    时间: 2020-12-9 08:39
Jasper 发表于 2020-12-8 22:42
请问clinfo: /lib/aarch64-linux-gnu/libOpenCL.so.1: version `OPENCL_1.0' not found (required by clinf ...

可以下个clinfo源码在板子上编译下
作者: Jasper    时间: 2020-12-10 23:05
jefferyzhang 发表于 2020-12-9 08:39
可以下个clinfo源码在板子上编译下

感谢。编译源码之后问题解决了。
作者: soralaro    时间: 2021-1-25 11:29
本帖最后由 soralaro 于 2021-1-25 12:01 编辑

toybrick@debian10:~$ sudo toybrick-mali.sh link
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/home/toybrick
toybrick@debian10:~$ glmark2-es2-drm
Error: Failed to find a suitable connector
Error: main: Could not initialize canvas
Segmentation fault
toybrick@debian10:~$ clinfo
clinfo: /lib/aarch64-linux-gnu/libOpenCL.so.1: version `OPENCL_1.0' not found (required by clinfo)
toybrick@debian10:~$



问题解决了,下载个clinfo源码在板子上编译,就正常了

作者: soralaro    时间: 2021-1-25 11:36
本帖最后由 soralaro 于 2021-1-25 12:01 编辑

dpkg -l | grep clinfo
ii  clinfo                                2.2.18.04.06-3                      arm64        Query OpenCL system information

问题解决了,下载个clinfo源码在板子上编译,就正常了

作者: dragonbody    时间: 2021-2-1 16:37
有32bit的debian吗?
作者: rensichao    时间: 2021-10-27 14:56
soralaro 发表于 2021-1-25 11:36
dpkg -l | grep clinfo
ii  clinfo                                2.2.18.04.06-3                      ...

你好,请问clinfo源码能提供一下吗?我遇到同样的问题,下载的代码总是编译失败,谢谢!
作者: incast    时间: 2021-11-4 10:40
4. 链接mali库
sudo toybrick-mali.sh link

提示 toybrick-mali.sh: command not found
作者: randyliu2020    时间: 2022-4-8 15:50
你好~我目前在使用rk3588的板子,已经装好了clinfo,输出信息为(并未报错):
clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...)  ARM Platform
  clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...)   Success [ARM]
  clCreateContext(NULL, ...) [default]            Success [ARM]
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT)  Success (1)
    Platform Name                                 ARM Platform
    Device Name                                   Mali-LODX r0p0
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU)  No devices found in platform
  clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU)  Success (1)
    Platform Name                                 ARM Platform
    Device Name                                   Mali-LODX r0p0
  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)  Success (1)
    Platform Name                                 ARM Platform
    Device Name                                   Mali-LODX r0p0
首先第一个问题是:查询到的设备名称是Mali-LODX r0p0,应该是mali-g610吧,我不知道哪里出了问题;
第二个问题是:使用ll /usr/lib/aarch64-linux-gnu/libOpenCL.so*之后,输出信息为:
lrwxrwxrwx 1 root root    18  1月 11  2021 /usr/lib/aarch64-linux-gnu/libOpenCL.so.1 -> libOpenCL.so.1.0.0
-rw-r--r-- 1 root root 60856  1月 11  2021 /usr/lib/aarch64-linux-gnu/libOpenCL.so.1.0.0
并未链接到
libmali-valhall-g610-g6p0-x11.so
因为3399提供了类似toybrick-mali.sh这样的文件,我不知道是不是需要执行这个脚本最后才会链接到mali的gpu
作者: jefferyzhang    时间: 2022-4-8 15:55
randyliu2020 发表于 2022-4-8 15:50
你好~我目前在使用rk3588的板子,已经装好了clinfo,输出信息为(并未报错):
clGetPlatformInfo(NULL, CL ...

我们Toybrick板子都会做好,不是我们板子你问我们也没用
作者: wudiking    时间: 2022-5-25 10:23
jefferyzhang 发表于 2022-4-8 15:55
我们Toybrick板子都会做好,不是我们板子你问我们也没用

你好,我在3588x的板子上执行clinfo,失败,有什么特殊配置吗
作者: jefferyzhang    时间: 2022-5-25 10:34
wudiking 发表于 2022-5-25 10:23
你好,我在3588x的板子上执行clinfo,失败,有什么特殊配置吗

我们试过toybrick 3588板子没问题,如果你固件太旧了请烧写最新固件再试。
作者: wudiking    时间: 2022-5-25 10:47
jefferyzhang 发表于 2022-5-25 10:34
我们试过toybrick 3588板子没问题,如果你固件太旧了请烧写最新固件再试。

新买的板子,opencl库应该是软链至mali库吧
作者: jefferyzhang    时间: 2022-5-25 11:30
wudiking 发表于 2022-5-25 10:47
新买的板子,opencl库应该是软链至mali库吧

板子新的不代表固件是新的。




欢迎光临 Toybrick (https://t.rock-chips.com/) Powered by Discuz! X3.3