gusucode.com > target工具箱matlab源码程序 > target/extensions/processor/intelhost/tfl/make_intel_ipp_tfl_table.m
function hLib = make_intel_ipp_tfl_table(arch) %MAKE_INTEL_IPP_TFL_TABLE - Creates TFL table for Intel IPP % Copyright 2009-2015 The MathWorks, Inc. % % incpath = fullfile('$(MATLAB_ROOT)', 'toolbox', 'shared', 'ipp', 'include'); try switch (arch) case {'win32', 'win64'}; libpath = fullfile('$(MATLAB_ROOT)', 'lib'); param.AdditionalLinkObjs = {'libmwipp.lib', 'libmwipp.lib'}; param.AdditionalLinkFlags = {}; case {'win64_mingw'}; libpath = fullfile('$(MATLAB_ROOT)', 'bin'); param.AdditionalLinkObjs = {'libmwipp.dll', 'libmwipp.dll'}; param.AdditionalLinkFlags = {}; arch = 'win64'; case {'glnx86', 'glnxa64'}; libpath = fullfile('$(MATLAB_ROOT)', 'bin'); param.AdditionalLinkObjs = {'libmwipp.so', 'libmwipp.so'}; param.AdditionalLinkFlags = {'-lpthread'}; otherwise % MAC is not supported at this time; return an empty table hLib = RTW.TflTable; return end % add architecture ID to the paths param.AdditionalIncludePaths = {incpath, fullfile(incpath, arch)}; param.AdditionalLinkObjsPaths = {fullfile(libpath, arch), fullfile(libpath, arch)}; % make IPP TFL table and add entries hLib = loc_make_ipp_tfl_table(param, arch); catch exc disp(['Error creating math library files: ' exc.getReport('basic')]); error(message('ERRORHANDLER:utils:TflMatFileCreationError')); end end % ------------------------------------------------------------------------- function hLib = loc_make_ipp_tfl_table(par, arch) hLib = RTW.TflTable; SrcPath = fullfile('$(MATLAB_ROOT)','toolbox','shared', 'ipp', 'src'); IncPath = fullfile('$(MATLAB_ROOT)','toolbox','shared', 'ipp', 'include'); % addfir2dentry(hLib, par, 'mw_ipp_conv2d_single', 'single', 'RTW_FIR2D_CONV_MODE', SrcPath, IncPath); addfir2dentry(hLib, par, 'mw_ipp_conv2d_double', 'double', 'RTW_FIR2D_CONV_MODE', SrcPath, IncPath); addfir2dentry(hLib, par, 'mw_ipp_corr2d_single', 'single', 'RTW_FIR2D_CORR_MODE', SrcPath, IncPath); addfir2dentry(hLib, par, 'mw_ipp_corr2d_double', 'double', 'RTW_FIR2D_CORR_MODE', SrcPath, IncPath); % addconvcorr1dentry(hLib, par, 'mw_ipp_conv1d_single', 'single', 'RTW_CONVCORR1D_CONV_MODE', SrcPath, IncPath, loc_getBounds('CONV1D', 1, arch)); addconvcorr1dentry(hLib, par, 'mw_ipp_conv1d_double', 'double', 'RTW_CONVCORR1D_CONV_MODE', SrcPath, IncPath, loc_getBounds('CONV1D', 2, arch)); % addconvcorr1dentry(hLib, par, 'mw_ipp_corr1d_single', 'single', 'RTW_CONVCORR1D_CORR_MODE', SrcPath, IncPath, loc_getBounds('CORR1D', 1, arch)); addconvcorr1dentry(hLib, par, 'mw_ipp_corr1d_double', 'double', 'RTW_CONVCORR1D_CORR_MODE', SrcPath, IncPath, loc_getBounds('CORR1D', 2, arch)); % addmatrmultplentry(hLib, par, 'mw_ipp_mpy_mm_single', 'single', 'RTW_OP_MUL', SrcPath, IncPath, loc_getBounds('MULT', 1, arch)); addmatrmultplentry(hLib, par, 'mw_ipp_mpy_mm_double', 'double', 'RTW_OP_MUL', SrcPath, IncPath, loc_getBounds('MULT', 2, arch)); % adddotproductentry(hLib, par, 'mw_ipp_dot_vv_single', 'single', 'RTW_OP_MUL', SrcPath, IncPath, loc_getBounds('DOTP', 1, arch)); adddotproductentry(hLib, par, 'mw_ipp_dot_vv_double', 'double', 'RTW_OP_MUL', SrcPath, IncPath, loc_getBounds('DOTP', 2, arch)); end % ------------------------------------------------------------------------- function bounds = loc_getBounds(opCode, dType, arch) % Following are the bounds for each IPP operation % The bounds are given in a 2D matrix for each operation % Each row represents one supported platform % Each column represents one supported data type % Supported platforms are: 1 - (win64, glnxa64), 2 - win32 % Supported data types are: 1 - single, 2 - double % % matrix operations MULT = {[ 6 6; inf, inf], [ 6, 6; inf, inf]; ... [30, 30; inf, inf], [inf, inf; inf, inf] ... }; % vector operations DOTP = {[30; inf], [30; inf]; ... [64; inf], [512; inf] ... }; CONV1D = {[10; inf], [10; inf]; ... [20; inf], [20; inf] ... }; CORR1D = {[10; inf], [10; inf]; ... [20; inf], [20; inf] ... }; idxPlatf = isequal(arch, 'win32') + 1; % 1 - (win64, glnxa64), 2 - win32 switch opCode case 'MULT' bounds = MULT{idxPlatf, dType}; case 'DOTP' bounds = DOTP{idxPlatf, dType}; case 'CONV1D' bounds = CONV1D{idxPlatf, dType}; case 'CORR1D' bounds = CORR1D{idxPlatf, dType}; otherwise bounds = [1 1; inf inf]; end end % LocalWords: libmwipp libmwipp glnx lpthread ERRORHANDLER utils mw % LocalWords: CONVCORR MUL vv DOTP