Using the IBM Z Artificial Intelligence Optimization Library

The IBM Z® Artificial Intelligence Optimization Library (zAIO) provides an interface to core functions used to implement database queries embedded with AI information, extracted from a given database, and expressed as semantic queries. With this library, developers can integrate semantic embedding operations to a database-capable tool, such as IBM® Db2®, and SQL-enabled frameworks, such as Spark SQL and Python SQL.

The library is composed of several modules, as shown in Figure 1.
Figure 1. IBM Z Artificial Intelligence Optimization Library framework
A diagram of the IBM Z Artificial Intelligence Optimization Library framework, which is explained in the surrounding text.

The first module, known as the semantic module, implements atomic semantic operations on elements or words of a dictionary. The dictionary represents a model composed of unique words and multi-dimensional floating-point vectors. The dictionary or model is the output of a training operation performed on a translated view of a database. See ibm-data2vec documentation for specific details regarding data input, data processing, training, and output model generation. The semantic operations implement specific mathematical operations as described in the paper, Demonstrating Semantic SQL Queries over Relational Data using the AI-Powered Database. The semantic operations can be executed in a word-by-word mode or in batch where multiple words are selected for a given semantic operation. For instance, dot product can be a one-to-one operation (similar) or a one-to-many operation (prefetching).

The second module, known as the mathematical module, exposes a set of functions designed to operate on vectors and matrices as required by the semantic operations, such as the dot product or cosine distance calculations between two vectors as it is used by semantic similarity. This module is organized around three kernels that implement several linear algebra operations in three different ways to explore hardware acceleration features, as available by specific hardware and selected by the user-specified acceleration mode. The first kernel, scalar, implements the operations in a hardware agnostic way and thus is the slowest mode for most operations. The second kernel, CBLAS, implements the same operations using a linear algebra software package, such as OpenBLAS, which is designed to exploit hardware vector instructions on targeted hardware architectures, such as IBM Z and IBM Power®. The third kernel, zAIU_Math, implements the same functions targeting the use of the IBM Z Integrated Accelerator for AI (zAIU) features available on IBM Z systems designed with the IBM Telum® processor.

The topics that follow describe in detail how to integrate the library to a C®/C++ application as well as the syntax descriptions of all APIs. It also describes several acceleration capabilities to speed up most of the functions, including how to exploit hardware acceleration with the latest AI acceleration unit on the IBM z16™ CPU. A C program example that shows how to use all the APIs is also included.