L3 Python bindings

XFBLAS level 3 provides Python bindings that users could use XFBLAS libraries in Python. Examples of using XFBLAS Python bindings in keras to do classification are also available to try. Applications for using Python API could be found in L3 API application.

1. Introduction

1.1 Set Python Environment

Please refer to Python environment setup guide.

1.2 Build shared library

L3 Python bindings use ctypes to wrap the L3 API functions in pure Python. In order to call these Python functions, users need to build the xfblas.so by Makefile in L3/src/sw/python_api locally.

2. Using the XFBLAS L3 Python API

2.1 General description

This section describes how to use the XFBLAS library API level Python bindings. To use the library, users need to source PYTHONPATH to the directory of xfblas_L3.py and import xfblas_L3 as xfblas at the beginning of the Python file.

2.1.1 XFBLAS initialization

To initialize the library, call the following two functions.

import xfblas_L3 as xfblas
args, xclbin_opts = xfblas.processCommandLine()
xfblas.createGemm(args,xclbin_opts,1,0)

2.2 XFBLAS Helper Function Reference