- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
(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>
#include <vector>
#include <mkl.h>
int main()
{
std::vector<double> Source, Normal, MKL;
size_t Size = 10000;
{
std::vector<double> Source, Normal, MKL;
size_t Size = 10000;
Source.resize(Size);
Normal.resize(Size);
MKL.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;
}
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++)
{
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;
}
{
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,
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
pls try to use vdSqrt( n, a, y );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page