The AOCL-BLAS library can be linked statically or dynamically with the user application. It has a separate binary for single-threaded and multi-threaded implementation.
The basic build command is as following:
$ gcc test_blis.c -I<path-to-AOCL-BLAS-header> <link-options> \
-o test_blis.x
The following table explains different options depending on a particular build configuration:
Application Type |
Linking Type |
Link Options |
|---|---|---|
Single-threaded |
Static |
|
Single-threaded |
Dynamic |
|
Multi-threaded |
Static |
|
Multi-threaded |
Dynamic |
|
Example - Dynamic Linking and Execution
AOCL-BLAS can be built as a shared library. By default, the library is built as both static and shared libraries. Complete the following steps to build a shared lib version of AOCL-BLAS and link it with the user application:
During configuration, enable the support for the shared lib using the following command:
$ ./configure --disable-static --enable-shared zen
Link the application with the generated shared library using the following command:
$ gcc CBLAS_DGEMM_usage.c -I /path/to/include/aocl-blas/ \ -L/path/to/libblis.so -lblis -lm -lpthread -o CBLAS_DGEMM_usage.x
Ensure that the shared library is available in the library load path. Run the application using the following command (for this demo we will use the
CBLAS_DGEMM_usage.c):$ export LD_LIBRARY_PATH="/path/to/libblis.so" $ ./CBLAS_DGEMM_usage.x a = 1.000000 2.000000 3.000000 4.000000 b = 5.000000 6.000000 7.000000 8.000000 c = 19.000000 22.000000 43.000000 50.000000
The same header can be used for both static and shared libraries on
Windows. To access DLL’s public data symbols and objects, you can
define BLIS_EXPORT=declspec(dllimport) to import those symbols
explicitly. Importing is not required for:
The AOCL-BLAS and CBLAS interface users
Most of the cases where BLIS interface is used