Skip to content

Commit 6b16ee9

Browse files
author
Diptorup Deb
authored
Merge pull request #458 from IntelPython/spring_cleaning
Minor fixes to setup.py, generate-docs.yaml, build_for_develop.sh, FindLLVMCov.cmake and FindLLVMProfdata.cmake.
2 parents 47c11d5 + b4d4f32 commit 6b16ee9

File tree

5 files changed

+67
-66
lines changed

5 files changed

+67
-66
lines changed

.github/workflows/generate-docs.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ jobs:
2323
- name: Install Intel OneAPI
2424
run: |
2525
sudo apt-get install intel-oneapi-dpcpp-cpp-compiler
26-
- name: Install Level-Zero headers
27-
run: |
28-
sudo apt-get install -y gpg-agent wget
29-
wget -qO - https://repositories.intel.com/graphics/intel-graphics.key |
30-
sudo apt-key add -
31-
sudo apt-add-repository \
32-
'deb [arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main'
33-
sudo apt-get install level-zero level-zero-dev
3426
- name: Install Lua
3527
run: |
3628
sudo apt-get install liblua5.2-dev

dpctl-capi/cmake/modules/FindLLVMCov.cmake

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,43 +25,61 @@
2525
# LLVMCov_FOUND
2626
# LLVMCov_VERSION
2727

28-
find_program(LLVMCov_EXE llvm-cov)
28+
# Check if a LLVM_TOOLS_HOME envvar is defined. If so, then search specifically
29+
# in that path or else search in default locations. The check is to allow
30+
# a particular LLVM_COV executable to be used when there are multiple LLVM_COV
31+
# versions installed in the system.
2932

30-
# get the version of llvm-cov
31-
execute_process(
32-
COMMAND ${LLVMCov_EXE} "--version"
33-
RESULT_VARIABLE result
34-
OUTPUT_VARIABLE version_string
35-
)
36-
37-
# If llvm-cov is found then set the package variables
38-
if(${result} MATCHES "0")
39-
string(REPLACE "\n" ";" VERSION_LIST "${version_string}")
40-
list(GET VERSION_LIST 1 ver_line)
41-
# Extract the llvm-cov version
42-
string(REGEX MATCH "[0-9]+\.[0-9]+\.[0-9]+" LLVMCov_VERSION ${ver_line})
43-
# Split out the version into major, minor an patch
44-
string(REPLACE "." ";" VERSION_LIST1 "${LLVMCov_VERSION}")
45-
list(GET VERSION_LIST1 0 LLVMCov_VERSION_MAJOR)
46-
list(GET VERSION_LIST1 1 LLVMCov_VERSION_MINOR)
47-
list(GET VERSION_LIST1 2 LLVMCov_VERSION_PATCH)
33+
if(DEFINED ENV{LLVM_TOOLS_HOME})
34+
find_program(LLVMCov_EXE
35+
llvm-cov
36+
PATHS $ENV{LLVM_TOOLS_HOME}
37+
NO_DEFAULT_PATH
38+
)
39+
if(${LLVMCov_EXE} STREQUAL "LLVMCov_EXE-NOTFOUND")
40+
message(WARN
41+
"$ENV{LLVM_TOOLS_HOME} does not have an llvm-cov executable"
42+
)
43+
endif()
44+
else()
45+
find_program(LLVMCov_EXE llvm-cov)
4846
endif()
4947

