平台: Raspberry Pi 3上的g ++
使用过的图书馆 OpenCV& OpenMP的
问题: 我使用openMP来提高跟踪算法的性能。 我已在双核NB上验证了代码,处理时间变为50%。 然后我将代码移植到Raspberry Pi 3(四核)上,与没有openMP的Raspberry Pi 3上运行相比,处理时间仍然是50%。
预期输出 我希望它更快~~~
P.S
关键代码
vector<double> vSumRadio(sampleBoxNum, 0);
#pragma omp parallel for num_threads(4)
for (int j=0; j< sampleBoxNum; j++)
{
double eSumRadioTmp = 0;
double eTmp1 = 0;
double eTmp2 = 0;
eSumRadioTmp = 0.0f;
for (int i = 0; i<featureNum; i++)
{
double ePosTmp = 0, eNegTmp = 0;
eTmp1 = (sampleValue[i][j]-Pos[i])*(sampleValue[i][j]-Pos[i]);
eTmp2 = (sampleValue[i][j]-Neg[i])*(sampleValue[i][j]-Neg[i]);
ePosTmp = exp(eTmp1/-(2.0f*sigmaPos[i]*sigmaPos[i]
+1e-30))/(sigmaPos[i] + 1e-30);
eNegTmp = exp(eTmp2/-(2.0f*sigmaNeg[i]*sigmaNeg[i]+
1e-30))/(sigmaNeg[i]+1e-30);
eSumRadioTmp += log(ePosTmp + 1e-30) - log(eNegTmp + 1e-30);
}
vSumRadio[j] = eSumRadioTmp;
}