Skip to content

Commit

Permalink
OpenCL CI trial and error
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiomestre committed Oct 25, 2023
1 parent 3a3aae3 commit be75536
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 4 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,38 @@ jobs:
strategy:
matrix:
adapter: [
{name: CUDA, triplet: nvptx64-nvidia-cuda},
{name: HIP, triplet: spir64}, # should be amdgcn-amdhsa, but build scripts for device binaries are currently broken for this target.
{name: L0, triplet: spir64}
{name: CUDA, runner: CUDA, triplet: nvptx64-nvidia-cuda},
{name: HIP, runner: HIP, triplet: spir64}, # should be amdgcn-amdhsa, but build scripts for device binaries are currently broken for this target.
{name: L0, runner: L0, triplet: spir64},
{name: OPENCL, runner: ubuntu-latest, triplet: spir64}
]
build_type: [Debug, Release]
compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}]

runs-on: ${{matrix.adapter.name}}
runs-on: ${{matrix.adapter.runner}}

steps:
- uses: actions/checkout@v3

- name: Install pip packages
run: pip install -r third_party/requirements.txt

- name: Install OpenCL
if: matrix.adapter.name == 'OpenCL'
run: |
sudo apt-get update
sudo apt-get install ocl-icd-libopencl1
mkdir intel-ocl-packages
cd intel-ocl-packages
wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.14828.8/intel-igc-core_1.0.14828.8_amd64.deb
wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.14828.8/intel-igc-opencl_1.0.14828.8_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/intel-level-zero-gpu-dbgsym_1.3.26918.9_amd64.ddeb
wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/intel-level-zero-gpu_1.3.26918.9_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/intel-opencl-icd-dbgsym_23.30.26918.9_amd64.ddeb
wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/intel-opencl-icd_23.30.26918.9_amd64.deb
wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/libigdgmm12_22.3.0_amd64.deb
sudo dpkg -i *.deb
- name: Download DPC++
run: |
wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2023-09-21/sycl_linux.tar.gz
Expand Down
28 changes: 28 additions & 0 deletions source/adapters/opencl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,34 @@ set_target_properties(${TARGET_NAME} PROPERTIES

find_package(Threads REQUIRED)

if(NOT OpenCL_INCLUDE_DIR)
set(OPENCL_HEADERS_REPO "https://github.com/KhronosGroup/OpenCL-Headers.git")
set(OPENCL_HEADERS_HASH 9ddb236e6eb3cf844f9e2f81677e1045f9bf838e)

FetchContent_Declare(ocl-headers
GIT_REPOSITORY ${OPENCL_HEADERS_REPO}
GIT_TAG ${OPENCL_HEADERS_HASH}
)
FetchContent_MakeAvailable(ocl-headers)
FetchContent_GetProperties(ocl-headers)

set(OpenCL_INCLUDE_DIR ${ocl-headers_SOURCE_DIR} CACHE PATH "Path to OpenCL Headers")
endif()

if(NOT OpenCL_LIBRARY)
set(OPENCL_ICD_LOADER_REPO "https://github.com/KhronosGroup/OpenCL-ICD-Loader.git")
set(OPENCL_ICD_LOADER_HASH 9a3e962f16f5097d2054233ad8b6dad51b6f41b7)

FetchContent_Declare(ocl-icd-loader
GIT_REPOSITORY ${OPENCL_ICD_LOADER_REPO}
GIT_TAG ${OPENCL_ICD_LOADER_HASH}
)
FetchContent_MakeAvailable(ocl-icd-loader)
FetchContent_GetProperties(ocl-icd-loader)

set(OpenCL_LIBRARY ${PROJECT_BINARY_DIR}/lib/libOpenCL.so CACHE PATH "Path to OpenCL ICD Loader")
endif()

# The OpenCL target can be set manually on upstream cmake to avoid using find_package().
if (NOT UR_OPENCL_ICD_LOADER_LIBRARY)
find_package(OpenCL REQUIRED)
Expand Down

0 comments on commit be75536

Please sign in to comment.