Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
The Intel sign-in experience is changing in February to support enhanced security controls. If you sign in, click here for more information.
6656 Discussions

standard deviation of large vector in ippsStdDev_32f is zero

zhulei2017
Beginner
220 Views

hello, 

I use the ippsStdDev_32f with "ippAlgHintFast" mode to calculate standard deviation of a vector. It seems than the standard deviation value is zero when the length of vector is greater than 10000(maybe 8192). For comparison, the standard deviation value in ippsMeanStdDev_32f is not zero with the same parameters. 

It was described in the document that "ippAlgHintFast is faster but less accurate calculation". However, is it bug to have a result of zero in ippsStdDev_32f?

 

I am using IPP version 2021.7.0, windows10 1809, visual studio 2019.

I tested three hint mode of both two functions in c++:

int iSrcLength = 10000;
float fStdDevValue = 123.0f; //initialize
float fMeanValue = 123.0f; //initialize
std::unique_ptr<float[]> pInput(new float[iSrcLength]);
for (int idx = 0; idx < iSrcLength; ++idx)
{
    pInput[idx] = static_cast<float>(idx);
}
std::cout << "the length of the vector is: " << iSrcLength << std::endl;
if (ippStsNoErr != ippsStdDev_32f(pInput.get(), iSrcLength, &fStdDevValue, ippAlgHintNone))
{
    std::cout << "ERROR:ippsStdDev_32f" << std::endl;
}
std::cout << "StdDev Value in ippsStdDev_32f() with ippAlgHintNone:" << fStdDevValue << std::endl;
    
if (ippStsNoErr != ippsStdDev_32f(pInput.get(), iSrcLength, &fStdDevValue, ippAlgHintFast))
{
    std::cout << "ERROR:ippsStdDev_32f" << std::endl;
}
std::cout << "StdDev Value in ippsStdDev_32f() with ippAlgHintFast:" << fStdDevValue << std::endl;

if (ippStsNoErr != ippsStdDev_32f(pInput.get(), iSrcLength, &fStdDevValue, ippAlgHintAccurate))
{
    std::cout << "ERROR:ippsStdDev_32f" << std::endl;
}
std::cout << "StdDev Value in ippsStdDev_32f() with ippAlgHintAccurate:" << fStdDevValue << std::endl;

if (ippStsNoErr != ippsMeanStdDev_32f(pInput.get(), iSrcLength, &fMeanValue, &fStdDevValue, ippAlgHintNone))
{
    std::cout << "ERROR:ippsMeanStdDev_32f" << std::endl;
}
std::cout << "StdDev Value in ippsMeanStdDev_32f() with ippAlgHintNone:" << fStdDevValue << std::endl;

if (ippStsNoErr != ippsMeanStdDev_32f(pInput.get(), iSrcLength, &fMeanValue, &fStdDevValue, ippAlgHintFast))
{
    std::cout << "ERROR:ippsMeanStdDev_32f" << std::endl;
}
std::cout << "StdDev Value in ippsMeanStdDev_32f() with ippAlgHintFast:" << fStdDevValue << std::endl;

if (ippStsNoErr != ippsMeanStdDev_32f(pInput.get(), iSrcLength, &fMeanValue, &fStdDevValue, ippAlgHintAccurate))
{
    std::cout << "ERROR:ippsMeanStdDev_32f" << std::endl;
}
std::cout << "StdDev Value in ippsMeanStdDev_32f() with ippAlgHintAccurate:" << fStdDevValue << std::endl;

 results:

the length of the vector is: 10000
StdDev Value in ippsStdDev_32f() with ippAlgHintNone:2886.9
StdDev Value in ippsStdDev_32f() with ippAlgHintFast:0
StdDev Value in ippsStdDev_32f() with ippAlgHintAccurate:2886.9
StdDev Value in ippsMeanStdDev_32f() with ippAlgHintNone:2886.9
StdDev Value in ippsMeanStdDev_32f() with ippAlgHintFast:2886.9
StdDev Value in ippsMeanStdDev_32f() with ippAlgHintAccurate:2886.9

 

Labels (1)
0 Kudos
3 Replies
VidyalathaB_Intel
Moderator
173 Views

Hi Lei,

 

Thanks for reaching out to us and bringing up this issue.

I could reproduce the issue in the Windows environment with large vector size and could see the mismatch in the results same as yours

 

the length of the vector is: 10000
StdDev Value in ippsStdDev_32f() with ippAlgHintNone:2886.9
StdDev Value in ippsStdDev_32f() with ippAlgHintFast:0
StdDev Value in ippsStdDev_32f() with ippAlgHintAccurate:2886.9
StdDev Value in ippsMeanStdDev_32f() with ippAlgHintNone:2886.9
StdDev Value in ippsMeanStdDev_32f() with ippAlgHintFast:2886.9
StdDev Value in ippsMeanStdDev_32f() with ippAlgHintAccurate:2886.9

 

But the same code when tried running in a Linux environment the results are the same for both APIs

VidyalathaB_Intel_0-1671531405683.png

 

Anyways we will update you with the reason behind the mismatch in the results of standard deviation on Windows and till then we appreciate your patience.

 

Regards,

Vidya.

 

zhulei2017
Beginner
124 Views

Hi Vidya,

 

Thanks for your reply. I haven't tried it in a Linux environment. But, in Windows IPP version 2019.0.4, the results are the same as Linux environment. If there is any update on this issue, please let me know, thanks.

 

Regards,

Lei.

VidyalathaB_Intel
Moderator
73 Views

Hi Lei,


>>If there is any update on this issue, please let me know, thanks.


Sure, we will get back to you if there is any update on this issue and till then we appreciate your patience.


Regards,

Vidya.


Reply