AOCL-LAPACK - 5.0 English - 57404

AOCL User Guide (57404)

Document ID
57404
Release Date
2024-12-14
Version
5.0 English

5. AOCL-LAPACK#

AOCL-LAPACK is a high performant implementation of Linear Algebra PACKage (LAPACK). LAPACK provides routines for solving systems of linear equations, least-squares problems, eigenvalue problems, singular value problems, and the associated matrix factorizations. It is extensible, easy to use, and available under modified BSD open-source license. Applications relying on standard Netlib LAPACK interfaces can utilize AOCL-LAPACK with virtually no changes to their source code. AOCL-LAPACK supports C, Fortran, and C++ template interfaces (for a subset of APIs) for the LAPACK APIs.

AOCL-LAPACK is based on libFLAME, which was originally developed by current and former members of the Science of High-Performance Computing (SHPC) https://shpc.oden.utexas.edu/ group in the Institute for Computational Engineering and Sciences https://www.oden.utexas.edu/ at The University of Texas at Austin https://www.utexas.edu/ under the project name libflame. The upstream libFLAME repository is available on GitHub (flame/libflame). AMD is actively optimizing key routines in libFLAME as a part of the AOCL-LAPACK library, for AMD “Zen”-based architectures in the “amd” fork of libFLAME hosted on AMD GitHub.

From AOCL 4.1, AOCL-LAPACK is compatible with LAPACK 3.11.0 specification. In combination with the AOCL-BLAS library, which includes optimizations for the AMD “Zen”-based processors, AOCL-LAPACK enables running high performing LAPACK functionalities on AMD platforms.

AOCL-LAPACK API Guide documentation is available at https://docs.amd.com/go/en-US/63860-AOCL-LAPACK

5.1. Installing on Linux#

AOCL-LAPACK can be installed from source or pre-built binaries.

5.1.1. Building AOCL-LAPACK from Source#

GitHub URL: amd/libflame

Note

The applications which use AOCL-LAPACK must link to AOCL-BLAS (or any other BLAS library) for the BLAS functionalities.

Prerequisites

The following dependencies must be met for installing AOCL-LAPACK:

  • Target CPU ISA supporting AVX2 and FMA

  • Python

  • CMake

  • GCC, g++, and Gfortran

  • AOCL-Utils library

  • AOCC

For more information on validated versions of compiler, CMake and Python, refer to Validation Matrix.

Build Steps

AOCL-LAPACK supports compiling the library using CMake build system in addition to configure script method on Linux. Both the approaches to build the library are explained in this section.

Complete the following steps to build AOCL-LAPACK from source:

  1. Clone the Git repository (amd/libflame.git).

  2. Compile AOCL-LAPACK source.

Note

AOCL-LAPACK depends on AOCL Utilities library (AOCL-Utils) for certain functions including CPU architecture detection at runtime. The default build of AOCL-LAPACK requires the path to the AOCL-Utils header files to be set. The applications using AOCL-LAPACK must link with the AOCL-Utils library explicitly.

Method 1: Using CMake

