Main Content

coder.BLASCallback.updateBuildInfo

Class: coder.BLASCallback
Namespace: coder

Update build information for linking to a specific BLAS library

Syntax

coder.BLASCallback.updateBuildInfo(buildInfo, buildctx)

Description

coder.BLASCallback.updateBuildInfo(buildInfo, buildctx) updates the build information object buildInfo with the information required for the build process to link to a specific BLAS library.

coder.BLASCallback is an abstract class for defining a BLAS callback class. A BLAS callback class specifies the BLAS library and CBLAS header and data type information to use for BLAS calls in code generated from MATLAB® code. At code generation time, if you specify a BLAS callback class, for certain vector and matrix function calls, the code generator produces BLAS calls in standalone code.

updateBuildInfo is an abstract method. You must implement it in the definition of your callback class that derives from coder.BLASCallback.

Input Arguments

expand all

After code generation, this object contains standard project, build option, and dependency information. In the updateBuildInfo method, to add the information for linking to the BLAS library, use build information methods.

Use the coder.BuildConfig methods to access the build context settings such as target language and platform-specific library file extensions.

Attributes

Abstracttrue
Statictrue

To learn about attributes of methods, see Method Attributes.

Examples

expand all

This example shows how to write an updateBuildInfo method to update the build information object with the information required to link to a specific BLAS library.

In a class that derives from coder.BLASCallback, write a method updateBuildInfo. This example is an implementation of the callback class mklcallback for integration with the Intel MKL BLAS library on a Windows® platform. Use this example BLAS callback class as a template.

classdef mklcallback < coder.BLASCallback
    methods (Static)
        function updateBuildInfo(buildInfo, ~)
            libPath = fullfile(pwd,'mkl','WIN','lib','intel64');
            libPriority = '';
            libPreCompiled = true;
            libLinkOnly = true;
            libs = {'mkl_intel_ilp64.lib' 'mkl_intel_thread.lib' 'mkl_core.lib'};
            buildInfo.addLinkObjects(libs, libPath, libPriority, libPreCompiled, libLinkOnly);
            buildInfo.addLinkObjects('libiomp5md.lib',fullfile(matlabroot,'bin','win64'), ...
                libPriority, libPreCompiled, libLinkOnly);
            buildInfo.addIncludePaths(fullfile(pwd,'mkl','WIN','include'));
            buildInfo.addDefines('-DMKL_ILP64');
        end
        function headerName = getHeaderFilename()
            headerName = 'mkl_cblas.h';
        end
        function intTypeName = getBLASIntTypeName()
            intTypeName = 'MKL_INT';
        end
    end
end

To update the build information with the name and location of your BLAS library, use the build information addlinkObjects method. If you use the Intel MKL BLAS library, use the link line advisor to see which libraries and compiler options are recommended for your use case.

To update the build information with the location of the header files, use the build information addIncludePaths method.

To add preprocessor macro definitions to the build information in updateBuildInfo, use the build information addDefines method.

To specify the compiler options in updateBuildInfo, use the build information addCompileFlags method.

To specify the linker options, use the build information addLinkFlags method.

Version History

Introduced in R2018b