From 159e844039972d1b5470741196d16dfb03a8c551 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Fri, 10 Aug 2018 23:35:17 -0500 Subject: [PATCH] [pybind] Add wrapper for DeviceTopologyAmd --- pyopencl/__init__.py | 3 +-- src/wrap_cl_part_2.cpp | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py index 472d7dc0..3d2547e0 100644 --- a/pyopencl/__init__.py +++ b/pyopencl/__init__.py @@ -176,8 +176,7 @@ from pyopencl._cl import ( # noqa Image, Sampler, GLTexture, - # FIXME - # DeviceTopologyAmd, + DeviceTopologyAmd, ) import inspect as _inspect diff --git a/src/wrap_cl_part_2.cpp b/src/wrap_cl_part_2.cpp index 0a31ac6c..1c62f2b2 100644 --- a/src/wrap_cl_part_2.cpp +++ b/src/wrap_cl_part_2.cpp @@ -441,6 +441,42 @@ void pyopencl_expose_part_2(py::module &m) #endif // }}} + + // {{{ CL_DEVICE_TOPOLOGY_TYPE_PCIE_AMD + + { + typedef cl_device_topology_amd cls; + py::class_(m, "DeviceTopologyAmd") + .def(py::init( + [](cl_char bus, cl_char device, cl_char function) + { + cl_device_topology_amd result; + result.pcie.bus = bus; + result.pcie.device = device; + result.pcie.function = function; + return result; + }), + py::arg("bus")=0, + py::arg("device")=0, + py::arg("function")=0) + + .def_property("type", + [](cls &t) { return t.pcie.type; }, + [](cls &t, cl_uint val) { t.pcie.type = val; }) + + .def_property("bus", + [](cls &t) { return t.pcie.bus; }, + [](cls &t, cl_char val) { t.pcie.bus = val; }) + .def_property("device", + [](cls &t) { return t.pcie.device; }, + [](cls &t, cl_char val) { t.pcie.device = val; }) + .def_property("function", + [](cls &t) { return t.pcie.function; }, + [](cls &t, cl_char val) { t.pcie.function = val; }) + ; + } + + // }}} } -- GitLab