update 改为4显卡

dev_lsy
liusiyang 4 weeks ago
parent 1a1edf8475
commit 4643bc12d0

@ -103,6 +103,8 @@ int main(int argc, char *argv[])
GPU_Config gpu; GPU_Config gpu;
gpu.gpu_0 = true; gpu.gpu_0 = true;
gpu.gpu_1 = true; gpu.gpu_1 = true;
gpu.gpu_2 = true;
gpu.gpu_3 = true;
AI_Factory->InitALLAIModle(gpu); AI_Factory->InitALLAIModle(gpu);
std::shared_ptr<AIModel_Base> BOE_Edge_Detect = AI_Factory->BOE_Edge_Detect; std::shared_ptr<AIModel_Base> BOE_Edge_Detect = AI_Factory->BOE_Edge_Detect;

@ -31,10 +31,14 @@ struct GPU_Config
{ {
bool gpu_0; bool gpu_0;
bool gpu_1; bool gpu_1;
bool gpu_2;
bool gpu_3;
GPU_Config() GPU_Config()
{ {
gpu_0 = true; gpu_0 = true;
gpu_1 = true; gpu_1 = true;
gpu_2 = true;
gpu_3 = true;
} }
int GetNum() int GetNum()
{ {
@ -47,12 +51,22 @@ struct GPU_Config
{ {
num++; num++;
} }
if (gpu_2)
{
num++;
}
if (gpu_3)
{
num++;
}
return num; return num;
} }
void copy(GPU_Config tem) void copy(GPU_Config tem)
{ {
this->gpu_0 = tem.gpu_0; this->gpu_0 = tem.gpu_0;
this->gpu_1 = tem.gpu_1; this->gpu_1 = tem.gpu_1;
this->gpu_2 = tem.gpu_2;
this->gpu_3 = tem.gpu_3;
} }
}; };

@ -48,22 +48,22 @@ int AIModel_Impl::Init(AIModelRun_Config config)
if (m_modelRun_Config.gpuconfig.gpu_0) if (m_modelRun_Config.gpuconfig.gpu_0)
{ {
re = LoadEngine(0); re = LoadEngine(0);
// 加载失败
if (re != 0)
{
}
} }
if (m_modelRun_Config.gpuconfig.gpu_1) if (m_modelRun_Config.gpuconfig.gpu_1)
{ {
re = LoadEngine(1); re = LoadEngine(1);
// 加载失败 }
if (re != 0) if (m_modelRun_Config.gpuconfig.gpu_2)
{ {
} re = LoadEngine(2);
}
if (m_modelRun_Config.gpuconfig.gpu_3)
{
re = LoadEngine(3);
} }
int nGPUNum = m_GPU_Engine.size(); int nGPUNum = m_GPU_Engine.size();
// 模型载入失败 // 模型载入失败
if (nGPUNum <= 0 || nGPUNum > 2) if (nGPUNum <= 0 || nGPUNum > 4)
{ {
printf(" %s model Init error \n", m_modelRun_Config.strName.c_str()); printf(" %s model Init error \n", m_modelRun_Config.strName.c_str());
return 2; return 2;
@ -113,10 +113,14 @@ int AIModel_Impl::Init(AIModelRun_Config config)
// 生产推理用的 参数信息 // 生产推理用的 参数信息
if (m_GPU_Engine.size() > 1) if (m_GPU_Engine.size() > 1)
{ {
if (m_GPU_Engine.at(0)->cudaSteams.size() != m_GPU_Engine.at(1)->cudaSteams.size()) size_t firstStreamNum = m_GPU_Engine.at(0)->cudaSteams.size();
for (size_t i = 1; i < m_GPU_Engine.size(); i++)
{ {
printf(" %s model Init error \n", m_modelRun_Config.strName.c_str()); if (m_GPU_Engine.at(i)->cudaSteams.size() != firstStreamNum)
return 3; {
printf(" %s model Init error \n", m_modelRun_Config.strName.c_str());
return 3;
}
} }
} }
if (streamNum <= 0) if (streamNum <= 0)

@ -302,6 +302,8 @@ int ALLImgCheckAnalysisy::InitAIFactory()
GPU_Config gpu; GPU_Config gpu;
gpu.gpu_0 = true; gpu.gpu_0 = true;
gpu.gpu_1 = true; gpu.gpu_1 = true;
gpu.gpu_2 = true;
gpu.gpu_3 = true;
AI_Factory->InitALLAIModle(gpu); AI_Factory->InitALLAIModle(gpu);
return 0; return 0;

@ -60,7 +60,7 @@ enum CHECKIMGTRUNTYP_
// url长度 // url长度
#define MAX_ULR_LEN 256 #define MAX_ULR_LEN 256
#define MAX_GPU_NUM 2 #define MAX_GPU_NUM 4
// ncnn 行人检测 跟踪 检测最大 线程个数 // ncnn 行人检测 跟踪 检测最大 线程个数
#define MAX_PERSONTRACKER_THREAD_NUM 4 #define MAX_PERSONTRACKER_THREAD_NUM 4

Loading…
Cancel
Save