|
TraceMaker
C++ API of the engine
|
GPU discovery and memory admission control (design doc 07 §4). More...
#include <cstddef>#include <optional>#include <string>#include <string_view>#include <vector>Go to the source code of this file.
Classes | |
| struct | tmk::gpu::DeviceInfo |
Namespaces | |
| namespace | tmk |
| namespace | tmk::gpu |
Enumerations | |
| enum class | tmk::gpu::Backend { tmk::gpu::Cpu , tmk::gpu::Cuda , tmk::gpu::Metal } |
Functions | |
| Backend | tmk::gpu::compiled_backend () |
| Backend compiled into this build. CPU references are always available. | |
| std::vector< DeviceInfo > | tmk::gpu::list_devices () |
| All visible devices with current memory budget. Empty without an available GPU. | |
| std::optional< DeviceInfo > | tmk::gpu::find_device (std::string_view uuid_or_name) |
| Finds a device by exact UUID or by a case-sensitive substring of its name ("V100", "P100"). | |
| bool | tmk::gpu::has_free_memory (int device_index, std::size_t bytes) |
| True when bytes plus a safety margin fit in the device's free memory right now. | |
Variables | |
| constexpr std::size_t | tmk::gpu::kDeviceMemoryMargin = std::size_t{256} << 20 |
| Safety margin kept free on every device for other processes and runtime overheads. | |
GPU discovery and memory admission control (design doc 07 §4).
The GPUs on the development machine are shared with other jobs, so free memory is scarce and changes over time. Callers ask has_free_memory before large allocations and fall back to the CPU reference path when it fails; results are identical either way.
Definition in file device.hpp.