AOCL-LAPACK can be linked with any Netlib BLAS compliant library when compiled with standard CMake options. However, AOCL-LAPACK provides an option to explicitly link with AOCL-BLAS library at compile time. This option enables tighter coupling between AOCL-LAPACK and AOCL-BLAS by invoking lower level AOCL-BLAS APIs directly and that could result in better performance for certain APIs on AMD “Zen” CPUs. It is recommended to link with AOCL-BLAS library by providing the option ENABLE_AOCL_BLAS in the CMake configuration as described in steps below.

  1. Create a new build directory, for example, newbuild:

    $ mkdir newbuild
    $ cd newbuild
    
  2. Run the following command to configure the project:

    Set header file path of the AOCL-Utils library using the LIBAOCLUTILS_INCLUDE_PATH option:

    • With GCC (default):

      $ export AOCL_ROOT="<path to AOCL-BLAS install directory>"
      
      **Using 32-bit Integer (LP64)**
      
      $ cmake ../ -DENABLE_AMD_FLAGS=ON -DENABLE_AOCL_BLAS=ON
      -DCMAKE_INSTALL_PREFIX=<your-install-dir>
      -DLIBAOCLUTILS_INCLUDE_PATH=<path_to_libaoclutils_header_files> -D
      LIBAOCLUTILS_LIBRARY_PATH=<path_to_libaoclutils library>
      
      **Using 64-bit Integer (ILP64)**
      
      $ cmake ../ -DENABLE_ILP64=ON -DENABLE_AMD_FLAGS=ON
      -DENABLE_AOCL_BLAS=ON -DCMAKE_INSTALL_PREFIX=<your-install-dir>
      -DLIBAOCLUTILS_INCLUDE_PATH=<path_to_libaoclutils_header_files> -D
      LIBAOCLUTILS_LIBRARY_PATH=<path_to_libaoclutils library>
      
    • With AOCC:

      $ export CC=clang
      $ export FC=flang
      $ export FLIBS="-lflang"
      $ export AOCL_ROOT="<path to AOCL-BLAS install directory>"
      
      **Using 32-bit Integer (LP64)**
      
      $ cmake ../ -DENABLE_AMD_AOCC_FLAGS=ON -DENABLE_AOCL_BLAS=ON
      -DCMAKE_INSTALL_PREFIX=<your-install-dir> -
      DLIBAOCLUTILS_INCLUDE_PATH=<path_to_libaoclutils_header_files> -D
      LIBAOCLUTILS_LIBRARY_PATH=<path_to_libaoclutils library>
      
      **Using 64-bit Integer (ILP64)**
      
      $ cmake ../ -DENABLE_ILP64=ON -DENABLE_AMD_AOCC_FLAGS=ON
      -DENABLE_AOCL_BLAS=ON -DCMAKE_INSTALL_PREFIX=<your-install-dir>
      -DLIBAOCLUTILS_INCLUDE_PATH=<path_to_libaoclutils_header_files> -D
      LIBAOCLUTILS_LIBRARY_PATH=<path_to_libaoclutils library>
      

    AOCL_ROOT environment variable must have the directories “include” and “lib” containing the necessary header files and binary of AOCL-BLAS respectively. As an alternate to setting environment variable, you can specify root path of the AOCL-BLAS library through the CMake option “AOCL_ROOT”:

    $ cmake -DENABLE_AMD_AOCC_FLAGS=ON -DENABLE_AOCL_BLAS=ON
    -DAOCL_ROOT=<path to AOCL-BLAS install directory> ...
    

    Shared library is turned on by default. To generate static library, provide the additional option:

    -DBUILD_SHARED_LIBS=OFF
    
  3. Compile and install the library:

    $ cmake --build . -j
    or
    $ make -j
    

    This will generate libflame.a/libflame.so library in the lib directory.

    To install the library, run:

    $ make install
    

Method 2: Using Autotools (Configure/Makefile)

Explicit linking with AOCL-BLAS library for tighter coupling between AOCL-LAPACK and AOCL-BLAS is not supported via autotools build. Use CMake based build for using this feature as explained above.

  1. Set the header file path of AOCL-Utils in CFLAGS environment variable:

    $ export CFLAGS="-I<path to libaoclutils include directory>"
    
  2. Run the configure script. An example below shows the recommended options to be used when compiling on AMD “Zen”-based processors.

    • With GCC (default)

      **Using 32-bit Integer (LP64)**
      
      $ ./configure --enable-amd-flags --prefix=<your-install-dir>
      
      **Using 64-bit Integer (ILP64)**
      
      $ ./configure --enable-amd-flags –enable-ilp64
      --prefix=<your-install-dir>
      
    • With AOCC

      $ export CC=clang
      $ export FC=flang
      $ export FLIBS="-lflang"
      
      **Using 32-bit Integer (LP64)**
      
      $ ./configure --enable-amd-aocc-flags --prefix=<your-install-dir>
      
      **Using 64-bit Integer (ILP64)**
      
      $ ./configure --enable-amd-aocc-flags –enable-ilp64
      --prefix=<your-install-dir>
      
  3. Make and install using the following commands:

    $ make -j
    $ make install
    

    By default, without the configure option prefix, the library will be installed in $HOME/flame.

