Sample Code

Sample code is a great way to verify qatlib is installed and ready to use. The application cpa_sample_code is nearly identical in the qatlib package to the out-of-tree (OOT) QAT Driver package.

Installing the Sample Code

Intel® QAT sample code can be installed by either:

  • Installing from pre-built packages

  • Installing from source code

Distributions such as Fedora 34+, RHEL 9.1+, CentOS 9 Stream include QATzip packages within their repositories.

Installing from Packages

  1. Install qatlib-tests by running the below command:

    sudo dnf install -y qatlib-tests
    

    Important

    If this package is not available we can build all qatlib-tests packages from source files.

    Prior to building the library and application, uninstall qatlib package using the following command:

    sudo dnf remove qatlib
    

    See the Installing from Sources section for instructions on compiling from source.

Installing from Sources

Note

These steps assume the qatlib repository was copied in ~/qatlib.

  1. Install the sample applications by running the following command:

    cd ~/qatlib
    sudo make samples-install
    

Running the Sample Code

The sample code can be run using the following command:

cpa_sample_code

These tests take several minutes to complete. The command line parameters are documented in the Getting Started Guide.

With default configuration, the tests executed include asymmetric crypto and data compression. To modify the configuration, see the Configuration section.

Uninstalling the Sample Code

When the sample code is no longer required, it can be removed using the following commands:

Uninstalling from Packages

  1. Uninstall qatlib-tests by running the below command:

    sudo dnf remove qatlib-tests
    

Uninstalling from Sources

Note

These steps assume the qatlib repository was copied in ~/qatlib.

  1. Uninstall the sample applications by running the following command:

    cd ~/qatlib
    sudo make samples-uninstall