Class DeviceInfoContext

Inheritance Relationships

Base Type

  • public std::enable_shared_from_this< DeviceInfoContext >

Derived Types

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.

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.

返回

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.

void SetAllocator(const std::shared_ptr<Allocator> &allocator)

set memory allocator.

参数

allocator[in] define the memory allocator which can be defined by user.

std::shared_ptr<Allocator> GetAllocator() const

obtain memory allocator.

返回

memory allocator.