For more information on the detailed steps to build and install AOCL-LAPACK including additional configuration options for tests, documentation and more please refer BUILD.md file under source root.

Auto-linking AOCL-Utils Library

The option to merge the AOCL-Utils library with the AOCL-LAPACK library is deprecated and not recommended in most scenarios. This is provided as backward compatibility for previous release.

Auto-linking of AOCL-Utils can be done using “ENABLE_EMBED_AOCLUTILS” option for both CMake and autoconfigure tools build mode. With this option, AOCL-LAPACK automatically links with libaoclutils library by downloading the source of libaoclutils from AMD GitHub, compiling it and linking/merging with AOCL-LAPACK library. A sample command is as follows:

**CMake Build:**

$ cmake ../ -DENABLE_AMD_FLAGS=ON -DENABLE_EMBED_AOCLUTILS=ON

**Autoconfigure:**

$ configure --enable-amd-flags
$ make ENABLE_EMBED_AOCLUTILS=1 -j

With embed AOCL-Utils build, if an external path is provided for the libaoclutils binary and header files through separate flags, ‘LIBAOCLUTILS_LIBRARY_PATH’ and

‘LIBAOCLUTILS_INCLUDE_PATH’ respectively, the specified library is used instead of downloading from GitHub. A sample command is as follows:

**CMake Build:**

$ cmake ../ -DENABLE_AMD_FLAGS=ON -DENABLE_EMBED_AOCLUTILS=ON
DLIBAOCLUTILS_LIBRARY_PATH=<path/to/libaoclutils/library>
-DLIBAOCLUTILS_INCLUDE_PATH=<path/to/libaoclutils/header/files>

**Autoconfigure:**

$ make ENABLE_EMBED_AOCLUTILS=1
LIBAOCLUTILS_LIBRARY_PATH=<path/to/libaoclutils/library>
LIBAOCLUTILS_INCLUDE_PATH=<path/to/libaoclutils/header/files> -j

Additional Notes on Configuration Options

  1. By default, the configuration options ENABLE_AMD_FLAGS and ENABLE_AMD_AOCC_FLAGS enable multi-threading using OpenMP for the selected APIs in AOCL-LAPACK. To disable multi- threading, use the configure option ENABLE_MULTITHREADING=OFF.

    Example:

    $ cmake ../ -DENABLE_AMD_FLAGS=ON -D ENABLE_MULTITHREADING=OFF
    

    Similarly, for autotools build, use the flag –enable-multithreading to set multi-threading ON (default) or OFF.

  2. To support binary portability across different architectures, the default compiler flags are set to -mtune=native -mavx2 -mfma -O3.

    This requires AVX2 and Fused Multiply Accumulate (FMA) support from the target CPU as mentioned in the Prerequisites section.

    For enabling further optimizations, such as enabling AVX2, FMA, or AVX512 depending on the ISA supported on the target CPU, you can use the following steps:

    Using CMake

    Set the flag LF_ISA_CONFIG to the desired ISA support. The available options are Auto, AVX2 (default), AVX512, and None. The command to use this is as follows:

    $ cmake .. -DLF_ISA_CONFIG=AVX512 -DENABLE_AMD_FLAGS=ON
    

    Using Configure/Makefile

    Set the configure option –enable-optimizations to the desired optimization flags and that will override the default flags. For example, on a AMD “Zen4”-based processor, you can set ‘znver4’ flag for improved performance:

    $ ./configure --enable-amd-flags
    --enable-optimizations="-march=znver4 -O3"
    
    or
    
    $ ./configure --enable-amd-flags
    --enable-optimizations="-march=native -O3"
    

    For the first case, ensure that the compiler you use supports ‘znver4’ flag.

