Class GPUDeviceInfo
#include <context.h>
派生自DeviceInfoContext,模型运行在GPU上的配置。
公有成员函数
函数 |
云侧推理是否支持 |
端侧推理是否支持 |
|---|---|---|
√ |
√ |
|
√ |
√ |
|
√ |
√ |
|
√ |
√ |
|
√ |
√ |
|
inline void SetPrecisionMode(const std::string &precision_mode) |
√ |
√ |
√ |
√ |
|
√ |
√ |
|
√ |
√ |
|
✕ |
√ |
|
✕ |
√ |
|
✕ |
√ |
|
✕ |
√ |
|
✕ |
√ |
|
✕ |
√ |
GetDeviceType
enum DeviceType GetDeviceType() const override
返回值
DeviceType::kGPU
SetDeviceID
void SetDeviceID(uint32_t device_id)
用于指定设备ID。
参数
device_id: 设备ID。
GetDeviceID
uint32_t GetDeviceID() const
返回值
已配置的设备ID。
GetRankID
int GetRankID() const
返回值
当前运行的RANK ID。
GetGroupSize
int GetGroupSize() const
返回值
当前运行的GROUP SIZE。
SetPrecisionMode
inline void SetPrecisionMode(const std::string &precision_mode)
用于指定推理时算子精度。
参数
precision_mode: 可选值origin(以模型中指定精度进行推理),fp16(以FP16精度进行推理),默认值:origin。
GetPrecisionMode
inline std::string GetPrecisionMode() const
返回值
已配置的精度模式。
SetEnableFP16
void SetEnableFP16(bool is_fp16)
用于指定是否以FP16精度进行推理。
参数
is_fp16: 是否以FP16精度进行推理。
GetEnableFP16
bool GetEnableFP16() const
返回值
已配置的精度模式。
SetEnableGLTexture
void SetEnableGLTexture(bool is_enable_gl_texture)
用于指定是否绑定OpenGL纹理数据。
参数
is_enable_gl_texture: 是否在推理时绑定OpenGL纹理数据。
GetEnableGLTexture
bool GetEnableGLTexture() const
返回值
已配置的绑定OpenGL纹理数据模式。
SetGLContext
void SetGLContext(void *gl_context)
用于指定OpenGL EGLContext。
参数
gl_context: OpenGL的当前运行时的EGLContext值。
GetGLContext
void *GetGLContext() const
返回值
已配置的指向OpenGL EGLContext的指针。
SetGLDisplay
void SetGLDisplay(void *gl_display)
用于指定OpenGL EGLDisplay。
参数
gl_display: OpenGL的当前运行时的EGLDisplay值。
GetGLDisplay
void *GetGLDisplay() const
返回值
已配置的指向OpenGL EGLDisplay的指针。