Skip to content

Commit 549ed84

Browse files
committed
Fix build errors and improve CI config
* Fix -Wmissing-template-arg-list-after-template-kw compilation errors in nbody and fluid demos. * Fix sycl-ls regex in ConfigureSYCL.cmake following the removal of "ext_oneapi" from backend names. * Update ConfigureSYCL.cmake default CUDA and HIP arch to the oldest supported by oneAPI 2025.0. * Improve OpenMP CMake test in matrix_multiply_omp_compare sample. Previously it assumed all clang++ drivers support -fopenmp. This is only true in the oneAPI base toolkit version, but the open-source DPC++ nightly releases are built without libomp.so and linking with -fopenmp fails. Use try_compile to figure out if -fopenmp works. * Add a warning suppresion file to suppress CI build failures in external code from submodules. * Update the CI container with newer versions of CUDA and ROCm, and use a recent DPC++ open-source nightly instead of a oneAPI Toolkit release. * Restore CI workflow's permission to push containers to registry.
1 parent def41b4 commit 549ed84

File tree

7 files changed

+60
-44
lines changed

7 files changed

+60
-44
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on: [push, pull_request]
44

55
permissions:
66
contents: read
7+
packages: write
78

89
env:
910
REGISTRY: ghcr.io
@@ -108,7 +109,7 @@ jobs:
108109
-DENABLE_SPIR=ON
109110
-DENABLE_CUDA=ON -DCUDA_COMPUTE_CAPABILITY=80
110111
-DENABLE_HIP=ON -DHIP_GFX_ARCH=gfx90a
111-
-DCMAKE_CXX_FLAGS='-Wall -Wextra -Wpedantic -Werror'
112+
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror --warning-suppression-mappings=${PWD}/ci/warning-suppresions.txt"
112113
-G Ninja
113114
114115
- name: Build

ci/Dockerfile

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,36 @@
11
FROM ubuntu:24.04@sha256:3f85b7caad41a95462cf5b787d8a04604c8262cdcdf9a472b8c52ef83375fe15
22

33
# Get basic dependencies from Ubuntu repositories
4-
RUN apt update && apt -y install wget gpg git cmake ninja-build \
5-
gcc-12 libstdc++-12-dev libsdl2-dev \
4+
ARG DEBIAN_FRONTEND=noninteractive
5+
RUN apt update \
6+
&& apt -y install wget gpg git cmake ninja-build g++ libsdl2-dev \
67
&& apt clean
78

89
# Install nvcc (dependency for compiling for a CUDA target)
9-
ARG CUDA_VERSION=12-4
10+
ARG CUDA_VERSION=12-8
1011
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb \
1112
&& dpkg -i cuda-keyring_1.0-1_all.deb && rm cuda-keyring_1.0-1_all.deb \
1213
&& apt update && apt -y install cuda-nvcc-${CUDA_VERSION} && apt clean
1314

1415
# Install ROCm device libs (dependency for compiling for a HIP target)
15-
ARG ROCM_VERSION=5.4.3
16+
ARG ROCM_VERSION=6.2.4
1617
RUN wget https://repo.radeon.com/rocm/rocm.gpg.key -O - \
1718
| gpg --dearmor | tee /etc/apt/keyrings/rocm.gpg > /dev/null \
1819
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/${ROCM_VERSION} jammy main" \
1920
| tee /etc/apt/sources.list.d/rocm.list \
20-
&& apt update && apt -y install rocm-device-libs && apt clean
21+
&& apt update && apt -y install rocm-device-libs${ROCM_VERSION} && apt clean
2122

22-
# Install DPC++ and remove parts we don't need to reduce the container size
23-
ARG ONEAPI_VERSION=2024.1
24-
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
25-
| gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null \
26-
&& echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \
27-
| tee /etc/apt/sources.list.d/oneAPI.list \
28-
&& apt update && apt -y install intel-oneapi-compiler-dpcpp-cpp-${ONEAPI_VERSION} \
29-
&& apt clean \
30-
&& cd /opt/intel/oneapi \
31-
&& rm -rf conda_channel debugger dev-utilities dpl compiler/latest/linux/lib/oclfpga
23+
# Download DPC++ nightly release
24+
ARG DPCPP_NIGHTLY=2025-03-06
25+
RUN mkdir /opt/dpcpp \
26+
&& wget -q -P /opt/dpcpp https://github.com/intel/llvm/releases/download/nightly-${DPCPP_NIGHTLY}/sycl_linux.tar.gz \
27+
&& tar -C /opt/dpcpp -xzf /opt/dpcpp/sycl_linux.tar.gz \
28+
&& rm /opt/dpcpp/sycl_linux.tar.gz
3229

