|
rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
|
Implementation of the device interface to represent the CPU. More...
#include <rexlib/backends/cpu/cpu_device.hpp>
Public Member Functions | |
| cpu_device (std::shared_ptr< thread_pool > pool=nullptr) | |
| Construct a device over its own threads. | |
| const memory_resource & | get_memory_resource (memory_resource_affinity affinity) const override |
| Retrieve a memory resource by its affinity. | |
| std::shared_ptr< command_queue > | create_command_queue () const override |
| Create a new command queue on this device. | |
| const std::shared_ptr< thread_pool > & | get_thread_pool () const noexcept |
| Get the threads this device runs its programs over. | |
Public Member Functions inherited from rexlib::device | |
| device (const device &other)=delete | |
| device (device &&other)=delete | |
| device & | operator= (const device &other)=delete |
| device & | operator= (device &&other)=delete |
Implementation of the device interface to represent the CPU.
Owns the threads every queue it hands out runs its programs over. The device is the longest lived thing this backend has that is not static, so owning them here is what keeps the workers joined while the program is still running: a pool held by a static instead would be torn down during static destruction, which on Windows means joining threads the loader has already stopped.
|
explicit |
Construct a device over its own threads.
| pool | The threads to run programs over. Built with thread_pool::get_default_worker_count workers when null, which is what every caller but a test wants. |
|
overridevirtual |
Create a new command queue on this device.
The returned queue is independent from any previously created queue on the same device, including the default queue and may execute its commands concurrently with them. A command of one queue is ordered after a command of another by depending on it.
Implements rexlib::device.
|
overridevirtual |
Retrieve a memory resource by its affinity.
Returns the memory_resource that is best suited for the access pattern described by affinity. The returned reference is valid for the lifetime of this device.
memory_resource (i.e. the references may alias).| affinity | The intended access pattern for which a resource is requested. |
memory_resource.Implements rexlib::device.
|
noexcept |
Get the threads this device runs its programs over.