WIP: add an OpenCL ICD loader extension to shut down and free memory #242
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linux | |
on: [push, pull_request] | |
env: | |
OPENCL_PKGCONFIG_PATHS: ${{ github.workspace }}/install/lib/pkgconfig:${{ github.workspace }}/external/OpenCL-Headers/install/share/pkgconfig | |
jobs: | |
tools: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
CMAKE: [3.21.2] | |
env: | |
CMAKE_URL: https://github.com/Kitware/CMake/releases/download/v${{ matrix.CMAKE }}/cmake-${{ matrix.CMAKE }}-Linux-x86_64.tar.gz | |
steps: | |
- name: Cache CMake | |
uses: actions/cache@v3 | |
id: cmake | |
env: | |
cache-name: cache-cmake | |
with: | |
path: ~/cmake-${{matrix.CMAKE}}-Linux-x86_64.tar.gz | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{matrix.CMAKE}} | |
- name: Checkout CMake | |
if: steps.cmake.outputs.cache-hit != 'true' | |
run: wget -c -O ~/cmake-${{matrix.CMAKE}}-Linux-x86_64.tar.gz $CMAKE_URL | |
cmake-minimum: | |
runs-on: ${{ matrix.OS }} | |
container: streamhpc/opencl-sdk-base:ubuntu-18.04-20220127 | |
strategy: | |
matrix: | |
OS: [ubuntu-20.04] | |
COMPILER: [gcc-7, clang-8] #gcc-8 clang-10 | |
EXT: [ON, OFF] | |
GEN: [Unix Makefiles] | |
CONFIG: [Debug, Release] | |
STD: [99, 11] | |
BIN: [32, 64] | |
CMAKE: [3.1.3] #3.21.2 | |
env: | |
CMAKE_EXE: /opt/Kitware/CMake/${{ matrix.CMAKE }}/bin/cmake | |
CTEST_EXE: /opt/Kitware/CMake/${{ matrix.CMAKE }}/bin/ctest | |
OPENCL_PKGCONFIG_PATHS: /__w/OpenCL-ICD-Loader/OpenCL-ICD-Loader/install/lib/pkgconfig:/__w/OpenCL-ICD-Loader/OpenCL-ICD-Loader/external/OpenCL-Headers/install/share/pkgconfig | |
steps: | |
- name: Checkout OpenCL-ICD-Loader | |
uses: actions/checkout@v3 | |
- name: Checkout OpenCL-Headers | |
uses: actions/checkout@v3 | |
with: | |
repository: KhronosGroup/OpenCL-Headers | |
path: external/OpenCL-Headers | |
- name: Build & install OpenCL-Headers | |
run: $CMAKE_EXE | |
-G "${{matrix.GEN}}" | |
-D CMAKE_BUILD_TYPE=${{matrix.CONFIG}} | |
-D CMAKE_C_FLAGS="-w -m${{matrix.BIN}}" | |
-D CMAKE_C_COMPILER=${{matrix.COMPILER}} | |
-D CMAKE_C_STANDARD=${{matrix.STD}} | |
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}} | |
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/external/OpenCL-Headers/install | |
-D BUILD_TESTING=OFF | |
-B$GITHUB_WORKSPACE/external/OpenCL-Headers/build | |
-H$GITHUB_WORKSPACE/external/OpenCL-Headers && | |
$CMAKE_EXE | |
--build $GITHUB_WORKSPACE/external/OpenCL-Headers/build | |
--target install | |
-- | |
-j`nproc` | |
- name: Configure | |
shell: bash | |
run: $CMAKE_EXE | |
-G "${{matrix.GEN}}" | |
-D BUILD_TESTING=ON | |
-D CMAKE_BUILD_TYPE=${{matrix.CONFIG}} | |
-D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -m${{matrix.BIN}}" | |
-D CMAKE_C_COMPILER=${{matrix.COMPILER}} | |
-D CMAKE_C_STANDARD=${{matrix.STD}} | |
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}} | |
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install | |
-D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/external/OpenCL-Headers/install | |
-B$GITHUB_WORKSPACE/build | |
-H$GITHUB_WORKSPACE | |
- name: Build | |
shell: bash | |
run: $CMAKE_EXE | |
--build $GITHUB_WORKSPACE/build | |
-- | |
-j`nproc` | |
- name: Test | |
working-directory: ${{runner.workspace}}/OpenCL-ICD-Loader/build | |
shell: bash | |
run: $CTEST_EXE --output-on-failure --parallel `nproc` | |
- name: Install | |
shell: bash | |
run: $CMAKE_EXE | |
--build $GITHUB_WORKSPACE/build | |
--target install | |
-- | |
-j`nproc` | |
- name: "Consume (standalone): Configure/Build/Test" | |
shell: bash | |
run: $CMAKE_EXE | |
-G "${{matrix.GEN}}" | |
-D CMAKE_BUILD_TYPE=${{matrix.CONFIG}} | |
-D CMAKE_C_COMPILER=${{matrix.COMPILER}} | |
-D CMAKE_C_FLAGS="-Wall -Wextra -pedantic -m${{matrix.BIN}}" | |
-D CMAKE_C_STANDARD=${{matrix.STD}} | |
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}} | |
-D CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/external/OpenCL-Headers/install;$GITHUB_WORKSPACE/install" | |
-D DRIVER_STUB_PATH=$GITHUB_WORKSPACE/build/libOpenCLDriverStub.so | |
-B$GITHUB_WORKSPACE/build/downstream/bare | |
-H$GITHUB_WORKSPACE/test/pkgconfig/bare ; | |
$CMAKE_EXE | |
--build $GITHUB_WORKSPACE/build/downstream/bare ; | |
cd $GITHUB_WORKSPACE/build/downstream/bare ; | |
$CTEST_EXE --output-on-failure | |
- name: "Consume (SDK): Configure/Build/Test" | |
shell: bash | |
run: $CMAKE_EXE -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL ; | |
echo -e "include(\"$GITHUB_WORKSPACE/external/OpenCL-Headers/install/share/cmake/OpenCLHeaders/OpenCLHeadersTargets.cmake\")\ninclude(\"\${CMAKE_CURRENT_LIST_DIR}/../OpenCLICDLoader/OpenCLICDLoaderTargets.cmake\")" > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake ; | |
$CMAKE_EXE | |
-G "${{matrix.GEN}}" | |
-D CMAKE_BUILD_TYPE=${{matrix.CONFIG}} | |
-D CMAKE_C_COMPILER=${{matrix.COMPILER}} | |
-D CMAKE_C_FLAGS="-Wall -Wextra -pedantic -m${{matrix.BIN}}" | |
-D CMAKE_C_STANDARD=${{matrix.STD}} | |
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}} | |
-D CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/external/OpenCL-Headers/install;$GITHUB_WORKSPACE/install" | |
-D DRIVER_STUB_PATH=$GITHUB_WORKSPACE/build/libOpenCLDriverStub.so | |
-B$GITHUB_WORKSPACE/build/downstream/sdk | |
-H$GITHUB_WORKSPACE/test/pkgconfig/sdk ; | |
$CMAKE_EXE | |
--build $GITHUB_WORKSPACE/build/downstream/sdk ; | |
cd $GITHUB_WORKSPACE/build/downstream/sdk ; | |
$CTEST_EXE --output-on-failure | |
- name: Test pkg-config --cflags | |
shell: bash | |
run: PKG_CONFIG_PATH="$OPENCL_PKGCONFIG_PATHS" pkg-config OpenCL --cflags | grep -q "\-I$GITHUB_WORKSPACE/external/OpenCL-Headers/install/include" | |
- name: Test pkg-config --libs | |
shell: bash | |
run: PKG_CONFIG_PATH="$OPENCL_PKGCONFIG_PATHS" pkg-config OpenCL --libs | grep -q "\-L$GITHUB_WORKSPACE/install/lib -lOpenCL" | |
- name: Consume pkg-config | |
shell: bash | |
run: PKG_CONFIG_PATH="$OPENCL_PKGCONFIG_PATHS" $CMAKE_EXE | |
-G "${{matrix.GEN}}" | |
-D CMAKE_C_COMPILER=${{matrix.COMPILER}} | |
-D CMAKE_C_FLAGS="-Wall -Wextra -pedantic -m${{matrix.BIN}}" | |
-D CMAKE_C_STANDARD=${{matrix.STD}} | |
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}} | |
-D DRIVER_STUB_PATH=$GITHUB_WORKSPACE/build/libOpenCLDriverStub.so | |
-B$GITHUB_WORKSPACE/build/downstream/pkgconfig | |
-H$GITHUB_WORKSPACE/test/pkgconfig/pkgconfig ; | |
$CMAKE_EXE --build $GITHUB_WORKSPACE/build/downstream/pkgconfig ; | |
cd $GITHUB_WORKSPACE/build/downstream/pkgconfig ; | |
$CTEST_EXE --output-on-failure | |
cmake-latest: | |
needs: [tools] | |
runs-on: ${{ matrix.OS }} | |
strategy: | |
matrix: | |
OS : [ubuntu-20.04] | |
COMPILER: [gcc-9, gcc-11, clang-11, clang-13] | |
EXT: [ON, OFF] | |
GEN: [Ninja Multi-Config] | |
STD: [99, 11, 17] | |
BIN: [32, 64] | |
CMAKE: [3.21.2] | |
env: | |
CMAKE_EXE: /opt/Kitware/CMake/${{ matrix.CMAKE }}/bin/cmake | |
CTEST_EXE: /opt/Kitware/CMake/${{ matrix.CMAKE }}/bin/ctest | |
steps: | |
- name: Checkout OpenCL-ICD-Loader | |
uses: actions/checkout@v3 | |
- name: Checkout OpenCL-Headers | |
uses: actions/checkout@v3 | |
with: | |
repository: KhronosGroup/OpenCL-Headers | |
path: external/OpenCL-Headers | |
- name: Restore CMake | |
uses: actions/cache@v3 | |
id: cmake | |
env: | |
cache-name: cache-cmake | |
with: | |
path: ~/cmake-${{matrix.CMAKE}}-Linux-x86_64.tar.gz | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{matrix.CMAKE}} | |
- name: Create Build Environment | |
run: sudo apt-get update -q; | |
if [[ "${{matrix.GEN}}" =~ "Ninja" && ! `which ninja` ]]; then sudo apt install -y ninja-build; fi; | |
if [[ "${{matrix.COMPILER}}" =~ "gcc-11" ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi; | |
if [[ "${{matrix.COMPILER}}" =~ "clang-13" ]]; then wget -q -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -; sudo apt-add-repository -y 'deb [arch=amd64] https://apt.llvm.org/focal/ llvm-toolchain-focal-13 main'; fi; | |
sudo apt install -y ${{matrix.COMPILER}}; | |
if [[ "${{matrix.BIN}}" == "32" && "${{matrix.COMPILER}}" =~ "gcc" ]]; then sudo apt install -y ${{matrix.COMPILER}}-multilib; fi; | |
if [[ "${{matrix.BIN}}" == "32" && "${{matrix.COMPILER}}" =~ "clang" ]]; then sudo apt install -y gcc-multilib ; fi; | |
mkdir -p /opt/Kitware/CMake; | |
tar -xzf ~/cmake-${{matrix.CMAKE}}-Linux-x86_64.tar.gz --directory /opt/Kitware/CMake; | |
mv /opt/Kitware/CMake/cmake-${{ matrix.CMAKE }}-* /opt/Kitware/CMake/${{ matrix.CMAKE }} | |
# Install Ninja only if it's the selected generator and it's not available. | |
- name: Build & install OpenCL-Headers | |
run: $CMAKE_EXE | |
-G "${{matrix.GEN}}" | |
-D CMAKE_C_FLAGS="-w -m${{matrix.BIN}}" | |
-D CMAKE_C_COMPILER=${{matrix.COMPILER}} | |
-D CMAKE_C_STANDARD=${{matrix.STD}} | |
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}} | |
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/external/OpenCL-Headers/install | |
-D BUILD_TESTING=OFF | |
-B $GITHUB_WORKSPACE/external/OpenCL-Headers/build | |
-S $GITHUB_WORKSPACE/external/OpenCL-Headers; | |
$CMAKE_EXE | |
--build $GITHUB_WORKSPACE/external/OpenCL-Headers/build | |
--target install | |
--config Release | |
-- | |
-j`nproc` | |
- name: Configure | |
shell: bash | |
run: $CMAKE_EXE | |
-G "${{matrix.GEN}}" | |
-D BUILD_TESTING=ON | |
-D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -m${{matrix.BIN}}" | |
-D CMAKE_C_COMPILER=${{matrix.COMPILER}} | |
-D CMAKE_C_STANDARD=${{matrix.STD}} | |
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}} | |
-D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install | |
-D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/external/OpenCL-Headers/install | |
-B $GITHUB_WORKSPACE/build | |
-S $GITHUB_WORKSPACE | |
- name: Build | |
shell: bash | |
run: | | |
$CMAKE_EXE --build $GITHUB_WORKSPACE/build --config Release -- -j`nproc`; | |
$CMAKE_EXE --build $GITHUB_WORKSPACE/build --config Debug -- -j`nproc` | |
- name: Test | |
working-directory: ${{runner.workspace}}/OpenCL-ICD-Loader/build | |
shell: bash | |
run: | | |
$CTEST_EXE --output-on-failure -C Release --parallel `nproc`; | |
$CTEST_EXE --output-on-failure -C Debug --parallel `nproc`; | |
- name: Install | |
shell: bash | |
run: $CMAKE_EXE | |
--build $GITHUB_WORKSPACE/build | |
--target install | |
--config Release | |
-- | |
-j`nproc` | |
- name: "Consume (standalone): Configure/Build/Test" | |
shell: bash | |
run: $CMAKE_EXE | |
-G "${{matrix.GEN}}" | |
-D CMAKE_C_COMPILER=${{matrix.COMPILER}} | |
-D CMAKE_C_FLAGS="-Wall -Wextra -pedantic -m${{matrix.BIN}}" | |
-D CMAKE_C_STANDARD=${{matrix.STD}} | |
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}} | |
-D CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/external/OpenCL-Headers/install;$GITHUB_WORKSPACE/install" | |
-D DRIVER_STUB_PATH=$GITHUB_WORKSPACE/build/Release/libOpenCLDriverStub.so | |
-B $GITHUB_WORKSPACE/build/downstream/bare | |
-S $GITHUB_WORKSPACE/test/pkgconfig/bare; | |
$CMAKE_EXE --build $GITHUB_WORKSPACE/build/downstream/bare --config Release; | |
$CMAKE_EXE --build $GITHUB_WORKSPACE/build/downstream/bare --config Debug; | |
cd $GITHUB_WORKSPACE/build/downstream/bare; | |
$CTEST_EXE --output-on-failure -C Release; | |
$CTEST_EXE --output-on-failure -C Debug; | |
- name: "Consume (SDK): Configure/Build/Test" | |
shell: bash | |
run: $CMAKE_EXE -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL ; | |
echo -e "include(\"$GITHUB_WORKSPACE/external/OpenCL-Headers/install/share/cmake/OpenCLHeaders/OpenCLHeadersTargets.cmake\")\ninclude(\"\${CMAKE_CURRENT_LIST_DIR}/../OpenCLICDLoader/OpenCLICDLoaderTargets.cmake\")" > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake ; | |
$CMAKE_EXE | |
-G "${{matrix.GEN}}" | |
-D CMAKE_C_COMPILER=${{matrix.COMPILER}} | |
-D CMAKE_C_FLAGS="-Wall -Wextra -pedantic -m${{matrix.BIN}}" | |
-D CMAKE_C_STANDARD=${{matrix.STD}} | |
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}} | |
-D CMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/external/OpenCL-Headers/install;$GITHUB_WORKSPACE/install" | |
-D DRIVER_STUB_PATH=$GITHUB_WORKSPACE/build/Release/libOpenCLDriverStub.so | |
-B $GITHUB_WORKSPACE/build/downstream/sdk | |
-S $GITHUB_WORKSPACE/test/pkgconfig/sdk; | |
$CMAKE_EXE --build $GITHUB_WORKSPACE/build/downstream/sdk --config Release; | |
$CMAKE_EXE --build $GITHUB_WORKSPACE/build/downstream/sdk --config Debug; | |
cd $GITHUB_WORKSPACE/build/downstream/sdk; | |
$CTEST_EXE --output-on-failure -C Release; | |
$CTEST_EXE --output-on-failure -C Debug; | |
- name: Test pkg-config --cflags | |
shell: bash | |
run: PKG_CONFIG_PATH="$OPENCL_PKGCONFIG_PATHS" pkg-config OpenCL --cflags | grep -q "\-I$GITHUB_WORKSPACE/external/OpenCL-Headers/install/include" | |
- name: Test pkg-config --libs | |
shell: bash | |
run: PKG_CONFIG_PATH="$OPENCL_PKGCONFIG_PATHS" pkg-config OpenCL --libs | grep -q "\-L$GITHUB_WORKSPACE/install/lib -lOpenCL" | |
- name: Consume pkg-config | |
shell: bash | |
run: PKG_CONFIG_PATH="$OPENCL_PKGCONFIG_PATHS" $CMAKE_EXE | |
-G "${{matrix.GEN}}" | |
-D CMAKE_C_COMPILER=${{matrix.COMPILER}} | |
-D CMAKE_C_FLAGS="-Wall -Wextra -pedantic -m${{matrix.BIN}}" | |
-D CMAKE_C_STANDARD=${{matrix.STD}} | |
-D CMAKE_C_EXTENSIONS=${{matrix.EXT}} | |
-D DRIVER_STUB_PATH=$GITHUB_WORKSPACE/build/Release/libOpenCLDriverStub.so | |
-B $GITHUB_WORKSPACE/build/downstream/pkgconfig | |
-S $GITHUB_WORKSPACE/test/pkgconfig/pkgconfig; | |
$CMAKE_EXE --build $GITHUB_WORKSPACE/build/downstream/pkgconfig --config Release; | |
$CMAKE_EXE --build $GITHUB_WORKSPACE/build/downstream/pkgconfig --config Debug; | |
cd $GITHUB_WORKSPACE/build/downstream/pkgconfig; | |
$CTEST_EXE --output-on-failure -C Release; | |
$CTEST_EXE --output-on-failure -C Debug; |