目次
文書の過去の版を表示しています。
VideoCore IV GPU で OpenCL
ビルド依存パッケージのインストール
$ sudo apt update
Hit:1 http://raspbian.raspberrypi.com/raspbian bookworm InRelease Hit:2 https://dietpi.com/apt bookworm InRelease Hit:3 https://dietpi.com/apt all InRelease Hit:4 https://archive.raspberrypi.com/debian bookworm InRelease Reading package lists... Done Building dependency tree... Done Reading state information... Done All packages are up to date.
$ 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 clang-format clang-tidy
Reading package lists... Done Building dependency tree... Done Reading state information... Done clang is already the newest version (1:14.0-55.7~deb12u1). clang-format is already the newest version (1:14.0-55.7~deb12u1). clang-tidy is already the newest version (1:14.0-55.7~deb12u1). 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
VC4CLStdLib のビルド & インストール
cd ../../VC4C $ mkdir build && cd build