hardware:raspberry_pi:dietpi:opencl_on_videocore_iv_gpu

文書の過去の版を表示しています。


VideoCore IV GPU で OpenCL

$ sudo apt update && sudo apt upgrade

Hit:1 https://dietpi.com/apt bookworm InRelease
Hit:2 https://dietpi.com/apt all InRelease
Get:3 http://raspbian.raspberrypi.com/raspbian bookworm InRelease [15.0 kB]
Get:4 https://archive.raspberrypi.com/debian bookworm InRelease [23.6 kB]
Get:5 http://raspbian.raspberrypi.com/raspbian bookworm/main Sources [13.7 MB]
Get:6 https://archive.raspberrypi.com/debian bookworm/main armhf Packages [392 kB]
Get:7 https://archive.raspberrypi.com/debian bookworm/main armhf Contents (deb) [2,994 kB]
Get:8 http://raspbian.raspberrypi.com/raspbian bookworm/main armhf Packages [14.5 MB]
Fetched 31.7 MB in 1min 48s (292 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ sudo apt install cmake git

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
cmake is already the newest version (3.25.1-1).
git is already the newest version (1:2.39.2-1.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ sudo apt install opencl-headers

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
opencl-headers is already the newest version (3.0~2023.02.06-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ sudo apt install ocl-icd-opencl-dev ocl-icd-dev

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
ocl-icd-opencl-dev is already the newest version (2.3.1-1).
ocl-icd-dev is already the newest version (2.3.1-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ sudo apt install libraspberrypi-dev

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libraspberrypi-dev is already the newest version (1:2+git20231018~131943+3c97f76-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ sudo apt install clang-14 clang-format-14 clang-tidy-14

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
clang-14 is already the newest version (1:14.0.6-12+rpi1).
clang-14 set to manually installed.
clang-format-14 is already the newest version (1:14.0.6-12+rpi1).
clang-format-14 set to manually installed.
clang-tidy-14 is already the newest version (1:14.0.6-12+rpi1).
clang-tidy-14 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ sudo apt install llvm-14 libllvm14 libllvmspirvlib-14-dev libllvmspirvlib14

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libllvm14 is already the newest version (1:14.0.6-12+rpi1).
libllvm14 set to manually installed.
The following additional packages will be installed:
  libcurl3-nss libpfm4 llvm-14-runtime nss-plugin-pem
Suggested packages:
  llvm-14-doc
Recommended packages:
  llvm-14-dev
The following NEW packages will be installed:
  libcurl3-nss libllvmspirvlib-14-dev libllvmspirvlib14 libpfm4 llvm-14 llvm-14-runtime nss-plugin-pem
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 11.5 MB of archives.
After this operation, 46.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://raspbian.raspberrypi.com/raspbian bookworm/main armhf nss-plugin-pem armhf 1.0.8+1-1 [39.5 kB]
Get:2 http://raspbian.raspberrypi.com/raspbian bookworm/main armhf libcurl3-nss armhf 7.88.1-10+rpi1+deb12u5 [349 kB]
Get:3 http://raspbian.raspberrypi.com/raspbian bookworm/main armhf libllvmspirvlib14 armhf 14.0.0-5+rpi1 [578 kB]
Get:4 http://raspbian.raspberrypi.com/raspbian bookworm/main armhf libllvmspirvlib-14-dev armhf 14.0.0-5+rpi1 [9,068 B]
Get:5 http://ftp.udx.icscoe.jp/Linux/raspbian/raspbian bookworm/main armhf libpfm4 armhf 4.13.0-1 [45.3 kB]  
Get:6 http://raspbian.raspberrypi.com/raspbian bookworm/main armhf llvm-14-runtime armhf 1:14.0.6-12+rpi1 [430 kB]
Get:7 http://raspbian.raspberrypi.com/raspbian bookworm/main armhf llvm-14 armhf 1:14.0.6-12+rpi1 [10.0 MB]  
Fetched 11.5 MB in 38s (301 kB/s)                                                                            
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package nss-plugin-pem:armhf.
(Reading database ... 141638 files and directories currently installed.)
Preparing to unpack .../0-nss-plugin-pem_1.0.8+1-1_armhf.deb ...
Unpacking nss-plugin-pem:armhf (1.0.8+1-1) ...
Selecting previously unselected package libcurl3-nss:armhf.
Preparing to unpack .../1-libcurl3-nss_7.88.1-10+rpi1+deb12u5_armhf.deb ...
Unpacking libcurl3-nss:armhf (7.88.1-10+rpi1+deb12u5) ...
Selecting previously unselected package libllvmspirvlib14:armhf.
Preparing to unpack .../2-libllvmspirvlib14_14.0.0-5+rpi1_armhf.deb ...
Unpacking libllvmspirvlib14:armhf (14.0.0-5+rpi1) ...
Selecting previously unselected package libllvmspirvlib-14-dev:armhf.
Preparing to unpack .../3-libllvmspirvlib-14-dev_14.0.0-5+rpi1_armhf.deb ...
Unpacking libllvmspirvlib-14-dev:armhf (14.0.0-5+rpi1) ...
Selecting previously unselected package libpfm4:armhf.
Preparing to unpack .../4-libpfm4_4.13.0-1_armhf.deb ...
Unpacking libpfm4:armhf (4.13.0-1) ...
Selecting previously unselected package llvm-14-runtime.
Preparing to unpack .../5-llvm-14-runtime_1%3a14.0.6-12+rpi1_armhf.deb ...
Unpacking llvm-14-runtime (1:14.0.6-12+rpi1) ...
Selecting previously unselected package llvm-14.
Preparing to unpack .../6-llvm-14_1%3a14.0.6-12+rpi1_armhf.deb ...
Unpacking llvm-14 (1:14.0.6-12+rpi1) ...
Setting up libllvmspirvlib14:armhf (14.0.0-5+rpi1) ...
Setting up nss-plugin-pem:armhf (1.0.8+1-1) ...
Setting up libpfm4:armhf (4.13.0-1) ...
Setting up llvm-14-runtime (1:14.0.6-12+rpi1) ...
Setting up libcurl3-nss:armhf (7.88.1-10+rpi1+deb12u5) ...
Setting up llvm-14 (1:14.0.6-12+rpi1) ...
Setting up libllvmspirvlib-14-dev:armhf (14.0.0-5+rpi1) ...
Processing triggers for systemd (252.17-1~deb12u1+rpi1) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for libc-bin (2.36-9+rpt2+deb12u4) ...

$ sudo apt install clinfo

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
clinfo is already the newest version (3.0.23.01.25-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 14

update-alternatives: using /usr/bin/clang-14 to provide /usr/bin/clang (clang) in auto mode

$ sudo update-alternatives --config clang

There is 1 choice for the alternative clang (providing /usr/bin/clang).

  Selection    Path               Priority   Status
------------------------------------------------------------
* 0            /usr/bin/clang-14   14        auto mode
  1            /usr/bin/clang-14   14        manual mode

Press <enter> to keep the current choice[*], or type selection number: 

$ clang --version

Raspbian clang version 14.0.6
Target: arm-unknown-linux-gnueabihf
Thread model: posix
InstalledDir: /usr/bin

$ sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-14 14

update-alternatives: using /usr/bin/llvm-config-14 to provide /usr/bin/llvm-config (llvm-config) in auto mode

$ sudo update-alternatives --config llvm-config

There is 1 choice for the alternative llvm-config (providing /usr/bin/llvm-config).

  Selection    Path                     Priority   Status
------------------------------------------------------------
* 0            /usr/bin/llvm-config-14   14        auto mode
  1            /usr/bin/llvm-config-14   14        manual mode

Press <enter> to keep the current choice[*], or type selection number: 

$ llvm-config --version

14.0.6

ソースコードの clone …🤔

$ mkdir opencl && cd opencl
$ git clone --depth 1 https://github.com/doe300/VC4CLStdLib.git

Cloning into 'VC4CLStdLib'...
remote: Enumerating objects: 38, done.
remote: Counting objects: 100% (38/38), done.
remote: Compressing objects: 100% (38/38), done.
remote: Total 38 (delta 1), reused 14 (delta 0), pack-reused 0
Receiving objects: 100% (38/38), 151.65 KiB | 404.00 KiB/s, done.
Resolving deltas: 100% (1/1), done.

$ git clone https://github.com/doe300/VC4C.git

Cloning into 'VC4C'...
remote: Enumerating objects: 14476, done.
remote: Counting objects: 100% (3209/3209), done.
remote: Compressing objects: 100% (577/577), done.
remote: Total 14476 (delta 2626), reused 3192 (delta 2616), pack-reused 11267
Receiving objects: 100% (14476/14476), 26.52 MiB | 369.00 KiB/s, done.
Resolving deltas: 100% (11603/11603), done.
Updating files: 100% (1607/1607), done.

$ git clone https://github.com/doe300/VC4CL.git

Cloning into 'VC4CL'...
remote: Enumerating objects: 2119, done.
remote: Counting objects: 100% (118/118), done.
remote: Compressing objects: 100% (83/83), done.
remote: Total 2119 (delta 40), reused 39 (delta 35), pack-reused 2001
Receiving objects: 100% (2119/2119), 1.05 MiB | 254.00 KiB/s, done.
Resolving deltas: 100% (1657/1657), done.

$ cd VC4CLStdLib
$ mkdir build && cd build
$ cmake ..

-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- build deb package...
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dietpi/opencl/VC4CLStdLib/build

$ make

[100%] Linking C static library libVC4CLStdLib.a
[100%] Built target VC4CLStdLib

$ sudo make install && sudo ldconfig

[100%] Built target VC4CLStdLib
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/include/vc4cl-stdlib
-- Installing: /usr/local/include/vc4cl-stdlib/_atomics.h
-- Installing: /usr/local/include/vc4cl-stdlib/opencl-c.h
-- Installing: /usr/local/include/vc4cl-stdlib/_integer.h
-- Installing: /usr/local/include/vc4cl-stdlib/defines.h
-- Installing: /usr/local/include/vc4cl-stdlib/_printf.h
-- Installing: /usr/local/include/vc4cl-stdlib/_spir_mangling.h
-- Installing: /usr/local/include/vc4cl-stdlib/_config.h
-- Installing: /usr/local/include/vc4cl-stdlib/_relational.h
-- Installing: /usr/local/include/vc4cl-stdlib/_common.h
-- Installing: /usr/local/include/vc4cl-stdlib/_work_items.h
-- Installing: /usr/local/include/vc4cl-stdlib/_extensions.h
-- Installing: /usr/local/include/vc4cl-stdlib/_geometric.h
-- Installing: /usr/local/include/vc4cl-stdlib/_images.h
-- Installing: /usr/local/include/vc4cl-stdlib/_overloads.h
-- Installing: /usr/local/include/vc4cl-stdlib/_math.h
-- Installing: /usr/local/include/vc4cl-stdlib/_vector.h
-- Installing: /usr/local/include/vc4cl-stdlib/_intrinsics.h
-- Installing: /usr/local/include/vc4cl-stdlib/_synchronization.h
-- Installing: /usr/local/include/vc4cl-stdlib/_conversions.h
-- Installing: /usr/local/include/vc4cl-stdlib/_clcxx_mangling.h
-- Installing: /usr/local/include/vc4cl-stdlib/_float_float.h
-- Installing: /usr/local/include/vc4cl-stdlib/_async.h
-- Installing: /usr/local/include/vc4cl-stdlib/VC4CLStdLib.h

$ cd ../../VC4CL
$ mkdir build && cd build
$ cmake ..

-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1") 
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for CL_VERSION_3_0
-- Looking for CL_VERSION_3_0 - found
-- Found OpenCL: /usr/lib/arm-linux-gnueabihf/libOpenCL.so (found version "3.0") 
-- Found headers for OpenCL up to version 3.0 located in /usr/include
-- No VC4C compiler library found!
-- VC4C compiler header found at: /home/dietpi/opencl/VC4C/include/VC4C.h
-- Looking for wsyncup in /usr/lib/arm-linux-gnueabihf/libcurses.so
-- Looking for wsyncup in /usr/lib/arm-linux-gnueabihf/libcurses.so - found
-- Looking for cbreak in /usr/lib/arm-linux-gnueabihf/libncurses.so
-- Looking for cbreak in /usr/lib/arm-linux-gnueabihf/libncurses.so - found
-- Looking for nodelay in /usr/lib/arm-linux-gnueabihf/libncurses.so
-- Looking for nodelay in /usr/lib/arm-linux-gnueabihf/libncurses.so - found
-- Found Curses: /usr/lib/arm-linux-gnueabihf/libncurses.so  
-- vcsm library not found
-- found clang-format: /usr/bin/clang-format
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
VC4CC_LIBRARY
    linked by target "VC4CL" in directory /home/dietpi/opencl/VC4CL/src

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

$ make


  • hardware/raspberry_pi/dietpi/opencl_on_videocore_iv_gpu.1713915818.txt.gz
  • 最終更新: 2024/04/24 08:43
  • by ともやん