5.1.2. Using Pre-Built Libraries#

You can find the AOCL-LAPACK library binaries for Linux at the following URL. The pre-built AOCL-LAPACK binaries are compiled with ENABLE_AOCL_BLAS option. Hence applications must link with AOCL-BLAS when using prebuilt AOCL-LAPACK library.

https://www.amd.com/en/developer/aocl.html#libflame

Also, the AOCL-LAPACK binary can be installed from the AOCL master installer tar file available at the following URL:

https://www.amd.com/en/developer/aocl.html

The tar file includes pre-built binaries of the other AMD libraries as explained in Using Master Package.

5.2. Usage on Linux#

The AOCL-LAPACK source directory contains test cases which demonstrate the usage of AOCL-LAPACK APIs.

From AOCL 3.2, a separate test suite is included for the LAPACK interfaces. Currently, it has test cases for critical set of AOCL-LAPACK APIs and new test cases are being added on an -ongoing basis. The test suite validates the APIs and displays performance numbers. The configuration files for input supports testing for a range of input sizes and different parameter values. For more information on this test suite, refer to the ReadMe.txt file in the directory test/main.

5.2.1. Use by Applications#

To use AOCL-LAPACK in your application, link with AOCL-LAPACK, AOCL-BLAS,and AOCL-Utils libraries while building the application.

AOCL-Utils library has libstdc++ library dependency. As AOCL-LAPACK is dependent on AOCL-Utils, applications must link with libstdc++(-lstdc++) as well.

An example program demonstrating the usage of AOCL-LAPACK is located at libflame/test/ example. This directory contains example source file showing the usage of AOCL-LAPACK library functions.

Use the included CMake script to compile and execute the program. You can test it on both Linux and Windows.

  1. Move to installed examples directory:

    $ cd test/example
    
  2. Configure the build system:

    $ mkdir build
    $ cd build
    $ cmake .. -DEXT_BLAS_LIBRARY_DEPENDENCY_PATH=< path to blas library>
    - DEXT_LAPACK_LIBRARY_PATH=<path to AOCL-LAPACK library>
    -DEXT_BLAS_LIBNAME=blas_lib_name -
    DEXT_LAPACK_LIBNAME=lapack_lib_name -DEXT_FLAME_HEADER_PATH=<path to
    AOCL-LAPACK header file FLAME.h> -DAOCLUTILS_LIBRARY_PATH=<path to
    aoclutils library>
    

    Example:

    $ cmake .. -DEXT_BLAS_LIBRARY_DEPENDENCY_PATH=/home/user/blis
    -DEXT_LAPACK_LIBRARY_PATH=/home/ user/libflame
    -DEXT_BLAS_LIBNAME=libblis-mt.a -DEXT_LAPACK_LIBNAME=libflame.a -
    DEXT_FLAME_HEADER_PATH=/home/user/aocl/include
    -DAOCLUTILS_LIBRARY_PATH=/home/usr/aoclutils- install/lib
    
  3. Compile the sample applications:

    **For Linux**
    
    $ cmake --build . or make
    
    **For Windows**
    
    $ cmake --build .
    
  4. Run the application

    **For Linux**
    
    $ ./test_dgetrf.x
    
    **For Windows**
    
    $ cd Debug
    $ test_dgetrf.exe
    

5.3. Building AOCL-LAPACK from Source on Windows#

AOCL-LAPACK (amd/libflame) uses CMake along with Microsoft Visual Studio for building binaries from the source on Windows. The following sections explain the GUI and command-line schemes of building the binaries and test suite.

Prerequisites

