Loading...
Searching...
No Matches
factory.hpp
Go to the documentation of this file.
1#pragma once
2
3/**
4 * Factory for creating GPU device backends.
5 *
6 * Returns std::shared_ptr (not unique_ptr) because GPUDeviceBuffer
7 * stores a shared_ptr<GPUDeviceBackend> to guarantee the backend
8 * outlives all buffers allocated through it.
9 *
10 * The concrete implementation is selected at link time via CMake:
11 * CUDA builds link the CUDA factory, Metal builds link the Metal factory.
12 * No #ifdef guards in this header.
13 */
14
16
17#include <memory>
18
19namespace q3 {
20namespace execution {
21namespace gpu {
22namespace device {
23
24/**
25 * Create a GPU device backend for the platform detected at build time.
26 *
27 * @return Shared pointer to the concrete GPUDeviceBackend implementation.
28 * @throws std::runtime_error If no GPU device is available.
29 */
30std::shared_ptr<GPUDeviceBackend> create_gpu_device_backend();
31
32} // namespace device
33} // namespace gpu
34} // namespace execution
35} // namespace q3
std::shared_ptr< GPUDeviceBackend > create_gpu_device_backend()
Definition cuda.cpp:103