DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
DeviceStorage_bind.hpp
Go to the documentation of this file.
1#pragma once
2/// @file DeviceStorage_bind.hpp
3/// @brief pybind11 binding of the @ref DNDS::DeviceBackend "DeviceBackend" enum into the Python module.
4
5#include "Defines_bind.hpp"
6#include "DeviceStorage.hpp"
7
8namespace DNDS
9{
10 inline void pybind11_bind_deviceStorage(py::module_ &m)
11 {
12#define DNDS_PY_ENUM_CLASS_DeviceBackend_ADD(v) value(#v, DeviceBackend::v)
13 auto DeviceBackend_ = py::enum_<DeviceBackend>(m, "DeviceBackend");
14 DeviceBackend_
15 .DNDS_PY_ENUM_CLASS_DeviceBackend_ADD(Unknown)
16 .DNDS_PY_ENUM_CLASS_DeviceBackend_ADD(Host)
17#ifdef DNDS_USE_CUDA
18 .DNDS_PY_ENUM_CLASS_DeviceBackend_ADD(CUDA)
19#endif
20 .DNDS_PY_ENUM_CLASS_DeviceBackend_ADD(Custom1);
21
22 DeviceBackend_
23 .def(py::init([](const std::string &name) -> DeviceBackend
24 { return device_backend_name_to_enum(name); }));
25 }
26
27 inline void pybind11_bind_device_controls(py::module_ &m)
28 {
29 // #ifdef DNDS_USE_CUDA
30 // m.def("cudaGetDevice", []()
31 // {
32
33 // });
34 // #endif
35 }
36}
Shared pybind11 plumbing used by every *_bind.hpp in DNDS (buffer-protocol type check,...
Device memory abstraction layer with backend-specific storage and factory creation.
the host side operators are provided as implemented
DeviceBackend
Enumerates the backends a DeviceStorage / Array can live on.
@ Unknown
Unset / sentinel.
@ Custom1
Reserved slot for a project-specific backend.
@ Host
Plain CPU memory.
void pybind11_bind_device_controls(py::module_ &m)
void pybind11_bind_deviceStorage(py::module_ &m)
DeviceBackend device_backend_name_to_enum(std::string_view s)
Inverse of device_backend_name. Returns Unknown for unrecognised names.