Skip to content

Commit 3c1f1c7

Browse files
authored
Updates for oneAPI 2025.03 (#4730)
Starting from oneAPI 2025.3, the fsycl-device-lib flag has been deprecated. Add `-Wno-zero-length-array` to quiet a compiler warning. Note that the variable in question is generated by the compiler itself. ``` /tmp/icpx-ce94418843/global_vars-header-65acf6.h:42:49: error: zero size arrays are an extension [-Werror,-Wzero-length-array] 42 | static constexpr unsigned kernel_args_sizes[] = {}; ``` Fix deprecated `mkl::sparse::set_csr_data`.
1 parent ab576e1 commit 3c1f1c7

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

.github/workflows/intel.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ jobs:
2929
restore-keys: |
3030
ccache-${{ github.workflow }}-${{ github.job }}-git-
3131
- name: Build & Install
32-
env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -Wextra-semi -Wunreachable-code -Wnon-virtual-dtor"}
32+
# Since oneAPI 2025.3
33+
# /tmp/icpx-ce94418843/global_vars-header-65acf6.h:42:49: error: zero size arrays are an extension [-Werror,-Wzero-length-array]
34+
# 42 | static constexpr unsigned kernel_args_sizes[] = {};
35+
env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -Wextra-semi -Wunreachable-code -Wnon-virtual-dtor -Wno-zero-length-array"}
3336
run: |
3437
export CCACHE_COMPRESS=1
3538
export CCACHE_COMPRESSLEVEL=10
@@ -78,7 +81,10 @@ jobs:
7881
restore-keys: |
7982
ccache-${{ github.workflow }}-${{ github.job }}-git-
8083
- name: Build & Install
81-
env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -Wextra-semi -Wunreachable-code -Wnon-virtual-dtor"}
84+
# Since oneAPI 2025.3
85+
# /tmp/icpx-ce94418843/global_vars-header-65acf6.h:42:49: error: zero size arrays are an extension [-Werror,-Wzero-length-array]
86+
# 42 | static constexpr unsigned kernel_args_sizes[] = {};
87+
env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -Wextra-semi -Wunreachable-code -Wnon-virtual-dtor -Wno-zero-length-array"}
8288
run: |
8389
export CCACHE_COMPRESS=1
8490
export CCACHE_COMPRESSLEVEL=10

Src/LinearSolvers/AMReX_SpMV.H

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#elif defined(AMREX_USE_HIP)
1212
# include <rocsparse/rocsparse.h>
1313
#elif defined(AMREX_USE_SYCL)
14+
# include <mkl_version.h>
1415
# include <oneapi/mkl/spblas.hpp>
1516
#endif
1617

@@ -170,8 +171,14 @@ void SpMV (AlgVector<T>& y, SpMatrix<T> const& A, AlgVector<T> const& x)
170171

171172
amrex::ignore_unused(nnz);
172173
mkl::sparse::matrix_handle_t handle{};
173-
mkl::sparse::set_csr_data(Gpu::Device::streamQueue(), handle, nrows, ncols, mkl::index_base::zero,
174-
(Long*)row, (Long*)col, (T*)mat);
174+
175+
#if defined(INTEL_MKL_VERSION) && (INTEL_MKL_VERSION < 20250300)
176+
mkl::sparse::set_csr_data(Gpu::Device::streamQueue(), handle, nrows, ncols,
177+
mkl::index_base::zero, (Long*)row, (Long*)col, (T*)mat);
178+
#else
179+
mkl::sparse::set_csr_data(Gpu::Device::streamQueue(), handle, nrows, ncols, nnz,
180+
mkl::index_base::zero, (Long*)row, (Long*)col, (T*)mat);
181+
#endif
175182
mkl::sparse::gemv(Gpu::Device::streamQueue(), mkl::transpose::nontrans,
176183
T(1), handle, px, T(0), py);
177184

Tools/CMake/AMReXSYCL.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ endif()
5353
#
5454
target_link_options( SYCL
5555
INTERFACE
56-
$<${_cxx_sycl}:-qmkl=sequential -fsycl -fsycl-device-lib=libc,libm-fp32,libm-fp64> )
56+
$<${_cxx_sycl}:-qmkl=sequential -fsycl> )
57+
58+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2025.3)
59+
target_link_options( SYCL
60+
INTERFACE
61+
$<${_cxx_sycl}:-fsycl-device-lib=libc,libm-fp32,libm-fp64> )
62+
endif()
5763

5864

5965
# TODO: use $<LINK_LANG_AND_ID:> genex for CMake >=3.17

Tools/GNUMake/comps/dpcpp.mak

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ F90 = ifx
99
amrex_oneapi_version = $(shell $(CXX) --version | head -1)
1010
$(info oneAPI version: $(amrex_oneapi_version))
1111

12+
amrex_oneapi_version_major = $(shell $(CXX) --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 | cut -d. -f1)
13+
amrex_oneapi_version_minor = $(shell $(CXX) --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 | cut -d. -f2)
14+
1215
CXXFLAGS =
1316
CFLAGS =
1417
FFLAGS =
@@ -131,7 +134,24 @@ ifneq ($(BL_NO_FORT),TRUE)
131134
endif
132135
endif
133136

134-
LDFLAGS += -qmkl=sequential -fsycl-device-lib=libc,libm-fp32,libm-fp64
137+
LDFLAGS += -qmkl=sequential
138+
139+
amrex_oneapi_major_lt_2025 = $(shell expr $(amrex_oneapi_version_major) \< 2025)
140+
amrex_oneapi_minor_le_2 = $(shell expr $(amrex_oneapi_version_minor) \<= 2)
141+
142+
ifeq ($(amrex_oneapi_major_lt_2025),1)
143+
amrex_add_sycl_device_lib = 1
144+
endif
145+
146+
ifeq ($(amrex_oneapi_version_major),2025)
147+
ifeq ($(amrex_oneapi_minor_le_2),1)
148+
amrex_add_sycl_device_lib = 1
149+
endif
150+
endif
151+
152+
ifeq ($(amrex_add_sycl_device_lib),1)
153+
LDFLAGS += -fsycl-device-lib=libc,libm-fp32,libm-fp64
154+
endif
135155

136156
ifdef SYCL_PARALLEL_LINK_JOBS
137157
LDFLAGS += -fsycl-max-parallel-link-jobs=$(SYCL_PARALLEL_LINK_JOBS)

0 commit comments

Comments
 (0)