目次
文書の過去の版を表示しています。
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 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.
ソースコードからビルドする...🤔
ソースコードの 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.
VC4CLStdLib のビルド & インストール
$ 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
VC4CL のビルド & インストール
$ 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