7 #ifndef CUDA_API_WRAPPERS_PCI_ID_HPP_ 8 #define CUDA_API_WRAPPERS_PCI_ID_HPP_ 37 optional<int>
function;
40 operator ::std::string()
const;
71 ::std::string as_string { pci_id };
73 auto result = cuDeviceGetByPCIBusId(&cuda_device_id, as_string.c_str());
75 "Failed obtaining a CUDA device ID corresponding to PCI id " + as_string);
76 return cuda_device_id;
85 #endif // CUDA_API_WRAPPERS_PCI_ID_HPP_ Definitions and functionality wrapping CUDA APIs.
Definition: array.hpp:22
optional< int > domain
The four fields of the PCI configuration space.
Definition: pci_id.hpp:34
CUdevice id_t
Numeric ID of a CUDA device used by the CUDA Runtime API.
Definition: types.hpp:850
static pci_location_t parse(const ::std::string &id_str)
Parse a string representation of a device's PCI location.
#define throw_if_error_lazy(status__,...)
A macro for only throwing an error if we've failed - which also ensures no string is constructed unle...
Definition: error.hpp:316
Location "coordinates" for a CUDA device on a PCIe bus.
Definition: pci_id.hpp:24
Facilities for exception-based handling of Runtime and Driver API errors, including a basic exception...
Fundamental CUDA-related type definitions.