Quantcast
Channel: Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 2652

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

$
0
0

(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] = i + 1;
 }

 // Exec std::sqrt to all target
 for(auto i = 0; i < Size; i++)
 {
  Normal[i] = std::sqrt(Source[i]);
 }
 
 // Exec vdSqr to all target
 vdSqr((int)Size, Source.data(), MKL.data());

 for(auto i = 0; i < Size; i++)
 {
  if(std::abs(Normal[i] - MKL[i]) > 0.0001)
  {
   printf("No = %d, Val:%f Normal:%f MKL:%f\n", i, Source[i], Normal[i], MKL[i]);
   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,

 


Viewing all articles
Browse latest Browse all 2652

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>