unified platform/device/ctx/queue querying interface
Opened this issue · 1 comments
- single query support
- testing
- multiple query support
- testing
This would ease the effort of setting up the opencl objects.
Following script binds one platform, one device, one ctx and one queue, where the device should satisfy the test function. Unless specified explicitly with :many
symbol, it acts as a constraint that if either there are multiple platforms, devices, contexts or queues that satisfy this query, then it should signal an error. (cf. class diagram in opencl 1.2 documentation)
(with-easy-opencl-setup (platform ; equiv: (platform (constantly t) :one)
(device (lambda (device)
(eq (get-device-info device :device-type)
:device-type-gpu)))
ctx
queue)
body)
In what follows, there should be strictly more than 2 devices that satisfy the test, and the devices should be of the single platform. The context is bound to the result of (create-context devices :context-platform platform)
, since :one
is implied by default.
(with-easy-opencl-setup (platform
(devices (lambda (device)
(eq (get-device-info device :device-type)
:device-type-gpu))
:many)
context
queue)
body)
implemented with restriction (no :many option)