boostorg / boostorg/compute

Support user-defined default context/device

Open
#827 15 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.7k
Forks
340
PR merge metrics
No merged PRs in 30d

Description

Sometimes it is desirable to have CL-accelerated libraries initialize with user context managed by some outside application. But Boost.Compute currently hides global state of `context/device/queue` from users; there is no way to let user override e.g., their own global default context.

Because Boost.Compute already maintains global state of `context/device/queue` inside static functions, I think the best case scenario is being able to assign global CL context (derived from preferred CL compute device) without relying on parsing through pre-defined environment variables which `default_context()` implements.

One of the main benefits is to make direct access of device memory between shared objects/DLLs easily achievable. When some main application initialize two libraries `Foo` and `Bar`, those two libraries also initialize all internal buffers with global user-defined context. That way, data produced by library `Foo` can be directly consumed by library `Bar`. If not being able to set global state it would take much effort for library authors to add additional input argument for virtually every Boost.Compute call.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.