OPAE Installation Guide

System compatibility

The OPAE SDK has been tested on the following configurations.

  • Hardware: tightly coupled FPGA products and programmable FPGA acceleration cards for Intel® Xeon® processors (to be released)
  • Operating System: tested on RedHat 7.3, Linux kernels 3.10 through 4.7
  • FIM (FPGA Interface Manager): 6.3.0

How to download the OPAE SDK

OPAE SDK releases are available on GitHub. There, you can also find the driver source code and DKMS packages for the respective SDK release.

The various componentes of OPAE are available via the following compressed tar files and RPM packages.

  • Source packages for the SDK and the drivers
opae-sdk-<release>.tar.gz                   (BSD License)   (all src for libopae-c, tools, samples, headers and ASE)
opae-sdk-<release>.zip                      (BSD License)   (ZIP archive, same content as opae-sdk-<release>.tar.gz)
opae-intel-fpga-driver-<release>.tar.gz     (GPLv2 License) (driver sources)
  • Binary package for the drivers
opae-intel-fpga-drv-<release>-1.x86_64.rpm  (GPLv2 License) (dkms and driver src to generate \*.ko at installation)

Software requirements

For building the kernel driver, the kernel development environment is required.

  • gcc >= 4.8.5
  • cmake >= 2.8
  • dkms.noarch (Release is tested with 2.2.0.3-34)

For building libopae-c, tools and samples, the following dependences are required:

  • libuuid-devel.x86_64: (tested with 2.23.2-33.el7)
  • libuuid.x86_64: (tested with 2.23.2-33.el7)
  • json-c-devel.x86_64: json-c-devel-0.11-4.el7_0.x86_64.rpm
  • json-c.x86_64: (tested with 0.11-4.el7_0)
  • cmake.x86_64: (tested with 2.8.12.2-2.el7)
  • boost.x86_64: (tested with 1.53.0-26.el7)
  • boost-devel.x86_64: (tested with 1.53.0-26.el7)

Driver installation with DKMS rpm package

Install:

$ sudo yum install opae-intel-fpga-drv-<release>.rpm

Uninsall:

$ sudo yum remove opae-intel-fpga-drv-<release>

During the rpm installation process, the tool will compile the driver from source then install the driver automatically. Driver installed by rpm package will be automatically install again after system reboot.

Driver build/installation with driver source package

Using the following command to untar the source tar ball:

$ tar zxvf opae-intel-fpga-driver-<release>.tar.gz

Following directory shall be extracted at the working directory where the above command is executed.

  • opae-intel-fpga-driver-<release>

Build the fpga driver from source with following procedures:

$ cd opae-intel-fpga-driver-<release>
$ make

Following kernel modules shall be generated from source:

  • fpga-mgr-mod.ko
  • intel-fpga-afu.ko
  • intel-fpga-fme.ko
  • intel-fpga-pci.ko

Install the above modules in the following order:

$ sudo insmod fpga-mgr-mod.ko
$ sudo insmod intel-fpga-pci.ko
$ sudo insmod intel-fpga-fme.ko
$ sudo insmod intel-fpga-afu.ko

Use lsmod to check if all 4 modules are installed correctly or not:

$ lsmod | grep fpga

Output should look like:

intel_fpga_fme         36864  0
intel_fpga_afu         28672  0
intel_fpga_pci         28672  2 intel_fpga_afu,intel_fpga_fme
fpga_mgr_mod           16384  1 intel_fpga_fme

Remove the driver modules in the following order:

$ sudo rmmod intel-fpga-afu
$ sudo rmmod intel-fpga-fme
$ sudo rmmod intel-fpga-pci
$ sudo rmmod fpga-mgr-mod

Manual Driver build from RPM package

Use the following command to extract the driver source files from the rpm:

$ mkdir opae-intel-fpga-driver-<release>
$ cd opae-intel-fpga-driver-<release>
$ rpm2cpio ../opae-intel-fpga-driver-<release>.rpm | cpio -idmv

Build the fpga driver from source with the following procedure:

$ cd ./usr/src/intel-fpga-<release>
$ make

OPAE SDK build/installation from OPAE SDK source

Using the following command to untar the source tar ball:

$ tar zxvf opae-sdk-<release>.tar.gz

Following directory shall be created at the working directory where the above command is executed.

  • opae-sdk-<release>

