FPGA Management C API Examples¶
Overview¶
This directory contains example code demonstrating how to use the AWS FPGA Management C API for clearing and loading FPGA images.
Prerequisites¶
AWS F2 Instance
AWS FPGA SDK
GCC Compiler
Setup¶
Clone the repository
Source the SDK:
source ./sdk_setup.sh
Examples¶
The repository includes the following examples:
FPGA Clearing¶
clear_single_fpga.c
: Demonstrates clearing an image from a single FPGA slotclear_multiple_fpga.c
: Demonstrates clearing images from 8 FPGA slots
FPGA Loading¶
load_single_fpga.c
: Demonstrates loading an AFI to a single FPGA slotload_multiple_fpga.c
: Demonstrates loading an AFI to 8 FPGA slotsprefetch_multiple_afi.c
: Demonstrates loading multiple AFIs to a single FPGA slot
Building the Examples¶
The examples are built while sourcing the SDK. If subsequent edits are made, the examples can be rebuilt by navigating to the example source directory and running:
make
To build a specific example:
make clear_single_fpga
make clear_multiple_fpga
make load_single_fpga
make load_multiple_fpga
make prefetch_multiple_afi
Running the Examples¶
Ensure you have sourced the AWS FPGA SDK before running:
source ./sdk_setup.sh
Run an example:
sudo ./clear_single_fpga
sudo ./clear_multiple_fpga
sudo ./load_single_fpga
sudo ./load_multiple_fpga
sudo ./prefetch_multiple_afi
Important Notes¶
These examples must be run on an F2 instance
Ensure you have the correct AFI ID when loading images
Always check error messages for troubleshooting