Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
update use_dpctl_sycl_queue example
  • Loading branch information
ndgrigorian committed Jul 28, 2026
commit fd7a5c24d7df0c13a56e2dffd194d82dd4ad7e22
11 changes: 3 additions & 8 deletions examples/pybind11/use_dpctl_sycl_queue/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,8 @@ find_package(Python REQUIRED COMPONENTS Development.Module NumPy)
find_package(Dpctl REQUIRED)

set(py_module_name _use_queue_device)
set(_sources use_queue_device/_example.cpp)
pybind11_add_module(${py_module_name}
MODULE
${_sources}
)
set(_sources src/use_queue_device/_example.cpp)
pybind11_add_module(${py_module_name} MODULE ${_sources})
add_sycl_to_target(TARGET ${py_module_name} SOURCES ${_sources})
target_include_directories(${py_module_name} PUBLIC ${Dpctl_INCLUDE_DIRS})
install(TARGETS ${py_module_name}
DESTINATION use_queue_device
)
install(TARGETS ${py_module_name} DESTINATION use_queue_device)
10 changes: 6 additions & 4 deletions examples/pybind11/use_dpctl_sycl_queue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ extensions.
To build the extension, run:
```
source /opt/intel/oneapi/compiler/latest/env/vars.sh
CXX=icpx python setup.py build_ext --inplace
CXX=icpx python -m pip install .
python -m pytest tests
python example.py
```

# Sample output

```
(idp) [17:25:27 ansatnuc04 use_dpctl_syclqueue]$ python example.py
EU count returned by Pybind11 extension 24
EU count computed by dpctl 24
$ python example.py
EU count returned by Pybind11 extension 96
EU count computed by dpctl 96
Device's global memory size: 7445078016 bytes
Device's local memory size: 65536 bytes

Computing modular reduction using SYCL on a NumPy array
Offloaded result agrees with reference one computed by NumPy
Expand Down
39 changes: 39 additions & 0 deletions examples/pybind11/use_dpctl_sycl_queue/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Data Parallel Control (dpctl)
#
# Copyright 2020-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.

[build-system]
build-backend = "scikit_build_core.build"
requires = [
"scikit-build-core>=0.8.0",
"dpctl",
"numpy >=1.23"
]

[project]
authors = [{name = "Intel Corporation"}]
dependencies = ["numpy", "dpctl"]
description = "An example of SYCL-powered Python package (with pybind11)"
license = {text = "Apache 2.0"}
name = "use_queue_device"
requires-python = ">=3.10"
version = "0.0.1"

[project.urls]
Repository = "https://github.com/IntelPython/dpctl"

[tool.scikit-build]
build-dir = "build/{wheel_tag}"
wheel.packages = ["src/use_queue_device"]
26 changes: 0 additions & 26 deletions examples/pybind11/use_dpctl_sycl_queue/setup.py

This file was deleted.

Loading