Skip to content

Commit f1c3869

Browse files
Added example of getting partition_max_sub_devices using pybind11
1 parent bcfcf8b commit f1c3869

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

examples/pybind11/use_dpctl_syclqueue/tests/test_queue_device.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,11 @@ def test_get_sub_group_sizes():
6363
assert type(szs) is list
6464
assert all(type(el) is int for el in szs)
6565
szs == d.sub_group_sizes
66+
67+
68+
def test_get_partition_max_sub_devices():
69+
d = dpctl.SyclDevice()
70+
mt = uqd.get_partition_max_sub_devices(d)
71+
assert type(mt) is int
72+
assert mt >= 0
73+
assert mt <= d.max_compute_units

examples/pybind11/use_dpctl_syclqueue/use_queue_device/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
get_device_global_mem_size,
2121
get_device_local_mem_size,
2222
get_max_compute_units,
23+
get_partition_max_sub_devices,
2324
get_sub_group_sizes,
2425
offloaded_array_mod,
2526
)
@@ -30,6 +31,7 @@
3031
"get_device_local_mem_size",
3132
"offloaded_array_mod",
3233
"get_sub_group_sizes",
34+
"get_partition_max_sub_devices",
3335
]
3436

3537
__doc__ = """

examples/pybind11/use_dpctl_syclqueue/use_queue_device/_example.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ std::vector<std::size_t> get_sub_group_sizes(const sycl::device &d)
9090
return d.get_info<sycl::info::device::sub_group_sizes>();
9191
}
9292

93+
std::uint32_t get_partition_max_sub_devices(const sycl::device &d)
94+
{
95+
return d.get_info<sycl::info::device::partition_max_sub_devices>();
96+
}
97+
9398
PYBIND11_MODULE(_use_queue_device, m)
9499
{
95100
m.def(
@@ -108,4 +113,7 @@ PYBIND11_MODULE(_use_queue_device, m)
108113
"Compute offloaded modular reduction of integer-valued NumPy array");
109114
m.def("get_sub_group_sizes", &get_sub_group_sizes,
110115
"Gets info::device::sub_group_sizes property of given device");
116+
m.def("get_partition_max_sub_devices", &get_partition_max_sub_devices,
117+
"Gets info::device::partition_max_sub_devices for given "
118+
"dpctl.SyclDevice");
111119
}

0 commit comments

Comments
 (0)