3330
# Set up the environment
34-
ENV ONEAPI_ROOT=/opt/intel/oneapi
35-
ENV CMPLR_ROOT=${ONEAPI_ROOT}/compiler/latest
36-
ENV PATH=${CMPLR_ROOT}/bin:${CMPLR_ROOT}/bin/compiler:${PATH}
37-
ENV CPATH=${CMPLR_ROOT}/include:${CPATH}
38-
ENV LIBRARY_PATH=${CMPLR_ROOT}/lib:${LIBRARY_PATH}
39-
ENV LD_LIBRARY_PATH=${CMPLR_ROOT}/lib:${LD_LIBRARY_PATH}
40-
ENV HIP_DEVICE_LIB_PATH=/usr/lib/x86_64-linux-gnu/amdgcn/bitcode
41-
42-
# Set up entry point
43-
ENTRYPOINT []
44-
CMD /bin/bash
31+
ENV DPCPP_ROOT=/opt/dpcpp
32+
ENV PATH=${DPCPP_ROOT}/bin:${PATH}
33+
ENV CPATH=${DPCPP_ROOT}/include:${CPATH}
34+
ENV LIBRARY_PATH=${DPCPP_ROOT}/lib:${LIBRARY_PATH}
35+
ENV LD_LIBRARY_PATH=${DPCPP_ROOT}/lib:${LD_LIBRARY_PATH}
36+
ENV HIP_DEVICE_LIB_PATH=/opt/rocm/amdgcn/bitcode

