Intel® Acceleration Stack User Guide: Intel FPGA Programmable Acceleration Card N3000

ID 683040
Date 6/14/2021
Public
Document Table of Contents

6. Sample Test: Native Loopback

This section describes how to run a memory copy test using the Intel provided FPGA factory image and hello_fpga.c host program. The FPGA factory image includes logic to support this test and an internal register with the expected AFU UUID. The hello_fpga.c only works with an FPGA image with this AFU UUID. The acceleration logic (NLB) in the FPGA is programmed to copy CSR_NUM_LINES (cache lines) from source to destination buffer on the host system. For more information refer to the Native Loopback Accelerator Functional Unit (AFU) User Guide for Intel FPGA Programmable Acceleration Card N3000.

Make sure the hugepage is allocated:
  • For CentOS:
    $ sudo sh -c "echo 200 > /sys/kernel/mm/hugepages/hugepages-2048kB/\
    nr_hugepages"
    
  • For Red Hat:
    # echo 200 > /proc/sys/vm/nr_hugepages
Note: Commands must be run as root.
Extract the package: N3000_supplemental_files.zip which is provided as part of the Acceleration Stack installer.
$	unzip N3000_supplemental_files.zip
$	cd N3000_supplemental_files
$	gcc -o hello_fpga -std=gnu99 -rdynamic -ljson-c -luuid -lpthread \
-lopae-c -lm -Wl,-rpath -lopae-c hello_fpga.c
$	sudo ./hello_fpga
Sample output:
Using OPAE C library version '1.3.6' build '99fa5de'
Running Test
Running on bus 0x15.
dfh = 100000008000001f
id[0] = c000c9660d824272
id[1] = 9aeffe5f84570612
dfh = 2000000080000000
id[0] = a9149a35bace01ea
id[1] = ef82def7f6ec40fc
dfh = 2000000080000000
id[0] = a9149a35bace01ea
id[1] = ef82def7f6ec40fc
dfh = 2000000080000000
id[0] = a9149a35bace01ea
id[1] = ef82def7f6ec40fc
dfh = 2000000080000000
id[0] = a9149a35bace01ea
id[1] = ef82def7f6ec40fc
dfh = 1000010080001070
id[0] = f89e433683f9040b
id[1] = d8424dc4a4a3c413
Found NLB0 at offset 0x28000
Done Running Test
Note: On a multi card system, pass PCIe bus argument -B 0x<xx>