我试图测试英特尔的速度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