Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
ENH: Track Intel MKL finder
- Loading branch information
Pariksheet Nanda
committed
Feb 22, 2018
1 parent
05a3e47
commit 4479ed8
Showing
1 changed file
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
function [mkl_link,mkl_forstr,mkl_inc,mkl_lib,mkl_cmplr,mkl_ver] = opti_FindMKL(seq,ifortStatic) | ||
%Finds Intel MKL Libraries and returns path and version | ||
|
||
%Sequential build stuff | ||
if(nargin && ((ischar(seq) && strcmpi(seq,'seq')) || seq)) | ||
seq = true; | ||
else | ||
seq = false; | ||
end | ||
if (nargin < 2 || isempty(ifortStatic)) | ||
ifortStatic = false; | ||
end | ||
|
||
%Known MKL path locations (Modify to suit your system by adding to cell arrays, or create a new structure for other versions) | ||
MKL11_3.compiler = {'C:\Program Files\IntelSWTools\compilers_and_libraries\windows\compiler','C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\compiler'}; | ||
MKL11_3.mkl = {'C:\Program Files\IntelSWTools\compilers_and_libraries\windows\mkl','C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\mkl'}; | ||
MKL11_3.ver = '11.3'; | ||
|
||
MKL11_2.compiler = {'C:\Program Files\Intel\Composer XE 2015\compiler','C:\Program Files (x86)\Intel\Composer XE 2015\compiler'}; | ||
MKL11_2.mkl = {'C:\Program Files\Intel\Composer XE 2015\mkl','C:\Program Files (x86)\Intel\Composer XE 2015\mkl'}; | ||
MKL11_2.ver = '11.2'; | ||
|
||
MKL11_1.compiler = {'C:\Program Files\Intel\Composer XE 2013 SP1\compiler','C:\Program Files (x86)\Intel\Composer XE 2013 SP1\compiler'}; | ||
MKL11_1.mkl = {'C:\Program Files\Intel\Composer XE 2013 SP1\mkl','C:\Program Files (x86)\Intel\Composer XE 2013 SP1\mkl'}; | ||
MKL11_1.ver = '11.1'; | ||
|
||
MKL11.compiler = {'C:\Program Files\Intel\Composer XE 2013\compiler','C:\Program Files (x86)\Intel\Composer XE 2013\compiler','D:\Program Files (x86)\Intel\Composer XE 2013\compiler'}; | ||
MKL11.mkl = {'C:\Program Files\Intel\Composer XE 2013\mkl','C:\Program Files (x86)\Intel\Composer XE 2013\mkl','D:\Program Files (x86)\Intel\Composer XE 2013\mkl'}; | ||
MKL11.ver = '11'; | ||
|
||
MKL10_3_1.compiler = {'C:\Program Files\Intel\Composer XE 2011 SP1\compiler\','C:\Program Files (x86)\Intel\Composer XE 2011 SP1\compiler\'}; | ||
MKL10_3_1.mkl = {'C:\Program Files\Intel\Composer XE 2011 SP1\mkl\','C:\Program Files (x86)\Intel\Composer XE 2011 SP1\mkl\'}; | ||
MKL10_3_1.ver = '10.3 SP1'; | ||
|
||
MKL10_3.compiler = {'C:\Program Files\Intel\ComposerXE-2011\compiler\','C:\Program Files (x86)\Intel\ComposerXE-2011\compiler\'}; | ||
MKL10_3.mkl = {'C:\Program Files\Intel\ComposerXE-2011\mkl\','C:\Program Files (x86)\Intel\ComposerXE-2011\mkl\'}; | ||
MKL10_3.ver = '10.3'; | ||
|
||
%Add any new structures to below | ||
MKLLIB = {MKL11_3,MKL11_2,MKL11_1,MKL11,MKL10_3_1,MKL10_3}; | ||
|
||
|
||
%DO NOT MODIFY BELOW HERE | ||
for i = 1:length(MKLLIB) | ||
%Check for MKL | ||
[ok,mkl_link,mkl_forstr,mkl_inc,mkl_lib,mkl_cmplr,mkl_ver] = checkMKLVer(MKLLIB{i},seq,ifortStatic); | ||
if(ok), return; end | ||
end | ||
|
||
%Still no Luck - user must locate | ||
error('Could not find the Intel MKL Location on your computer. Please modify this file to locate it'); | ||
|
||
|
||
function [ok,mkl_link,mkl_forstr,mkl_inc,mkl_lib,mkl_cmplr,mkl_ver] = checkMKLVer(mklstr,seq,ifortStatic) | ||
%Local check function | ||
ok = false; mkl_link =''; | ||
%Find MKL | ||
for i = 1:length(mklstr.mkl) | ||
if(exist(mklstr.mkl{i},'dir')) | ||
dir_mkl = mklstr.mkl{i}; | ||
%Get Include Directory | ||
mkl_inc = [dir_mkl '\include']; | ||
if(~exist(mkl_inc,'dir')) | ||
error('Could not find MKL include directory. Checked:\n %s',mkl_inc); | ||
end | ||
%Get Library Directory | ||
switch(computer) | ||
case 'PCWIN' | ||
mkl_lib = [dir_mkl '\lib\ia32']; | ||
mkl_mklstr = ' -lmkl_intel_c'; | ||
case 'PCWIN64' | ||
mkl_lib = [dir_mkl '\lib\intel64']; | ||
mkl_mklstr = ' -lmkl_intel_lp64'; | ||
end | ||
if(~exist(mkl_lib,'dir')) | ||
error('Could not find MKL lib directory. Checked:\n %s\n',mkl_lib); | ||
end | ||
%Complete lib string | ||
if(seq) | ||
mkl_mklstr = [mkl_mklstr ' -lmkl_sequential -lmkl_core ']; %#ok<AGROW> | ||
else | ||
mkl_mklstr = [mkl_mklstr ' -lmkl_intel_thread -lmkl_core ']; %#ok<AGROW> | ||
end | ||
%Build complete linker string | ||
mkl_link = [' -I"' mkl_inc '" -L"' mkl_lib '" ' mkl_mklstr ]; | ||
mkl_ver = mklstr.ver; | ||
ok = true; | ||
break; | ||
end | ||
end | ||
|
||
%Find Compiler | ||
for i = 1:length(mklstr.compiler) | ||
if(exist(mklstr.compiler{i},'dir')) | ||
dir_cmplr = mklstr.compiler{i}; | ||
%Get Library Directory | ||
switch(computer) | ||
case 'PCWIN' | ||
mkl_cmplr = [dir_cmplr '\lib\ia32']; | ||
case 'PCWIN64' | ||
mkl_cmplr = [dir_cmplr '\lib\intel64']; | ||
end | ||
if(~exist(mkl_cmplr,'dir')) | ||
error('Could not find MKL compiler directory. Checked:\n %s\n',mkl_cmplr); | ||
end | ||
%Complete linker string | ||
mkl_link = [mkl_link ' -L"' mkl_cmplr '" -llibiomp5md ']; %#ok<AGROW> | ||
%Optional Fortran linker string | ||
if(ifortStatic) | ||
mkl_forstr = ' -lifconsol -llibifcoremt -llibifport -llibmmt -llibirc -lsvml_dispmt '; | ||
else | ||
mkl_forstr = ' -lifconsol -llibifcoremd -llibifportmd -llibmmd -llibirc -lsvml_disp -lsvml_dispmd '; | ||
end | ||
break; | ||
end | ||
end | ||
|
||
if(isempty(mkl_link)) | ||
error('Could Not Find Intel MKL On Your System! Modify this file to locate it on your PC.'); | ||
end |