|
rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
|
Abstract class that represents a hardware backend. More...
#include <rexlib/core/hardware/device_backend.hpp>
Public Member Functions | |
| device_backend (const device_backend &other)=delete | |
| device_backend (device_backend &&other)=delete | |
| device_backend & | operator= (const device_backend &other)=delete |
| device_backend & | operator= (device_backend &&other)=delete |
| virtual std::string | get_name () const =0 |
| Get the name of the backend. | |
| virtual version | get_version () const =0 |
| Get the version of the backend. | |
| virtual void | enumerate_devices (std::vector< std::size_t > &ids) const =0 |
| Enumerate available devices for this backend. | |
| virtual bool | get_device_properties (std::size_t id, device_properties &desc) const =0 |
| Query the static properties of a device. | |
| virtual std::shared_ptr< device > | create_device (std::size_t id) const =0 |
| Create a device handle for the given device identifier. | |
Abstract class that represents a hardware backend.
A device_backend is the integration point through which a family of physical or virtual compute devices (e.g. the host CPU, a vendor's GPUs) is exposed to the rest of the framework. Concrete backends are typically shipped as plugins and registered into a device_manager, which dispatches queries to the appropriate backend based on its name.
The interface intentionally remains small: enumerating the devices that the backend can see at runtime, exposing their static characteristics via device_properties, and instantiating a usable device handle on demand. Backends are non-copyable and non-movable; they are meant to live behind a stable pointer owned by the device_manager.
|
pure virtual |
Create a device handle for the given device identifier.
Instantiates a ready-to-use device object backed by the physical device referred to by id. Each call returns a fresh handle; backends are free to share underlying driver state between handles but must guarantee that the returned object can be used independently from any previous one.
| [in] | id | The identifier of the device, as returned by enumerate_devices. |
id is not valid rather than returning a null pointer.
|
pure virtual |
Enumerate available devices for this backend.
Populates ids with an identifier for every device that this backend can currently make available. The list is expected to be cleared by the implementation before being filled.
| [out] | ids | Output parameter receiving the device identifiers. |
|
pure virtual |
Query the static properties of a device.
Fills desc with descriptive information about the device that is not expected to change while the backend is alive (name, kind, total memory, etc.). This method does not allocate or initialize any device-side resources; use create_device for that.
| [in] | id | Identifier of the device, as returned by enumerate_devices. |
| [out] | desc | Output properties. Only modified when the call succeeds. |
desc has been populated. desc is left untouched.
|
pure virtual |
Get the name of the backend.
Get the version of the backend.