Main Content

coder.BLASCallback.updateBuildInfo

Class:coder.BLASCallback
Package: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 objectbuildInfowith the information required for the build process to link to a specific BLAS library.

coder.BLASCallbackis 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.

updateBuildInfois an abstract method. You must implement it in the definition of your callback class that derives fromcoder.BLASCallback

Input Arguments

expand all

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

Use thecoder.BuildConfigmethods to access the build context settings such as target language and platform-specific library file extensions.

Attributes

Abstract true
Static true

To learn about attributes of methods, seeMethod Attributes

Examples

expand all

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

In a class that derives fromcoder.BLASCallback, write a methodupdateBuildInfo。这个例子是一个n implementation of the callback classmklcallbackfor integration with theIntel MKLBLAS library on a Windows®platform. Use this example BLAS callback class as a template.

classdefmklcallback < coder.BLASCallbackmethods(Static)functionupdateBuildInfo(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');endfunctionheaderName = getHeaderFilename() headerName ='mkl_cblas.h';endfunctionintTypeName = getBLASIntTypeName() intTypeName ='MKL_INT';endendend

To update the build information with the name and location of your BLAS library, use the build informationaddlinkObjectsmethod. If you use the Intel MKL BLAS library, use thelink line advisorto 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 informationaddIncludePathsmethod.

To add preprocessor macro definitions to the build information inupdateBuildInfo, use the build informationaddDefinesmethod.

To specify the compiler options inupdateBuildInfo, use the build informationaddCompileFlagsmethod.

To specify the linker options, use the build informationaddLinkFlagsmethod.

Introduced in R2018b