TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
tmk::gpu Namespace Reference

Namespaces

namespace  metal

Classes

struct  DeviceInfo
struct  FieldProblem
struct  GpuStatus

Enumerations

enum class  Backend { Cpu , Cuda , Metal }

Functions

Backend compiled_backend ()
 Backend compiled into this build. CPU references are always available.
std::vector< DeviceInfo > list_devices ()
 All visible devices with current memory budget. Empty without an available GPU.
std::optional< DeviceInfo > 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 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.
int field_cpu (const FieldProblem &p, std::vector< std::int32_t > &out)
 CPU reference. out is resized to layers*h*w. Returns the number of sweep rounds.
GpuStatus field_gpu (int device_index, const FieldProblem &p, std::vector< std::int32_t > &out)
 Compiled GPU backend; on failure (no device, no memory) returns !ok and leaves out empty.
std::vector< std::uint64_t > philox_fill_cpu (std::uint64_t seed, std::uint32_t stage, std::uint64_t item, std::size_t n)
GpuStatus philox_fill_cuda (int cuda_index, std::uint64_t seed, std::uint32_t stage, std::uint64_t item, std::size_t n, std::vector< std::uint64_t > &out)
 GPU version. On failure (no CUDA, not enough free memory, launch error) returns !ok and leaves out empty.

Variables

constexpr std::size_t kDeviceMemoryMargin = std::size_t{256} << 20
 Safety margin kept free on every device for other processes and runtime overheads.
constexpr std::int32_t kFieldInf = std::numeric_limits<std::int32_t>::max() / 4

Enumeration Type Documentation

◆ Backend

enum class tmk::gpu::Backend
strong
Enumerator
Cpu 
Cuda 
Metal 

Definition at line 16 of file device.hpp.

Function Documentation

◆ compiled_backend()

Backend tmk::gpu::compiled_backend ( )

Backend compiled into this build. CPU references are always available.

◆ field_cpu()

int tmk::gpu::field_cpu ( const FieldProblem & p,
std::vector< std::int32_t > & out )

CPU reference. out is resized to layers*h*w. Returns the number of sweep rounds.

◆ field_gpu()

GpuStatus tmk::gpu::field_gpu ( int device_index,
const FieldProblem & p,
std::vector< std::int32_t > & out )

Compiled GPU backend; on failure (no device, no memory) returns !ok and leaves out empty.

◆ find_device()

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").

◆ has_free_memory()

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.

◆ list_devices()

std::vector< DeviceInfo > tmk::gpu::list_devices ( )

All visible devices with current memory budget. Empty without an available GPU.

◆ philox_fill_cpu()

std::vector< std::uint64_t > tmk::gpu::philox_fill_cpu ( std::uint64_t seed,
std::uint32_t stage,
std::uint64_t item,
std::size_t n )

◆ philox_fill_cuda()

GpuStatus tmk::gpu::philox_fill_cuda ( int cuda_index,
std::uint64_t seed,
std::uint32_t stage,
std::uint64_t item,
std::size_t n,
std::vector< std::uint64_t > & out )

GPU version. On failure (no CUDA, not enough free memory, launch error) returns !ok and leaves out empty.

Variable Documentation

◆ kDeviceMemoryMargin

std::size_t tmk::gpu::kDeviceMemoryMargin = std::size_t{256} << 20
inlineconstexpr

Safety margin kept free on every device for other processes and runtime overheads.

Definition at line 40 of file device.hpp.

◆ kFieldInf

std::int32_t tmk::gpu::kFieldInf = std::numeric_limits<std::int32_t>::max() / 4
inlineconstexpr

Definition at line 17 of file field.hpp.