Skip to content

Commit fd63a3e

Browse files
authored
changes to compiler name usage from clang++ to dpcpp (#270)
* In build_backend.py changed compiler from clang++ to dpcpp. * Removed CC and CXX vars in setup.py since we want to build the extensions using the system compiler and not DPC++ * Provided environment variable hint to find level zero library to build on systems where level zero is in non default path Co-authored-by: Adarsh Yoga <[email protected]>
1 parent 91a53bc commit fd63a3e

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

dpctl-capi/cmake/modules/FindLevelZero.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
# LEVEL_ZERO_LIBRARY - the full path to the ze_loader library
2626
# TODO: Add a way to record the version of the level_zero library
2727

28-
find_library(LEVEL_ZERO_LIBRARY ze_loader)
29-
find_path(LEVEL_ZERO_INCLUDE_DIR NAMES level_zero/zet_api.h)
28+
find_library(LEVEL_ZERO_LIBRARY ze_loader HINTS $ENV{L0_LIB_DIR})
29+
find_path(LEVEL_ZERO_INCLUDE_DIR NAMES level_zero/zet_api.h HINTS $ENV{L0_INCLUDE_DIR})
3030

3131
find_package_handle_standard_args(LevelZero DEFAULT_MSG
3232
LEVEL_ZERO_INCLUDE_DIR

scripts/build_backend.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"-DCMAKE_PREFIX_PATH=" + INSTALL_PREFIX,
6363
"-DDPCPP_INSTALL_DIR=" + DPCPP_ROOT,
6464
"-DCMAKE_C_COMPILER:PATH=" + os.path.join(DPCPP_ROOT, "bin", "clang"),
65-
"-DCMAKE_CXX_COMPILER:PATH=" + os.path.join(DPCPP_ROOT, "bin", "clang++"),
65+
"-DCMAKE_CXX_COMPILER:PATH=" + os.path.join(DPCPP_ROOT, "bin", "dpcpp"),
6666
"-DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON",
6767
backends,
6868
]
@@ -83,6 +83,8 @@
8383
"-DCMAKE_INSTALL_PREFIX=" + INSTALL_PREFIX,
8484
"-DCMAKE_PREFIX_PATH=" + INSTALL_PREFIX,
8585
"-DDPCPP_INSTALL_DIR=" + DPCPP_ROOT,
86+
"-DCMAKE_C_COMPILER:PATH=" + os.path.join(DPCPP_ROOT, "bin", "clang-cl.exe"),
87+
"-DCMAKE_CXX_COMPILER:PATH=" + os.path.join(DPCPP_ROOT, "bin", "dpcpp.exe"),
8688
backends,
8789
]
8890
subprocess.check_call(cmake_args, stderr=subprocess.STDOUT, shell=True)

setup.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,11 @@
4343

4444
if IS_LIN:
4545
DPCPP_ROOT = os.environ["ONEAPI_ROOT"] + "/compiler/latest/linux"
46-
os.environ["CC"] = DPCPP_ROOT + "/bin/clang"
47-
os.environ["CXX"] = DPCPP_ROOT + "/bin/clang++"
4846
os.environ["DPCTL_SYCL_INTERFACE_LIBDIR"] = "dpctl"
4947
os.environ["DPCTL_SYCL_INTERFACE_INCLDIR"] = "dpctl/include"
5048
os.environ["CFLAGS"] = "-fPIC"
5149

5250
elif IS_WIN:
53-
os.environ["CC"] = "clang-cl.exe"
54-
os.environ["CXX"] = "dpcpp.exe"
5551
os.environ["DPCTL_SYCL_INTERFACE_LIBDIR"] = "dpctl"
5652
os.environ["DPCTL_SYCL_INTERFACE_INCLDIR"] = "dpctl\include"
5753

@@ -86,7 +82,7 @@ def get_sdl_ldflags():
8682

8783
def get_other_cxxflags():
8884
if IS_LIN:
89-
return ["-O3", "-fsycl", "-std=c++17"]
85+
return ["-O3", "-std=c++17"]
9086
elif IS_MAC:
9187
return []
9288
elif IS_WIN:

0 commit comments

Comments
 (0)