Refer to the Prerequisites sub-section in Build AOCL-BLAS from Source on Windows. Also, AOCL-LAPACK has dependency on AOCL-Utils library.

5.3.1. Building AOCL-LAPACK Using GUI#

5.3.1.1. Preparing Project with CMake GUI#

Complete the following steps in the CMake GUI:

  1. Set the source (folder containing AOCL-LAPACK source code) and build (folder in which the project files will be generated, for example, out) folder paths. It is not recommended to use the folder named build as a folder with that name exists at the top of AOCL-LAPACK source tree.

  2. Click on the Configure button to prepare the project options.

  3. Set the generator to Visual Studio 17 2022 and the compiler to ClangCl or LLVM.

  4. Update the options based on the project requirements. All the available options are listed in the following table:

    Table 5.1 AOCL-LAPACK Config Options#

    Build Option

    Feature

    BUILD_SHARED_LIBS

    • ON => Build Dynamic/Shared library (Default)

    • OFF => Build Static library

    ENABLE_AMD_FLAGS

    • ON => Enable by default and below flags will be (ON) along with this flag

      • BUILD_SHARED_LIBS

      • ENABLE_AMD_OPT

      • ENABLE_WINDOWS_BUILD

      • ENABLE_BLAS_EXT_GEMMT

      • ENABLE_MULTITHREADING

      • ENABLE_WRAPPER

      • ENABLE_BLIS1_USE_OF_FLA_MALLOC

      • ENABLE_BUILTIN_LAPACK2FLAME

      • ENABLE_EXT_LAPACK_INTERFACE

      • ENABLE_INTERNAL_ERROR_CHECKING

      • ENABLE_NON_CRITICAL_CODE

      • ENABLE_PORTABLE_TIMER

      • INCLUDE_LAPACKE

      • ENABLE_F2C_DOTC

      • ENABLE_VOID_RETURN_COMPLEX_FUNCTION

    • OFF => Disable all flags

    ENABLE_AMD_OPT

    • ON => Enable AMD optimized path (Default)

    • OFF => Disable AMD optimized path

    ENABLE_WINDOWS_BUILD

    • ON => Enable windows build (Default)

    • OFF => Disable Windows build

    ENABLE_BLAS_EXT_GEMMT

    • ON => Enable BLAS GEMMT Usage (Default)

    • OFF => Disable BLAS GEMMT Usage

    ENABLE_MULTITHREADING

    • ON => Enable OpenMP (Default)

    • OFF => Disable OpenMP

    ENABLE_WRAPPER

    • ON => Enable wrapper code (Default)

    • OFF => Disable wrapper code

    ENABLE_BLIS1_USE_OF_FLA_MALLOC

    • ON => Enable use of FLA-MALLOC (Default)

    • OFF => Disable use of FLA-MALLOC

    ENABLE_BUILTIN_LAPACK2FLAME

    • ON => Use lapack2flame library (Default)

    • OFF => Disable Use lapack2flame library

    ENABLE_EXT_LAPACK_INTERFACE

    • ON => Enable external lapack for subproblems (Default)

    • OFF => Disable external lapack

    ENABLE_INTERNAL_ERROR_CHECKING

    • ON => Enable internal checking levels (Default)

    • OFF => Disable internal checking levels

    ENABLE_NON_CRITICAL_CODE

    • ON => Enable non-critical (Default)

    • OFF => Disable non-critical

    ENABLE_PORTABLE_TIMER

    • ON => Uses portable timer (Default)

    • OFF => Disable use of portable timer

    INCLUDE_LAPACKE

    • ON => Include LAPACKE Code (Default)

    • OFF => Disable including LAPACKE Code

    ENABLE_F2C_DOTC

    • ON => Enable ‘void’ return C/ZDOTC and C/ZDOTU complex returned libFLAME functions (Default)

    • OFF => Disable ‘void’ return type functions

    ENABLE_VOID_RETURN_COMPLEX_FUNCTION

    • ON => Enable ‘void’ return cladiv/zladiv complex returned libFLAME functions (Default)

    • OFF => Disable ‘void’ return type functions

    ENABLE_ILP64

    • ON => 64-bit integer size

    • OFF => 32-bit integer size (Default)

    CMAKE_EXT_BLAS_LIBRARY_DEPENDENCY_PATH

    Use -DCMAKE_EXT_BLAS_LIBRARY_DEPENDENCY_PATH=<path> to choose the custom BLAS path

    EXT_BLAS_LIBNAME

    Use -DEXT_BLAS_LIBNAME=<BLAS library name>

    LIBAOCLUTILS_LIBRARY_PATH

    Use -DLIBAOCLUTILS_LIBRARY_PATH=<path> to choose the custom libaoclutils path

    LIBAOCLUTILS_INCLUDE_PATH

    Use -DLIBAOCLUTILS_INCLUDE_PATH=<path> to choose the custom libaoclutils header path

    BUILD_TEST

    • ON => Enable main test suite

    • OFF => Disable main test suite (Default)

    BUILD_LEGACY_TEST

    • ON => Enable legacy test suite

    • OFF => Disable legacy test suite (Default)

    BLAS_HEADER_PATH

    Use -DBLAS_HEADER_PATH=<path> to choose the custom BLAS header file path

    BUILD_NETLIB_TEST

    • ON => Enable Netlib test suite

    • OFF => Disable Netlib test suite (Default)

    ENABLE_EMBED_AOCLUTILS

    • ON => Enable embedding the AOCL-Utils library in AOCL-LAPACK

    • OFF => Disable embedding the AOCL-Utils library in AOCL-LAPACK (Default)

    ENABLE_AOCL_BLAS

    • ON => Enable tight-coupling with the AOCL-BLAS library to use AOCL-BLAS internal routines (Default)

    • OFF => Disable tight-coupling with AOCL-BLAS

    LF_ISA_CONFIG

    use -DLF_ISA_CONFIG=[options] Set the instruction set architecture (ISA) to compile with valid options: Auto, AVX2(Default),AVX512, and None

    AOCL_ROOT

    use -DAOCL_ROOT=< path to AOCL-BLAS install directory having include and lib folders >

  5. Provide the path to the BLAS and AOCL-Utils libraries. It will be used at the linking stage while building the test suite.

  6. To generate the Microsoft Visual Studio project in the out folder, click on the Generate button as shown in the following figure:

    _images/image13_aocl.jpeg

    Figure 5.1 AOCL-LAPACK CMake Configurations#

