Skip to content

Commit db44872

Browse files
Merge pull request #528 from IntelPython/cleanup/find-intel-sycl
Cleanup/find intel sycl
2 parents 8a55469 + 6fce291 commit db44872

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

conda-recipe/bld.bat

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
call "%ONEAPI_ROOT%\compiler\latest\env\vars.bat"
2-
if errorlevel 1 (
3-
echo "oneAPI compiler activation failed"
4-
exit /b 1
5-
)
1+
2+
REM A workaround for activate-dpcpp.bat issue to be addressed in 2021.4
3+
set "LIB=%BUILD_PREFIX%\Library\lib;%BUILD_PREFIX%\compiler\lib;%LIB%"
4+
set "INCLUDE=%BUILD_PREFIX%\include;%INCLUDE%"
65

76
"%PYTHON%" setup.py clean --all
8-
"%PYTHON%" setup.py install
7+
"%PYTHON%" setup.py install --sycl-compiler-prefix=%BUILD_PREFIX%\Library
98
if errorlevel 1 exit 1
109

1110
rem Build wheel package

conda-recipe/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ build:
1414
requirements:
1515
build:
1616
- {{ compiler('cxx') }}
17-
- {{ compiler('dpcpp') }} # [linux]
17+
- {{ compiler('dpcpp') }} # [not osx]
1818
host:
1919
- setuptools
2020
- cython

dpctl-capi/cmake/modules/FindIntelSycl.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ elseif(DEFINED ENV{ONEAPI_ROOT})
4949
message(FATAL_ERROR "Unsupported system.")
5050
endif()
5151
else()
52-
message(FATAL_ERROR,
52+
message(FATAL_ERROR
5353
"Could not locate a DPC++ installation. Either pass the path to a "
5454
"custom location using DPCTL_DPCPP_HOME_DIR or set the "
5555
" ONEAPI_ROOT environment variable."
@@ -95,11 +95,11 @@ if(${clangxx_result} MATCHES "0")
9595
set(IntelSycl_SYCL_INCLUDE_DIR ${IntelSycl_ROOT}/include/sycl)
9696
set(IntelSycl_LIBRARY_DIR ${IntelSycl_ROOT}/lib)
9797
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
98-
set(IntelSycl_SYCL_LIBRARY ${IntelSycl_ROOT}/lib/sycl.lib)
99-
set(IntelSycl_OPENCL_LIBRARY ${IntelSycl_ROOT}/lib/OpenCL.lib)
98+
set(IntelSycl_SYCL_LIBRARY ${IntelSycl_LIBRARY_DIR}/sycl.lib)
99+
set(IntelSycl_OPENCL_LIBRARY ${IntelSycl_LIBRARY_DIR}/OpenCL.lib)
100100
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
101-
set(IntelSycl_SYCL_LIBRARY ${IntelSycl_ROOT}/lib/libsycl.so)
102-
set(IntelSycl_OPENCL_LIBRARY ${IntelSycl_ROOT}/lib/libOpenCL.so)
101+
set(IntelSycl_SYCL_LIBRARY ${IntelSycl_LIBRARY_DIR}/libsycl.so)
102+
set(IntelSycl_OPENCL_LIBRARY ${IntelSycl_LIBRARY_DIR}/libOpenCL.so)
103103
endif()
104104

105105
endif()

scripts/build_backend.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ def build_backend(
3939

4040
if sycl_compiler_prefix is None:
4141
oneapi_root = os.getenv("ONEAPI_ROOT")
42+
if oneapi_root is None:
43+
raise ValueError("Environment variable ONEAPI_ROOT is not set")
4244
if IS_LIN:
4345
DPCPP_ROOT = os.path.join(oneapi_root, r"compiler/latest/linux")
4446
elif IS_WIN:
@@ -159,14 +161,17 @@ def build_backend(
159161
elif IS_WIN:
160162
if os.path.exists(os.path.join(DPCPP_ROOT, "bin", "dpcpp.exe")):
161163
cmake_compiler_args = [
164+
"-DDPCTL_DPCPP_HOME_DIR=" + DPCPP_ROOT,
165+
"-DDPCTL_DPCPP_FROM_ONEAPI=ON",
162166
"-DCMAKE_C_COMPILER:PATH="
163167
+ os.path.join(DPCPP_ROOT, "bin", "clang-cl.exe"),
164168
"-DCMAKE_CXX_COMPILER:PATH="
165169
+ os.path.join(DPCPP_ROOT, "bin", "dpcpp.exe"),
166170
]
167171
else:
168172
cmake_compiler_args = [
169-
"-DDPCTL_CUSTOM_DPCPP_INSTALL_DIR=" + DPCPP_ROOT,
173+
"-DDPCTL_DPCPP_HOME_DIR=" + DPCPP_ROOT,
174+
"-DDPCTL_DPCPP_FROM_ONEAPI=OFF",
170175
"-DCMAKE_C_COMPILER:PATH="
171176
+ os.path.join(DPCPP_ROOT, "bin", "clang-cl.exe"),
172177
"-DCMAKE_CXX_COMPILER:PATH="

0 commit comments

Comments
 (0)