Build the OPAE C library (libopae-c), samples, tools, and the AFU Simulation Environment (ASE) library (libopae-c-ase) with the following commands:

$ cd opae-sdk-<release>
$ mkdir mybuild
$ cd mybuild
$ cmake .. -DBUILD_ASE=1
$ make

By default, the OPAE SDK will install into /usr/local if you also issue the following:

$ make install

You can change this installation prefix from /usr/local into something else by adding -DCMAKE_INSTALL_PREFIX=<new prefix> to the cmake command above.

Please see Quick Start Guide on how to run the hello_fpga sample to verify libopae-c & driver are built correctly.

Building OPAE SDK rpm packages from the source

In addition to building and installation from the source, users can also generate rpm packages for the SDK. The generated rpm packages can then be distributed to other users for easy installation. The advantage of this approach is that the other users do not need to have the build toolchain on their systems to install the OPAE SDK.

Follow the instructions in the previous steps. But in the last step, instead of make install, do

$ make package

This will generate the following rpm packages. The names of the packages may be different, depending on the cmake version used.

  • If cmake version is between 2.8.12 and 3.0.0:
opae-<release>-1.x86_64-libs.rpm    (libopae-c and samples)
opae-<release>-1.x86_64-tools.rpm   (tools)
opae-<release>-1.x86_64-devel.rpm   (headers)
opae-<release>-1.x86_64-ase.rpm     (libopae-c-ase)
  • If cmake version is 3.0.0 and above:
opae-libs-<release>-1.x86_64.rpm    (libopae-c and samples)
opae-tools-<release>-1.x86_64.rpm   (tools)
opae-devel-<release>-1.x86_64.rpm   (headers)
opae-ase-<release>-1.x86_64.rpm     (libopae-c-ase)

OPAE SDK installation with rpm packages

The rpm packages generated in the previous step can be installed using these commands (This example assumes the cmake version used to generate these packages was 2.8.12):

$ sudo yum install opae-<release>-1.x86_64-libs.rpm
$ sudo yum install opae-<release>-1.x86_64-tools.rpm
$ sudo yum install opae-<release>-1.x86_64-devel.rpm
$ sudo yum install opae-<release>-1.x86_64-ase.rpm

To uninstall:

$ sudo yum remove opae-<release>-1.x86_64-libs
$ sudo yum remove opae-<release>-1.x86_64-tools
$ sudo yum remove opae-<release>-1.x86_64-devel
$ sudo yum remove opae-<release>-1.x86_64-ase

FPGA Device Access Permissions

Access to FPGA accelerators and devices is controlled using file access permissions on the Intel® FPGA device files, /dev/intel-fpga-fme.* and /dev/intel-fpga-port.*, as well as to the files reachable through /sys/class/fpga/.

In order to allow regular (non-root) users to access accelerators, you need to grant them read and write permissions on /dev/intel/fpga-port.* (with * denoting the respective socket, i.e. 0 or 1). E.g.:

$ sudo chmod a+rw /dev/intel-fpga-port.0

Memlock limit

Depending on the requirements of your application, you may also want to increase the maximum amount of memory a user process is allowed to lock. The exact way to do this depends on your Linux distribution.

You can check the current memlock limit using

$ ulimit -l

A way to permanently remove the limit for locked memory for a regular user is to add the following lines to your /etc/security/limits.conf:

user1    hard   memlock           unlimited
user1    soft   memlock           unlimited

This removes the limit on locked memory for user user1. To remove it for all users, you can replace user1 with *:

*    hard   memlock           unlimited
*    soft   memlock           unlimited

Hupgepage Settings

Users need to configure system hugepage to reserve 2MB-hugepages or 1GB-hugepages. For example, the ‘hello_fpga’ sample requires several 2MB-hugepages. And the fpgadiag tool requires several 1GB-hugepages.

The command below reserves 20 2M-hugepages:

$ sudo sh -c 'echo 20 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages'

The command below reserves 4 1GB-hugepages:

$ sudo sh -c 'echo 4 > /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages'

For x86_64 architecture processors, user can use following command to find out avaiable hugepage sizes:

$ grep pse /proc/cpuinfo | uniq
flags : ... pse ...

If this commands returns a non-empty string, 2MB pages are supported.

$ grep pse /proc/cpuinfo | uniq
flags : ... pdpe1gb ...

If this commands returns a non-empty string, 1GB pages are supported.