5.3.1.2. Building the Project in Visual Studio GUI#

Complete the following steps in the Microsoft Visual Studio GUI:

  1. Open the project generated by CMake (build folder) in Preparing Project with CMake GUI.

  2. To generate AOCL-LAPACK binaries, build the AOCL-LibFLAME-Win project. The library files will generate in the lib folder based on the project settings.

For example, libflame/lib/Release/AOCL-LibFLAME-Win-dll.dll or AOCL-LibFLAME-Win- dll.lib

5.3.2. Building AOCL-LAPACK Using Command-Line Arguments#

The project configuration and build procedures can also be triggered from the command prompt. The corresponding steps are described in the following sections.

5.3.2.1. Configuring the Project in Command Prompt#

In the AOCL-LAPACK project folder, create a folder out. Open the command prompt in this directory and run the following command to configure the project:

$ cmake -S .. -B . Example for building ILP64 mode binaries:
$ cmake -S .. -B . -G "Visual Studio 17 2022"
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -
DEXT_BLAS_LIBNAME="AOCL-LibBlis-Win-MT-dll.lib"
-DCMAKE_EXT_BLAS_LIBRARY_DEPENDENCY_PATH="<path to AOCL-BLAS
library>" -DAOCL_ROOT = <path to AOCL-BLAS install directory having
include and lib folders> -DLIBAOCLUTILS_LIBRARY_PATH=<path to
AOCL-Utils library including library> -
DLIBAOCLUTILS_INCLUDE_PATH=<path to AOCL-Utils header files>
-DENABLE_ILP64=ON - DENABLE_AMD_FLAGS=ON -DENABLE_AOCL_BLAS=ON -TLLVM
-DBUILD_TEST=OFF -DBUILD_NETLIB_TEST=OFF -DENABLE_WRAPPER=ON
-DOpenMP_libomp_LIBRARY="C:\Program Files\LLVM\lib\libomp.lib"

