Skip to content

Commit fd7a5c2

Browse files
committed
update use_dpctl_sycl_queue example
1 parent 549a2ba commit fd7a5c2

6 files changed

Lines changed: 48 additions & 38 deletions

File tree

examples/pybind11/use_dpctl_sycl_queue/CMakeLists.txt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,8 @@ find_package(Python REQUIRED COMPONENTS Development.Module NumPy)
2424
find_package(Dpctl REQUIRED)
2525

2626
set(py_module_name _use_queue_device)
27-
set(_sources use_queue_device/_example.cpp)
28-
pybind11_add_module(${py_module_name}
29-
MODULE
30-
${_sources}
31-
)
27+
set(_sources src/use_queue_device/_example.cpp)
28+
pybind11_add_module(${py_module_name} MODULE ${_sources})
3229
add_sycl_to_target(TARGET ${py_module_name} SOURCES ${_sources})
3330
target_include_directories(${py_module_name} PUBLIC ${Dpctl_INCLUDE_DIRS})
34-
install(TARGETS ${py_module_name}
35-
DESTINATION use_queue_device
36-
)
31+
install(TARGETS ${py_module_name} DESTINATION use_queue_device)

examples/pybind11/use_dpctl_sycl_queue/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,19 @@ extensions.
1212
To build the extension, run:
1313
```
1414
source /opt/intel/oneapi/compiler/latest/env/vars.sh
15-
CXX=icpx python setup.py build_ext --inplace
15+
CXX=icpx python -m pip install .
1616
python -m pytest tests
1717
python example.py
1818
```
1919

2020
# Sample output
2121

2222
```
23-
(idp) [17:25:27 ansatnuc04 use_dpctl_syclqueue]$ python example.py
24-
EU count returned by Pybind11 extension 24
25-
EU count computed by dpctl 24
23+
$ python example.py
24+
EU count returned by Pybind11 extension 96
25+
EU count computed by dpctl 96
26+
Device's global memory size: 7445078016 bytes
27+
Device's local memory size: 65536 bytes
2628
2729
Computing modular reduction using SYCL on a NumPy array
2830
Offloaded result agrees with reference one computed by NumPy
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Data Parallel Control (dpctl)
2+
#
3+
# Copyright 2020-2025 Intel Corporation
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
[build-system]
18+
build-backend = "scikit_build_core.build"
19+
requires = [
20+
"scikit-build-core>=0.8.0",
21+
"dpctl",
22+
"numpy >=1.23"
23+
]
24+
25+
[project]
26+
authors = [{name = "Intel Corporation"}]
27+
dependencies = ["numpy", "dpctl"]
28+
description = "An example of SYCL-powered Python package (with pybind11)"
29+
license = {text = "Apache 2.0"}
30+
name = "use_queue_device"
31+
requires-python = ">=3.10"
32+
version = "0.0.1"
33+
34+
[project.urls]
35+
Repository = "https://github.com/IntelPython/dpctl"
36+
37+
[tool.scikit-build]
38+
build-dir = "build/{wheel_tag}"
39+
wheel.packages = ["src/use_queue_device"]

examples/pybind11/use_dpctl_sycl_queue/setup.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

examples/pybind11/use_dpctl_sycl_queue/use_queue_device/__init__.py renamed to examples/pybind11/use_dpctl_sycl_queue/src/use_queue_device/__init__.py

File renamed without changes.

examples/pybind11/use_dpctl_sycl_queue/use_queue_device/_example.cpp renamed to examples/pybind11/use_dpctl_sycl_queue/src/use_queue_device/_example.cpp

File renamed without changes.

0 commit comments

Comments
 (0)