Community
cancel
Showing results for 
Search instead for 
Did you mean: 
88 Views

vdSqr function seems not to return correct answer on Xeon Gold 6132

(Sorry for my poor English, I'm not a native.)

Hello,

vdSqrt function of MKL returns incorrect answer if I used this function under my developement environment.

Here is my environment.

OS:Windows 10 x64 Pro

CPU: Xeon Gold 6132 * 2

Mem:288GB

DevTools: Visual Studio 2017 (using MS C/C++ compiler , not Intel's C)+ MKL 2018 Upd1(AcademicResearch free License)

Here is short reproduction code,

#include "stdafx.h"
#include <vector>
#include <mkl.h>
int main()
{
 std::vector<double> Source, Normal, MKL;
 size_t Size = 10000;
 Source.resize(Size);
 Normal.resize(Size);
 MKL.resize(Size);
 // create calc. target source 1, 2, 3, .....
 for(auto i = 0; i < Size; i++)
 {
  Source = i + 1;
 }
 // Exec std::sqrt to all target
 for(auto i = 0; i < Size; i++)
 {
  Normal = std::sqrt(Source);
 }
 
 // Exec vdSqr to all target
 vdSqr((int)Size, Source.data(), MKL.data());
 for(auto i = 0; i < Size; i++)
 {
  if(std::abs(Normal - MKL) > 0.0001)
  {
   printf("No = %d, Val:%f Normal:%f MKL:%f\n", i, Source, Normal, MKL);
   throw std::runtime_error("mismatch!");
  }
 }
 return 0;
}
 

normal std::sqrt function returns 1, 1.4142, 1.732, .....

but MKL vdSqrt function returns 1, 4, 9, 16, .......

Sincerely,
 
0 Kudos
2 Replies
Gennady_F_Intel
Moderator
88 Views

pls try to use vdSqrtnay );

88 Views

I'm sorry for taking your time for my easy careless mistake.

I confirmed the correct result in the way you taught.

Thank you for your help.

 

Reply