Note

Add -DENABLE_MULTITHREADING=OFF to build a single-threaded AOCL-LAPACK library.

You can refer to AOCL-LAPACK Config Options and update the parameter options according to the project requirements.

5.3.2.2. Building the Project in Command Prompt#

Open a command prompt in the libflameout directory. Invoke CMake with the build command with release or debug option. For example:

$ cmake --build . --config Release

The library files would be generated in the Release or Debug folder based on the project settings.

5.3.3. Building and Running Test Suite#

The Microsoft Visual Studio project for the test suite is generated as a part the CMake generate step. You can build the test projects from the Microsoft Visual Studio GUI or the command prompt as described in the previous sections.

As mentioned in AOCL-LAPACK Config Options, enable “BUILD_TEST” to build a new main test suite of AOCL-LAPACK. To build a legacy test suite, set “BUILD_LEGACY_TEST”.

Note

On Windows, both main test suite and legacy test suites must not be enabled together in the same build due to certain incompatible flag settings between the 2 projects.

5.4. Checking AOCL-LAPACK Operation Progress#

AOCL libraries perform tasks that can be computationally expensive. The AOCL Progress feature provides a mechanism, for a selected set of APIs, for the calling application to check how far a computation has progressed through a callback function.

Usage

The application must define the aocl_fla_progress or callback function in a specific format and register this callback function with the AOCL-LAPACK library.

The callback function prototype must be defined as follows:

int aocl_fla_progress(const char* const api, const integer lenapi,
const integer* const progress, const integer* const current_thread,
const integer* const total_threads)

However, you can change the function name as per your preference.

The following table explains AOCL-LAPACK Progress feature callback function parameters:

Table 5.2 AOCL-LAPACK Progress Feature Callback Function Parameters#

Parameter

Purpose

api

Name of the API running currently

lenapi

Length of the API name character buffer

progress

Linear progress made in the current thread so far

current_thread

Current thread ID

total_threads

Total number of threads in the current threads team

Callback Registration

The callback function must be registered with the library to report the progress. Each library has its own callback registration function. The registration is done by calling:

aocl_fla_set_progress(test_progress);

Example:

int aocl_fla_progress(const char* const api,const integer lenapi,
  const integer* const progress,const integer* const current_thread,
  const integer* const total_threads)
{
  printf("In AOCL FLA Progress thread %lld, at API %s, progress %lld total threads= %lld\n",
    *current_thread, api, *progress,*total_threads );
  return 0;
}

// or

int test_progress(const char* const api,const integer lenapi,const
integer * const progress,const integer *const current_thread,const
integer *const total_threads)
{
  printf( "In AOCL Progress thread %lld, at API %s, progress %lld total threads= %lld\n",
    *current_thread, api, *progress,*total_threads );
  return 0;
}

// Register the callback with:
aocl_fla_set_progress(test_progress);

Note

In the case of single-threaded AOCL-LAPACK (–enable-multithreading=none or ENABLE_MULTITHREADING=OFF), the values of “current_thread” and “total_threads” are set to 0 and 1 respectively. As a result, the callback function cannot be used to monitor the thread ID and thread count of the application.

Limitations

On Windows, aocl_fla_progress is not supported when using AOCL-LAPACK. Hence, the callback function must be registered through aocl_fla_set_progress.