Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

ippsWinKaiser is not thread safe

Oliver1971
Beginner
281 Views

Hello everyone,

 

We found that the ippsWinKaiser_32f_I() method is not thread safe, an example is attached to this message.

In our example we create a sinus wave as input vector and run the ippsWinKaiser_32f_I() method and store the result as "expected" result. We then launch multiple threads running the ippsWinKaiser_32f_I()  method again with the same input vector and compare the "expected" result against the new computation. We abort the test routine if any result does not match.

 

The test program fails every time until we protect the call to ippsWinKaiser_32f_I() with a mutex. Without mutex the example always fails, with mutex all tests were good.

 

Any suggestions how to fix this or is this a bug?

 

Best regards,

Oliver

 

P.S.: ippsWinHann_32f_I() and ippsWinHamming_32f_I() are working as expected

 

0 Kudos
4 Replies
Gennady_F_Intel
Moderator
227 Views

This is an unexpected behavior as IPP is not internally threaded library.

I didn't run this example, but I see that you compare like as follows: computed != expected

which is not correct in the case of floating point data.




0 Kudos
Oliver1971
Beginner
210 Views

Ok, I asked Microsofts KI for better comparision methods of two std vectors of floats:

bool compareVectors(const std::vector<float>&vec1, const std::vector<float>&vec2) {
    if (vec1.size() != vec2.size()) {
        return false;
    }

    float epsilon = 0.1f;
    for (size_t i = 0; i < vec1.size(); ++i) {
       if (std::abs(vec1[i] - vec2[i]) > epsilon) {
          return false;
       }
    }

    return true;
}

 

Now I observe the following difference (which disappears once I mutex lock the calls):

Oliver1971_0-1713273565225.png

 

Left expected (correct), right when error occurs. I even once saw an INF

0 Kudos
Oliver1971
Beginner
216 Views

Ok, I asked the KI how to properly compare two std::vectors of type float:

 

bool compareVectors(const std::vector<float>&vec1, const std::vector<float>&vec2) {
    if (vec1.size() != vec2.size()) {
       return false;
    }

    float epsilon = 0.1f;
    for (size_t i = 0; i < vec1.size(); ++i) {
       if (std::abs(vec1[i] - vec2[i]) > epsilon) {
          return false;
       }
    }

    return true;
}

 

I still get the errors (left expected, right new computation):

Oliver1971_0-1713275561758.png

 

0 Kudos
Gennady_F_Intel
Moderator
178 Views

Oliver,

yes, we have to confirmed that we see the same behavior as you reported.

The problem will be escalated internally and we will keep you informed with the status.

--Gennady

0 Kudos
Reply