Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
810afd7
update build_locally script to avoid python setup.py develop call
ndgrigorian Oct 14, 2025
32c7b9f
further update build_locally script
ndgrigorian Oct 15, 2025
32f1509
refactor common build functionality out into separate file
ndgrigorian Oct 15, 2025
989df1b
remove --build-dir option and fix --clean option
ndgrigorian Oct 15, 2025
0648317
do not return compiler root unnecessarily from resolve_compilers
ndgrigorian Oct 15, 2025
a4d90be
update gen_coverage script to align with build_locally
ndgrigorian Oct 21, 2025
7b53623
pass explicit CMake variables for coverage tool paths
ndgrigorian Oct 28, 2025
72ca5a0
replicate old script behavior when calling setup.py
ndgrigorian Oct 28, 2025
80af656
attempt setting cmake_args for LLVMCov_EXE
ndgrigorian Oct 28, 2025
527de4f
resolve bin_llvm from default compiler layout when not provided
ndgrigorian Oct 28, 2025
8973006
use bin_llvm when running llvm-cov and llvm-profdata
ndgrigorian Oct 28, 2025
50394b1
keep find_objects defined within main
ndgrigorian Oct 28, 2025
f327741
generalize err and warn utilities for different build scripts
ndgrigorian Oct 28, 2025
6c33bf0
use common resolve_compilers utility
ndgrigorian Oct 28, 2025
35f91ea
update gen_docs script
ndgrigorian Oct 28, 2025
74947d6
Merge pull request #2174 from IntelPython/update-gen-coverage-script
ndgrigorian Oct 28, 2025
a113d01
try using pip install -e in place of setup.py develop in CI
ndgrigorian Oct 28, 2025
5b395e7
use python setup.py build_ext in Cython extension building
ndgrigorian Oct 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ jobs:
do
pushd $d
conda activate --stack ${{ env.BUILD_ENV_NAME }}
CC=icx CXX=icpx python setup.py develop -G Ninja || exit 1
CC=icx CXX=icpx python setup.py build_ext --inplace -G Ninja || exit 1
conda deactivate
python -m pytest tests || exit 1
popd
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ jobs:
source /opt/intel/oneapi/setvars.sh
wget https://github.com/vovkos/doxyrest/releases/download/doxyrest-2.1.2/doxyrest-2.1.2-linux-amd64.tar.xz
tar xf doxyrest-2.1.2-linux-amd64.tar.xz
python setup.py develop -G Ninja --build-type=Release \
python setup.py build_ext --inplace --generator=Ninja --build-type=Release \
-- \
-DCMAKE_C_COMPILER:PATH=$(which icx) \
-DCMAKE_CXX_COMPILER:PATH=$(which icpx) \
-DDPCTL_GENERATE_DOCS=ON \
-DDPCTL_ENABLE_DOXYREST=ON \
-DDoxyrest_DIR=`pwd`/doxyrest-2.1.2-linux-amd64 \
-DCMAKE_VERBOSE_MAKEFILE=ON
python -m pip install -e . --no-build-isolation
python -c "import dpctl; print(dpctl.__version__)" || exit 1
pushd "$(find _skbuild -name cmake-build)" || exit 1
cmake --build . --target Sphinx || exit 1
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/os-llvm-sycl-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ jobs:
shell: bash -l {0}
run: |
source set_allvars.sh
CC=clang CXX=clang++ python setup.py develop -G Ninja
CC=clang CXX=clang++ python setup.py build_ext --inplace --generator=Ninja
python -m pip install -e . --no-build-isolation

- name: Run lsplatforms
shell: bash -l {0}
Expand Down
153 changes: 153 additions & 0 deletions scripts/_build_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# Data Parallel Control (dpctl)
#
# Copyright 2025 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import shutil
import subprocess
import sys


def resolve_compilers(
oneapi: bool,
c_compiler: str,
cxx_compiler: str,
compiler_root: str,
):
is_linux = "linux" in sys.platform

if oneapi or (
c_compiler is None and cxx_compiler is None and compiler_root is None
):
return "icx", ("icpx" if is_linux else "icx")

if (
(c_compiler is None or not os.path.isabs(c_compiler))
and (cxx_compiler is None or not os.path.isabs(cxx_compiler))
and (not compiler_root or not os.path.exists(compiler_root))
):
raise RuntimeError(
"--compiler-root option must be set when using non-default DPC++ "
"layout unless absolute paths are provided for both compilers"
)

# default values
if c_compiler is None:
c_compiler = "icx"
if cxx_compiler is None:
cxx_compiler = "icpx" if is_linux else "icx"

for name, opt_name in (
(c_compiler, "--c-compiler"),
(cxx_compiler, "--cxx-compiler"),
):
if os.path.isabs(name):
path = name
else:
path = os.path.join(compiler_root, name)
if not os.path.exists(path):
raise RuntimeError(f"{opt_name} value {name} not found")
return c_compiler, cxx_compiler


def run(cmd: list[str], env: dict[str, str] = None, cwd: str = None):
print("+", " ".join(cmd))
subprocess.check_call(
cmd, env=env or os.environ.copy(), cwd=cwd or os.getcwd()
)


def get_output(cmd: list[str], cwd: str = None):
print("+", " ".join(cmd))
return (
subprocess.check_output(cmd, cwd=cwd or os.getcwd())
.decode("utf-8")
.strip("\n")
)


def warn(msg: str, script: str):
print(f"[{script}][warning] {msg}", file=sys.stderr)


def err(msg: str, script: str):
print(f"[{script}][error] {msg}", file=sys.stderr)


def make_cmake_args(
c_compiler: str = None,
cxx_compiler: str = None,
level_zero: bool = True,
glog: bool = False,
verbose: bool = False,
other_opts: str = None,
):
args = [
f"-DCMAKE_C_COMPILER:PATH={c_compiler}" if c_compiler else "",
f"-DCMAKE_CXX_COMPILER:PATH={cxx_compiler}" if cxx_compiler else "",
f"-DDPCTL_ENABLE_L0_PROGRAM_CREATION={'ON' if level_zero else 'OFF'}",
f"-DDPTL_ENABLE_GLOG:BOOL={'ON' if glog else 'OFF'}",
]

if verbose:
args.append("-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON")
if other_opts:
args.extend(other_opts.split())

return " ".join(filter(None, args))


def build_extension(
setup_dir: str,
env: dict[str, str],
cmake_executable: str = None,
generator: str = None,
build_type: str = None,
):
cmd = [sys.executable, "setup.py", "build_ext", "--inplace"]
if cmake_executable:
cmd.append(f"--cmake-executable={cmake_executable}")
if generator:
cmd.append(f"--generator={generator}")
if build_type:
cmd.append(f"--build-type={build_type}")
run(
cmd,
env=env,
cwd=setup_dir,
)


def install_editable(setup_dir: str, env: dict[str, str]):
run(
[
sys.executable,
"-m",
"pip",
"install",
"-e",
".",
"--no-build-isolation",
],
env=env,
cwd=setup_dir,
)


def clean_build_dir(setup_dir: str = None):
target = os.path.join(setup_dir or os.getcwd(), "_skbuild")
if os.path.exists(target):
print(f"Cleaning build directory: {target}")
shutil.rmtree(target)
Loading