OpenBLAS callback does not work well
22 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello everyone,
I am trying BLAS calls in my C code generated from the Simulink model. For this I use Intel MKL BLAS and OpenBLAS. MKL BLAS works well. But OpenBLAS is not called correctly. In order to get BLAS-Calls I'm using the templates which are in the following link:
My Intel MKL BLAS-Callback:
classdef IntelMKLBLAS < coder.BLASCallback
methods (Static)
function updateBuildInfo(buildInfo, ~)
libPath = fullfile('C:\','Program Files (x86)','Intel', ...
'oneAPI','mkl','2021.4.0','lib','intel64');
libPriority = '';
libPreCompiled = true;
libLinkOnly = true;
libs = {'mkl_intel_ilp64.lib' ...
'mkl_sequential.lib' ...
'mkl_core.lib'};
buildInfo.addLinkObjects(libs, libPath, libPriority, libPreCompiled, ...
libLinkOnly);
buildInfo.addIncludePaths(fullfile('C:\','Program Files (x86)', ...
'Intel','oneAPI','mkl','2021.4.0','include'));
buildInfo.addDefines('-DMKL_ILP64');
end
function headerName = getHeaderFilename()
headerName = 'mkl_cblas.h';
end
function intTypeName = getBLASIntTypeName()
intTypeName = 'MKL_INT';
end
end
end
and OpenBLAS-Callback:
classdef OpenBLAS < coder.BLASCallback
methods (Static)
function updateBuildInfo(buildInfo, ~)
buildInfo.addIncludePaths(fullfile('C:\','OpenBLAS-0.3.19','include'));
buildInfo.addLinkFlags('-lpthread');
libPriority = '';
libPreCompiled = true;
libLinkOnly = true;
libName = 'libopenblas.lib';
libPath = fullfile('C:\','OpenBLAS-0.3.19','lib');
buildInfo.addLinkObjects(libName, libPath, ...
libPriority, libPreCompiled, libLinkOnly);
end
function headerName = getHeaderFilename()
headerName = 'cblas.h';
end
function intTypeName = getBLASIntTypeName()
intTypeName = 'blasint';
end
end
end
I can not get any solution from OpenBLAS-Calls. I think there is a problem with the .lib file I am using in OpenBLAS. But unlike Intel MKL, OpenBLAS does not have any extra .lib files. I use the the latest version of OpenBLAS in following link:
Should I use same .lib files like in Intel MKL?
Or I would be pleased for any advice how to complete the OpenBLAS calls.
Thanks
1 commentaire
Raghu Boggavarapu
le 16 Déc 2025 à 11:30
Could you check LAPACK/BLAS callbacks we have published here: GitHub - mathworks/MATLAB-Coder-integration-for-BLAS-LAPACK: A collection of MATLAB callback classes for interfacing with external BLAS and LAPACK libraries, such as OpenBLAS and MKL, to enhance performance in standalone code generation.
Réponses (0)
Voir également
Catégories
En savoir plus sur Execution Speed dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!