Skip to content

IFPGA on MeluXina

The MeluXina system environment provides the IFPGA compiler.

EasyBuild module description

The IFPGA® FPGA Add-on for the Intel oneAPI Base Toolkit is a specialized component for programming such reconfigurable FPGA devices.

You can use IFPGA to compile your C/C++ programs.

IFPGA usage

Interactive

Reserve an interactive session:

salloc -A COMPUTE_ACCOUNT -t 01:00:00 -q dev --res fpgadev -p fpga -N 1

The example above will allocate one FPGA node in interactive mode (dev QoS with fpgadev reservation). Load the IFPGA (Will load default version if not specified) module as in below script.

module load ifpga 
i++ hello.c -o ./HelloTest_C

Batch

IFPGA can also be used in a batch job using Slurm. The script below compile a simple C HelloWorld test on one FPGA node allocated for 5 minutes.

#!/bin/bash -l
#SBATCH -N 1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH -p fpga
#SBATCH -q test
#SBATCH --time 00:05:00

#Load IFPGA module
module load ifpga

#Check IFPGA version
i++ --version

#Compile C program with IFPGA
i++ hello.c -o ./hello_cpp

#Execute the program
hello_cpp

It is recommended to use a Makefile to compile your program. Your Makefile should look like the example below:

#Defines compiler
CC=i++

# These are the options we pass to the compiler.
# -std=c++14 means we want to use the C++14 standard.
# -stdlib=libc++ specifies that we want to use the standard library implementation called libc++
# -g specifies that we want to include "debugging symbols" which allows us to use a debugging program.
# -O0 specifies to do no optimizations on our code.
CFLAGS = -std=c++14 -stdlib=libc++ -g -O0

all: hello

hello: hello.o
        $CC $CFLAGS -o hello_cpp hello.o

hello.o: hello.cpp
          $CC $CFLAGS -c hello.cpp

It is also possible to compile via a Makefile inside a batch job:

#!/bin/bash -l
#SBATCH -N 1
#SBATCH --ntasks=1
#SBATCH --fpgas-per-task=128
#SBATCH -p fpga
#SBATCH -q test
#SBATCH --time 00:05:00

#Load IFPGA module
module load ifpga 

#Check IFPGA version
i++ --version

#Compile C++ program with IFPGA (in parallel)
make -j

#Execute the program
hello_cpp