ci/warning-suppresions.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Suppress warnings in external code from submodules
2+
3+
[nontrivial-memcall]
4+
src:*/modules/imgui/*
5+
6+
[deprecated-literal-operator]
7+
src:*/modules/corrade/*
8+
src:*/modules/magnum/*

cmake/ConfigureSYCL.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
# Detect available backends
2323
# ------------------------------------------------
2424
execute_process(
25-
COMMAND bash -c "! sycl-ls | grep -q ext_oneapi_cuda"
25+
COMMAND bash -c "! sycl-ls | grep -q cuda"
2626
RESULT_VARIABLE CUDA_BACKEND_AVAILABLE)
2727
execute_process(
28-
COMMAND bash -c "! sycl-ls | grep -q ext_oneapi_hip"
28+
COMMAND bash -c "! sycl-ls | grep -q hip"
2929
RESULT_VARIABLE HIP_BACKEND_AVAILABLE)
3030
execute_process(
3131
COMMAND bash -c "! sycl-ls | grep -q 'opencl\\|level_zero'"
@@ -41,7 +41,7 @@ set(SYCL_TARGETS "")
4141
# ------------------------------------------------
4242
if(${ENABLE_CUDA})
4343
string(JOIN "," SYCL_TARGETS "${SYCL_TARGETS}" "nvptx64-nvidia-cuda")
44-
set(DEFAULT_CUDA_COMPUTE_CAPABILITY "50")
44+
set(DEFAULT_CUDA_COMPUTE_CAPABILITY "60")
4545
set(CUDA_COMPUTE_CAPABILITY "" CACHE BOOL
4646
"CUDA architecture (compute capability), e.g. sm_80. Default value is auto-configured using nvidia-smi.")
4747
# Auto-configure if not specified by user
@@ -65,7 +65,7 @@ endif()
6565
# ------------------------------------------------
6666
if(${ENABLE_HIP})
6767
string(JOIN "," SYCL_TARGETS "${SYCL_TARGETS}" "amdgcn-amd-amdhsa")
68-
set(DEFAULT_HIP_GFX_ARCH "gfx906")
68+
set(DEFAULT_HIP_GFX_ARCH "gfx908")
6969
set(HIP_GFX_ARCH "" CACHE BOOL
7070
"HIP architecture tag, e.g. gfx90a. Default value is auto-configured using rocminfo.")
7171
# Auto-configure if not specified by user

src/fluid/fluid.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class SYCLFluidContainer {
8080
// Returns a pointer to the pixel data buffer.
8181
template <typename Func>
8282
void WithData(Func&& func) {
83-
auto acc{img.template get_host_access(sycl::read_only)};
83+
auto acc{img.template get_host_access<>(sycl::read_only)};
8484
func(acc.get_pointer());
8585
}
8686

@@ -207,8 +207,8 @@ class SYCLFluidContainer {
207207
// Update the image pixel data with the appropriate color for a given
208208
// density.
209209
queue.submit([&](sycl::handler& cgh) {
210-
auto img_acc{img.template get_access(cgh, sycl::write_only)};
211-
auto density_a{density_b.template get_access(cgh, sycl::read_write)};
210+
auto img_acc{img.template get_access<>(cgh, sycl::write_only)};
211+
auto density_a{density_b.template get_access<>(cgh, sycl::read_write)};
212212
cgh.parallel_for<image_kernal>(
213213
sycl::range<1>(size * size), [=](sycl::item<1> item) {
214214
auto index{item.get_id(0)};
@@ -240,7 +240,7 @@ class SYCLFluidContainer {
240240
// Creates read_write accessors from a buffer.
241241
template <typename T>
242242
static read_write_accessor CreateAccessor(sycl::handler& cgh, T buffer) {
243-
return buffer.template get_access(cgh, sycl::read_write);
243+
return buffer.template get_access<>(cgh, sycl::read_write);
244244
}
245245

246246
// Get clamped index based off of coordinates.

src/matrix_multiply_omp_compare/CMakeLists.txt

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,25 @@ set(MATRIX_MULTIPLY_FLAGS ${SYCL_FLAGS})
44
find_package(OpenMP QUIET)
55
if(OpenMP_CXX_FOUND)
66
target_link_libraries(matrix_multiply_omp_compare PUBLIC OpenMP::OpenMP_CXX)
7+
message(STATUS "Found OpenMP: ${OpenMP_omp_LIBRARY}")
78
elseif(CMAKE_CXX_COMPILER MATCHES "clang")
8-
# CMake's FindOpenMP doesn't recognise LLVM internal implementation, but
9-
# it's still possible to parallelise OpenMP loops with clang++ -fopenmp
10-
list(APPEND MATRIX_MULTIPLY_FLAGS -fopenmp)
9+
# CMake's FindOpenMP doesn't recognise that oneAPI Base Toolkit clang++
10+
# compiler driver supports the -fopenmp flag. However, other clang++ builds
11+
# may not support it. Test whether clang++ -fopenmp works to determine if we
12+
# can use it.
13+
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/omp-test.cpp "int main(){}")
14+
try_compile(CLANG_SUPPORTS_FOPENMP
15+
${CMAKE_CURRENT_BINARY_DIR}
16+
${CMAKE_CURRENT_BINARY_DIR}/omp-test.cpp
17+
COMPILE_DEFINITIONS -fopenmp
18+
LINK_OPTIONS -fopenmp)
19+
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/omp-test.cpp)
20+
if (CLANG_SUPPORTS_FOPENMP)
21+
message(STATUS "Found OpenMP: supported with clang++ -fopenmp flag")
22+
list(APPEND MATRIX_MULTIPLY_FLAGS -fopenmp)
23+
else()
24+
message(STATUS "OpenMP not found, matrix_multiply_omp_compare will compare SYCL to serial CPU execution")
25+
endif()
1126
else()
1227
message(STATUS "OpenMP not found, matrix_multiply_omp_compare will compare SYCL to serial CPU execution")
1328
endif()

src/nbody/sycl_bufs.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct BufToReadAccFunc {
3131
template <typename In>
3232
AUTO_FUNC(
3333
// pair of (buffer, handler)
34-
operator()(In && in), std::forward<In>(in).first.template get_access(
34+
operator()(In && in), std::forward<In>(in).first.template get_access<>(
3535
*std::forward<In>(in).second, sycl::read_only))
3636
};
3737

@@ -40,27 +40,27 @@ struct BufToDcdWriteAccFunc {
4040
// pair of (buffer, handler)
4141
template <typename In>
4242
AUTO_FUNC(operator()(In && in),
43-
std::forward<In>(in).first.template get_access(
43+
std::forward<In>(in).first.template get_access<>(
4444
*std::forward<In>(in).second, sycl::write_only))
4545
};
4646

4747
// Template function object which transforms buffers to host read accessors
4848
struct BufToHostReadAccFunc {
4949
template <typename In>
5050
auto operator()(In&& in)
51-
-> decltype(std::forward<In>(in).template get_host_access(
51+
-> decltype(std::forward<In>(in).template get_host_access<>(
5252
sycl::read_only)) {
53-
return std::forward<In>(in).template get_host_access(sycl::read_only);
53+
return std::forward<In>(in).template get_host_access<>(sycl::read_only);
5454
}
5555
};
5656

5757
// Template function object which transforms buffers to host write accessors
5858
struct BufToHostDcdWriteAccFunc {
5959
template <typename In>
6060
auto operator()(In&& in)
61-
-> decltype(std::forward<In>(in).template get_host_access(
61+
-> decltype(std::forward<In>(in).template get_host_access<>(
6262
sycl::write_only)) {
63-
return std::forward<In>(in).template get_host_access(sycl::write_only);
63+
return std::forward<In>(in).template get_host_access<>(sycl::write_only);
6464
}
6565
};
6666

0 commit comments

Comments
 (0)