英特尔 MKL 函数错误 (C++)
我试图测试 Intel 的速度 MKL,但它给出了警告和错误,
ipo : warning #11021: unresolved @cblas_sdot@20
1> Referenced in ipo_36165obj.obj
1>ipo : error #11023: Not all components required for linking are present on command line
cpp 文件:
#pragma once
#include <iostream>
#include <mkl_cblas.h>
#include <time.h>
#include <iomanip>
int main () {
float a[3], b[3], c;
a[0] = 1.f;
a[1] = 2.f;
a[2] = 3.f;
b[0] = 4.f;
b[1] = 5.f;
b[2] = 6.f;
int num = 1e5;
bool key = 0;
clock_t sTime = clock();
if (key) {
for (int i=0; i<num; ++i) {
c = cblas_sdot(3,a,1,b,1);
}
}
else {
for (int i=0; i<num; ++i) {
c = a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
}
}
clock_t elap = clock() - sTime;
float eTime = elap / ((float) CLOCKS_PER_SEC);
if (eTime > 60) {eTime /= 60; std::cout << ">> elapsed time : " << std::fixed << std::setprecision(1) << eTime << " min" << std::endl;}
else {std::cout << ">> elapsed time : " << std::fixed << std::setprecision(5) << eTime << " sec" << std::endl;}
std::cin.ignore();
return 0;
}
编辑:
链接器的命令行:
/OUT:"C:\Users \Orxan\videos\documents\visual studio 2010\Projects\arrTut\Release\arrTut.exe" /NOLOGO "kernel32.lib" "user32.lib" “gdi32.lib”“winspool.lib”“comdlg32.lib”“advapi32.lib”“shell32.lib”“ole32.lib”“oleaut32.lib”“uuid.lib”“odbc32.lib”“odbccp32.lib” /MANIFEST /ManifestFile:"Release\arrTut.exe.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\Orxan\videos\documents\visual studio 2010\Projects\arrTut\Release\arrTut.pdb" /OPT:REF /OPT:ICF /PGD:"C:\Users\Orxan\videos\documents\visual studio 2010\Projects\arrTut\Release\arrTut.pgd" /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86
编译器命令行:
/Zi /nologo /W3 /O2 /Ob2 /Oi /Ot /Oy /Qipo /GA /Qparallel /D "_MBCS" /EHsc /GS /Gy /fp:fast /Zc:wchar_t /Zc:forScope /Fp"Release\arrTut.pch" /Fa"Release\" /Fo"Release\" /Fd"Release\vc100.pdb" /Gr
I was trying to test the speed MKL of Intel but it gives a warning and an error as,
ipo : warning #11021: unresolved @cblas_sdot@20
1> Referenced in ipo_36165obj.obj
1>ipo : error #11023: Not all components required for linking are present on command line
The cpp file:
#pragma once
#include <iostream>
#include <mkl_cblas.h>
#include <time.h>
#include <iomanip>
int main () {
float a[3], b[3], c;
a[0] = 1.f;
a[1] = 2.f;
a[2] = 3.f;
b[0] = 4.f;
b[1] = 5.f;
b[2] = 6.f;
int num = 1e5;
bool key = 0;
clock_t sTime = clock();
if (key) {
for (int i=0; i<num; ++i) {
c = cblas_sdot(3,a,1,b,1);
}
}
else {
for (int i=0; i<num; ++i) {
c = a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
}
}
clock_t elap = clock() - sTime;
float eTime = elap / ((float) CLOCKS_PER_SEC);
if (eTime > 60) {eTime /= 60; std::cout << ">> elapsed time : " << std::fixed << std::setprecision(1) << eTime << " min" << std::endl;}
else {std::cout << ">> elapsed time : " << std::fixed << std::setprecision(5) << eTime << " sec" << std::endl;}
std::cin.ignore();
return 0;
}
EDIT:
The command line for linker:
/OUT:"C:\Users\Orxan\videos\documents\visual studio 2010\Projects\arrTut\Release\arrTut.exe" /NOLOGO "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:"Release\arrTut.exe.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\Orxan\videos\documents\visual studio 2010\Projects\arrTut\Release\arrTut.pdb" /OPT:REF /OPT:ICF /PGD:"C:\Users\Orxan\videos\documents\visual studio 2010\Projects\arrTut\Release\arrTut.pgd" /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86
The compiler command line:
/Zi /nologo /W3 /O2 /Ob2 /Oi /Ot /Oy /Qipo /GA /Qparallel /D "_MBCS" /EHsc /GS /Gy /fp:fast /Zc:wchar_t /Zc:forScope /Fp"Release\arrTut.pch" /Fa"Release\" /Fo"Release\" /Fd"Release\vc100.pdb" /Gr
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论