Class DeviceInfoContext
Defined in File context.h
Inheritance Relationships
Base Type
public std::enable_shared_from_this< DeviceInfoContext >
Derived Types
public mindspore::AscendDeviceInfo
(Class AscendDeviceInfo)public mindspore::AutoDeviceInfo
(Class AutoDeviceInfo)public mindspore::CPUDeviceInfo
(Class CPUDeviceInfo)public mindspore::GPUDeviceInfo
(Class GPUDeviceInfo)public mindspore::KirinNPUDeviceInfo
(Class KirinNPUDeviceInfo)
Class Documentation
-
class DeviceInfoContext : public std::enable_shared_from_this<DeviceInfoContext>
DeviceInfoContext defines different device contexts.
Subclassed by mindspore::AscendDeviceInfo, mindspore::AutoDeviceInfo, mindspore::CPUDeviceInfo, mindspore::GPUDeviceInfo, mindspore::KirinNPUDeviceInfo
Public Functions
-
virtual enum DeviceType GetDeviceType() const = 0
Get the type of this DeviceInfoContext.
- Returns
Type of this DeviceInfoContext.
-
template<class T>
inline std::shared_ptr<T> Cast() A similar function to RTTI is provided when the -fno-rtti compilation option is turned on, which converts DeviceInfoContext to a shared pointer of type T, and returns nullptr if the conversion fails.
- Returns
A pointer of type T after conversion. If the conversion fails, it will be nullptr.
-
inline std::string GetProvider() const
obtain provider’s name
- Returns
provider’s name.
-
inline void SetProvider(const std::string &provider)
set provider’s name.
- Parameters
provider – [in] define the provider’s name.
-
inline std::string GetProviderDevice() const
obtain provider’s device type.
- Returns
provider’s device type.
-
inline void SetProviderDevice(const std::string &device)
set provider’s device type.
- Parameters
device – [in] define the provider’s device type.EG: CPU.
-
void SetAllocator(const std::shared_ptr<Allocator> &allocator)
set memory allocator.
- Parameters
allocator – [in] define the memory allocator which can be defined by user.
-
std::shared_ptr<Allocator> GetAllocator() const
obtain memory allocator.
- Returns
memory allocator.
-
virtual enum DeviceType GetDeviceType() const = 0