50-
# Check if a specific version of llvm-cov is required.
51-
if(LLVMCov_FIND_VERSION AND (DEFINED LLVMCov_VERSION))
52-
string(COMPARE LESS_EQUAL
53-
${LLVMCov_FIND_VERSION_MAJOR}
54-
${LLVMCov_VERSION_MAJOR}
55-
VERSION_MATCH
48+
if(NOT ${LLVMCov_EXE} STREQUAL "LLVMCov_EXE-NOTFOUND")
49+
# get the version of llvm-cov
50+
execute_process(
51+
COMMAND ${LLVMCov_EXE} "--version"
52+
RESULT_VARIABLE result
53+
OUTPUT_VARIABLE version_string
5654
)
57-
if(VERSION_MATCH)
55+
# If llvm-cov is found then set the package variables
56+
if(${result} MATCHES "0")
57+
string(REPLACE "\n" ";" VERSION_LIST "${version_string}")
58+
list(GET VERSION_LIST 1 ver_line)
59+
# Extract the llvm-cov version
60+
string(REGEX MATCH "[0-9]+\.[0-9]+\.[0-9]+" LLVMCov_VERSION ${ver_line})
61+
# Split out the version into major, minor an patch
62+
string(REPLACE "." ";" VERSION_LIST1 "${LLVMCov_VERSION}")
63+
list(GET VERSION_LIST1 0 LLVMCov_VERSION_MAJOR)
64+
list(GET VERSION_LIST1 1 LLVMCov_VERSION_MINOR)
65+
list(GET VERSION_LIST1 2 LLVMCov_VERSION_PATCH)
66+
endif()
67+
# Check if a specific version of llvm-cov is required.
68+
if(LLVMCov_FIND_VERSION AND (DEFINED LLVMCov_VERSION))
69+
string(COMPARE LESS_EQUAL
70+
${LLVMCov_FIND_VERSION_MAJOR}
71+
${LLVMCov_VERSION_MAJOR}
72+
VERSION_MATCH
73+
)
74+
if(VERSION_MATCH)
75+
set(LLVMCov_FOUND TRUE)
76+
endif()
77+
else()
5878
set(LLVMCov_FOUND TRUE)
5979
endif()
60-
else()
61-
set(LLVMCov_FOUND TRUE)
80+
message(STATUS "llvm-cov ${LLVMCov_VERSION} found at ${LLVMCov_EXE}.")
6281
endif()
6382

64-
6583
find_package_handle_standard_args(LLVMCov DEFAULT_MSG
6684
LLVMCov_EXE
6785
LLVMCov_FOUND

dpctl-capi/cmake/modules/FindLLVMProfdata.cmake

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,20 @@
2424
# LLVMProfdata_EXE The path to llvm-cov executable
2525
# LLVMProfdata_FOUND
2626

27-
find_program(LLVMProfdata_EXE llvm-profdata)
27+
if(DEFINED ENV{LLVM_TOOLS_HOME})
28+
find_program(LLVMProfdata_EXE
29+
llvm-profdata
30+
PATHS $ENV{LLVM_TOOLS_HOME}
31+
NO_DEFAULT_PATH
32+
)
33+
if(${LLVMProfdata_EXE} STREQUAL "LLVMProfdata_EXE-NOTFOUND")
34+
message(WARN
35+
"$ENV{LLVM_TOOLS_HOME} does not have an llvm-profdata executable"
36+
)
37+
endif()
38+
else()
39+
find_program(LLVMProfdata_EXE llvm-profdata)
40+
endif()
2841

2942
find_package_handle_standard_args(LLVMProfdata DEFAULT_MSG
3043
LLVMProfdata_EXE

scripts/build_for_develop.sh

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
#!/bin/bash
22
set +xe
33

4-
# Check if level-zero headers are installed. Currently, works only for Ubuntu.
5-
# Check https://dgpu-docs.intel.com/technologies/level-zero.html for details
6-
# about what development package should be checked for different distros.
7-
if [ -f /etc/os-release ]; then
8-
. /etc/os-release
9-
if [[ "$NAME" == "Ubuntu" ]]; then
10-
dpkg -s level-zero-dev
11-
if [[ $? == 0 ]]; then
12-
export HAS_LO_HEADERS=ON
13-
fi
14-
fi
15-
fi
16-
export CODE_COVERAGE=ON
174
python setup.py clean --all
18-
python setup.py develop
5+
python setup.py develop --coverage=True
196
pytest -q -ra --disable-warnings --cov dpctl --cov-report term-missing --pyargs dpctl -vv --cov-config=.coveragerc

setup.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,10 @@
2727
import versioneer
2828

2929
IS_WIN = False
30-
IS_MAC = False
3130
IS_LIN = False
3231

3332
if "linux" in sys.platform:
3433
IS_LIN = True
35-
elif sys.platform == "darwin":
36-
IS_MAC = True
3734
elif sys.platform in ["win32", "cygwin"]:
3835
IS_WIN = True
3936
else:
@@ -56,7 +53,7 @@ def remove_empty(li):
5653

5754
def get_sdl_cflags():
5855
cflags = []
59-
if IS_LIN or IS_MAC:
56+
if IS_LIN:
6057
cflags = [
6158
"-fstack-protector",
6259
"-fPIC",
@@ -85,8 +82,6 @@ def get_sdl_ldflags():
8582
def get_other_cxxflags():
8683
if IS_LIN:
8784
return ["-O3", "-std=c++17"]
88-
elif IS_MAC:
89-
return []
9085
elif IS_WIN:
9186
# FIXME: These are specific to MSVC and we should first make sure
9287
# what compiler we are using.
@@ -129,19 +124,15 @@ def extensions():
129124

130125
if IS_LIN:
131126
libs += ["rt", "DPCTLSyclInterface"]
132-
elif IS_MAC:
133-
pass
134127
elif IS_WIN:
135128
libs += ["DPCTLSyclInterface"]
136129

137130
if IS_LIN:
138131
libraries = [dpctl_sycl_interface_lib]
139132
elif IS_WIN:
140133
libraries = [dpctl_sycl_interface_lib]
141-
elif IS_MAC:
142-
libraries = [dpctl_sycl_interface_lib]
143134

144-
if IS_LIN or IS_MAC:
135+
if IS_LIN:
145136
runtime_library_dirs = ["$ORIGIN"]
146137
elif IS_WIN:
147138
runtime_library_dirs = []
@@ -309,7 +300,7 @@ def finalize_options(self):
309300
else:
310301
raise ValueError(
311302
"--sycl-compiler-prefix value is invalid, use a "
312-
"path to compiler intallation. To use oneAPI, use the "
303+
"path to compiler installation. To use oneAPI, use the "
313304
"default value, but remember to activate the compiler "
314305
"environment"
315306
)
@@ -377,7 +368,7 @@ def finalize_options(self):
377368
else:
378369
raise ValueError(
379370
"--sycl-compiler-prefix value is invalid, use a "
380-
"path to compiler intallation. To use oneAPI, use the "
371+
"path to compiler installation. To use oneAPI, use the "
381372
"default value, but remember to activate the compiler "
382373
"environment"
383374
)
@@ -402,7 +393,7 @@ def _get_cmdclass():
402393
name="dpctl",
403394
version=versioneer.get_version(),
404395
cmdclass=_get_cmdclass(),
405-
description="A lightweight Python wrapper for a subset of OpenCL and SYCL.",
396+
description="A lightweight Python wrapper for a subset of SYCL.",
406397
long_description=long_description,
407398
long_description_content_type="text/markdown",
408399
license="Apache 2.0",

0 commit comments

Comments
 (0)