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::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::CPUDeviceInfo, mindspore::GPUDeviceInfo, mindspore::KirinNPUDeviceInfo
Public Functions
-
virtual enum DeviceType GetDeviceType() const = 0
Get the type of this DeviceInfoContext.
- 返回
Type of this DeviceInfoContext.
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.
- 返回
A pointer of type T after conversion. If the conversion fails, it will be nullptr.
-
inline std::string GetProvider() const
obtain provider’s name
- 返回
provider’s name.
-
inline void SetProvider(const std::string &provider)
set provider’s name.
- 参数
provider – [in] define the provider’s name.
-
inline std::string GetProviderDevice() const
obtain provider’s device type.
- 返回
provider’s device type.
-
inline void SetProviderDevice(const std::string &device)
set provider’s device type.
- 参数
device – [in] define the provider’s device type.EG: CPU.
set memory allocator.
- 参数
allocator – [in] define the memory allocator which can be defined by user.
-
virtual enum DeviceType GetDeviceType() const = 0