DE10 PRO OpenCL Manual 19.1
DE10 PRO OpenCL Manual 19.1
DE10 PRO OpenCL Manual 19.1
com
August 6, 2019
CONTENTS
CHAPTER 4 APPENDIX...................................................................................................................................... 41
https://www.altera.com/en_US/pdfs/literature/hb/opencl-sdk/aocl_programming_guide.pdf
This OpenCL BSP and manual can support several devices(on DE10-Pro Stratix 10 FPGA Borad)
development. In the BSP, we use different board names to distinguish the board, the correspondence
of the <board name> and the FPGA Device is as follows:
The following items are required to set up OpenCL for DE10-Pro board:
Note:
1. Intel FPGA OpenCL only supports 64-bit OS and x86 architecture.
2. We strongly recommend setting the PCIe speed to Gen3x8 in your PC BIOS for good
performance.
An OpenCL project is composed of both OpenCL Kernel and Host Program as shown in Figure
1-1. OpenCL kernel is compiled with Intel FPGA OpenCL compiler provided by the Altera OpenCL
SDK. The Host Program is compiled by Visual Studio C/C++ in Windows or GCC on Linux.
This chapter describes how to set up OpenCL development environment on 64-bit Windows, and
how to compile and test the OpenCL examples for DE10-Pro. For more details about Intel FPGA
OpenCL started guide, please refer to:
https://www.altera.com/en_US/pdfs/literature/hb/opencl-sdk/aocl_getting_started.pdf
This section describes where to get the required software for OpenCL.
Intel Quartus Prime Pro Edition 19.1.0.240 and Intel FPGA SDK for OpenCL Pro Edition
19.1.0.240 can be download from the web site:
http://dl.altera.com/opencl/19.1/?edition=pro
For Quartus II installation, please make sure that the Stratix10 device is included.
Open the link and select the Windows SDK table as Figure 2-1 shows.
When using the Intel® Quartus® Prime Pro Edition software version 19.1 with the Intel® FPGA
Download Cable II (formerly referred to as USB Blaster II download cable) or an on-board
implementation of the Intel® FPGA Download Cable II IP solution (formerly referred to as
on-board USB Blaster II solution), a USB device enumeration error may occur when plugging in
the Intel® FPGA Download Cable II to the computer hosting the Intel® Quartus® Prime Pro
Edition software.
To workaround this problem, use the Intel® Quartus® Prime Pro Edition software version 19.1 and
download and install patch 0.03 from the links below.
For windows, You must install the patch after installing Intel® Quartus® Prime Pro Edition
software version 19.1 software:
Quartus® Prime Pro 19.1 Patch 0.03 For Windows(.exe)
If developers don’t have Visual Studio C/C++ 2015, they can use the trial version of Visual Studio
2015 Express. The software can be downloaded from the web site:
https://www.visualstudio.com/vs/older-downloads/
After Quartus II and OpenCL SDK are installed, download the DE10_Pro_OpenCL_BSP_19.
1.zip DE10-Pro windows BSP from the web site:
http://de10-pro.terasic.com/cd
For more details about DE10-Pro OpenCL BSP, please refer to the Table 1.
Table 1 Windows BSP File
File or Folder Description
board_env.xml eXtensible Markup Language (XML) file that describes the Reference
Platform to the Intel FPGA SDK for OpenCL.
hardware Contains the Intel Quartus Prime project templates for the DE10-Pro
board variant.
windows64 Contains the MMD library, kernel mode driver, and executable files of
the SDK utilities (that is, install, uninstall, flash, program, diagnose) for
your 64-bit operating system
tests Contains some OpenCL Design Examples. The following examples
demonstrate how to describe various applications in OpenCL along with
their respective host applications, which you can compile and execute on
a host with an FPGA board that supports the Intel FPGA SDK for
OpenCL.
Developers need to create and edit some environment variable that Intel FPGA OpenCL SDK
can find the kit location of DE10-Pro correctly
Now, here are the procedures to create the required environment variable on Windows 10:
1. Open the Start menu and right click on Computer. Select Properties.
2. Select Advanced system settings.
3. In the Advanced tab, select Environment Variables.
4. Select New.
5. In the popup dialog, edit New User Variable, type the name in the Variable name edit
box and type the value in the Variable value edit box.
First, make sure the environment variable QUARTUS_ROOTDIR vaules in both User variables f
or Adimistrator and System variables are ‘<Quartus Installation Drive>\intelFPGA_pro\19.1\quar
tus’, as shown in Figure 2-3.
Third, create an environment variable AOCL_BOARD_PACKAGE_ROOT, and set its value as:
“%INTELFPGAOCLSDKROOT%\board\de10_pro”
as shown in Figure 2-5.
Also, append
"%QUARTUS_ROOTDIR%\bin64 " and
"%QUARTUS_ROOTDIR%\qsys\bin" and
"%INTELFPGAOCLSDKROOT%\bin" and
"%INTELFPGAOCLSDKROOT%\windows64\bin" and
%INTELFPGAOCLSDKROOT%\host\windows64\bin" and
DE10-Pro OpenCL 11 www.terasic.com
August 6, 2019
"%AOCL_BOARD_PACKAGE_ROOT%\windows64\bin"
into the PATH environment variable as shown in Figure 2-7 and Figure 2-8, so the OpenCL SDK
can find the binary file provided by OpenCL BSP.
This section will show how to make sure the OpenCL environment is setup correctly. Firstly, please
open Command Prompt windows by click Windows Start button, clicking All Programs, clicking
Windows System, and Right-click Command Prompt to select Run as administrator.
◼ Target AOCL
In Command Prompt (Run as administrator) window, type “where aoc” command, and make
sure the path of the “aoc.exe” is listed as shown in Figure 2-9.
In Command Prompt (Run as administrator) window, type “aocl version” command, and make
sure the version 19.1.0 Bulid 240 Pro Edition of the OpenCL SDK is listed as shown in Figure
2-10.
In Command Prompt (Run as administrator) window, type “aoc -list-boards” command, and
make sure “de10_pro” is listed in Board list as shown in Figure 2-11.
For more information about the aoc and aocl, refer to the ‘aoc -h’ and ‘aocl help’ command.
◼ Board Setup
To use the DE10-Pro FPGA Development Kit with the Intel FPGA SDK for OpenCL, you must
follow the below procedures to set up DE10-Pro board on your PC as shown in Figure 2-12.
Before you can use the DE10-Pro FPGA Development Kit with OpenCL, you must initialize the
board with an OpenCL image. Without this image, the board host operating system does not
recognize the PCIe card and the Intel FPGA OpenCL compiler cannot find the device. There are
two ways for you to choose:
1. Program the image into FPGA
Program the FPGA with the top.sof file by running the bringup_fpga.bat file in bringup/<board
name> folder as shown in Figure 2-13.
Because the windows 10 enforces driver signatures by default and the OpenCL drivers for our
development kits are not "signed" for Windows 10.
So, for windows10, please refer to the Chapter 4.1 Appendix to disable driver signature enforcement
and reboot system.
Note, the USB cable can be removed later if OpenCL code had been programmed to the startup
configuration flash by ‘bringup_flash.bat’.
◼ Driver Installation
Your system must recognize the card so that the Intel FPGA SDK for OpenCL driver can be loaded.
The install utility is used install the kernel driver on the host computer. Users of the Intel FPGA
SDK for OpenCL only need to install the driver once, after that the driver should be automatically
loaded each time the machine reboots.
Open Command Prompt (Run as administrator) window, type ‘aocl install’ to install the driver
as shown in Figure 2-17. Note that users need to have administrator privileges to install the driver.
The diagnose utility reports device information and identifies issues. The diagnose utility first
verifies the installation of the kernel driver and returns the overall information of all the devices
installed in a host machine.
In Command Prompt (Run as administrator) window, type “aocl diagnose” to check if the
initialization completed successfully. If successful, the programming message displays
“DIAGNOSTIC_PASSED” as shown in Figure 2-21.
The program utility programs the board with the specified aocx file. Check whether the
hello_world OpenCL image configures the FPGA successfully. In Command Prompt (Run as
administrator) window, type “cd D:\intelFPGA_pro\19.1\hld\board\de10_pro\bringup\<board
name>”, then type “aocl program acl0 hello_world.aocx” to configure the FPGA with
hello_world.aocx OpenCL image. If the programming message displays “Program succeed” as
shown in Figure 2-22, it means the hello_world OpenCL image is programmed into the FPGA
successfully.
This section will show how to compile and run the OpenCL kernel and OpenCL Host Program for
the Vector add example project. Developers can use the same procedures to compile and test other
OpenCL examples (included in the kit) for DE10-Pro.
You can get more example OpenCL applications from the OpenCL Design Examples page or
%INTELFPGAOCLSDKROOT%\examples_aoc
The utility aoc (Altera SDK for OpenCL Kernel Compiler) is used to compile the OpenCL
kernel. In Command Prompt (Run as administrator) window, type “cd D:\intelFPGA_pro\
19.1\hld\board\de10_pro\tests\vector_add” to go to vector_add project folder.
then type “aoc device\vector_add.cl -o bin\vector_add.aocx -board=<board name> -v” to
compile the OpenCL kernel, this process may take several hours. When the compilation process is
finished, OpenCL image file vector_add.aocx is generated. Figure 2-23 is the screenshot when
OpenCL kernel is compiling with s10_gh2e2_4Gx2 board.
For required parameters to compile vector_add.cl, please refer to the README.html in the
vector_add folder. For detailed usage of aoc, please refer to the Intel FPGA SDK for OpenCL
Programming Guide:
https://www.altera.com/en_US/pdfs/literature/hb/opencl-sdk/aocl_programming_guide.pdf
Visual Studio C/C++ 2015 is used to compile the Host Program. Launch Visual Studio (Run as
administrator),and select menu item “FILE→Open Project/Solution…”. In the Open Project
dialog, go to the folder “D:\intelFPGA_pro\19.1\hld\board\de10_pro\tests\vector_add”, and select
vector_add.sln as shown Figure 2-24.
This chapter describe how to setup DE10-Pro OpenCL development environment on 64-bit Linux
(CentOS 7.2/Ubuntu 16.04 are recommended), how to compile and test the OpenCL examples for
DE10-Pro. For more details about Altera OpenCL, please refer to Intel FPGA SDK for OpenCL
Getting Started document:
https://www.altera.com/en_US/pdfs/literature/hb/opencl-sdk/aocl_getting_started.pdf
Note: Follow below steps to install the software on root path, and it will invoke the kernel header,
If you are reinstalling Linux system, it is recommended to set the root size to at least 100GB and
choose to install the Development Tools.
This section describes how to download and install the required software for OpenCL.Please make
sure that the root size of filesystem is at least 100GB
Intel Quartus Prime Pro Edition 19.1.0.240 and Intel FPGA SDK for OpenCL Pro Edition
19.1.0.240 can be download from the web site:
http://dl.altera.com/opencl/19.1/?edition=pro
For Quartus II installation, please make sure that the Stratix10 device is included.
Open the link and select the Linux SDK as Figure 3-1 shows.
Quartus II software uses the built-in USB-Blaster II drivers on Linux to access USB-Blaster II
download cable on DE10-Pro but after installing the Quartus II software with built-in drivers, user
need to change the port permission for USB-Blaster II via issuing
‘gedit /etc/udev/rules.d/51-usbblaster.rules’
# USB-Blaster
# USB-Blaster II
Note: You must have system administration (root) privileges to configure the USB-Blaster
download cable drivers.
When using the Intel® Quartus® Prime Pro Edition software version 19.1 with the Intel® FPGA
Download Cable II (formerly referred to as USB Blaster II download cable) or an on-board
implementation of the Intel® FPGA Download Cable II IP solution (formerly referred to as
on-board USB Blaster II solution), a USB device enumeration error may occur when plugging in
GNU development tools such as gcc (include g++) and make are required to build the driver and
application under Linux. User can issue ‘yum -y install gcc gcc-c++’ command to download and
install them and their dependencies via internet.
Note: To install the SDK on Linux, you must install it in a directory that you own (that is, a
directory that is not a system directory). You must also have sudo or root privileges.
After Quartus II and OpenCL SDK are installed, please download the
DE10_Pro_OpenCL_BSP_19.1.tar.gz DE10-Pro linux BSP from the web site:
http://de10-pro.terasic.com/cd
If you install the Intel FPGA development software and OpenCL SDK on a system that does not
contain any .cshrc or Bash Resource file (.bashrc) in your directory, you must set the
INTELFPGAOCLSDKROOT and PATH environment variables manually. And the developers
need to create an environment variable for the DE10-Pro board
AOCL_BOARD_PACKAGE_ROOT so that the Intel FPGA OpenCL SDK is able to find the kit
location of DE10-Pro correctly, and set its value as:
Alternatively, you can edit the “/etc/profile” profile file,and append the environment variables to it.
To do this type “gedit /etc/profile” command on Linux Terminal to open the profile file by the
gedit editor tool,and append the following setting to the profile file. Then, save the file and type
“source /etc/profile” command in Linux Terminal to make the settings make effect.
export QUARTUS_ROOTDIR=/root/intelFPGA_pro/19.1/quartus
export INTELFPGAOCLSDKROOT=/root/intelFPGA_pro/19.1/hld
export AOCL_BOARD_PACKAGE_ROOT=$INTELFPGAOCLSDKROOT/board/de10_pro
export PATH=$PATH:$QUARTUS_ROOTDIR/bin:$INTELFPGAOCLSDKROOT/linux64/bin:$INTELFPGAOC
LSDKROOT/bin:$INTELFPGAOCLSDKROOT/host/linux64/bin:/root/intelFPGA_pro/19.1/qsys/bin
export LD_LIBRARY_PATH=$AOCL_BOARD_PACKAGE_ROOT/linux64/lib:$INTELFPGAOCLSDKROOT
/host/linux64/lib:$AOCL_BOARD_PACKAGE_ROOT/tests/extlibs/lib
export QUARTUS_64BIT=1
export LM_LICENSE_FILE=/root/intelFPGA_pro/19.1/license.dat
This section will show how to make sure the OpenCL environment is setup correctly. Firstly, please
open the Linux system terminal window by right click the Mouse on system desktop, then clicking
on Open Terminal.
In the Linux terminal, type “aocl version” command, and make sure the version of the OpenCL
SDK is listed as shown in Figure 3-3.
◼ Target Board
In the Linux terminal, type “aoc -list-boards” command, and make sure “de10_pro” is listed in
Board list as shown in Figure 3-4.
◼ Board Setup
To use the DE10-Pro FPGA Development Kit with the Intel FPGA SDK for OpenCL, you must
follow the below procedures to set up DE10-Pro board on your PC as shown in Figure 3-5.
Before using the DE10-Pro FPGA Development Kit with OpenCL, you must initialize the board
with an OpenCL image. Without this image, the board host operating system does not recognize the
PCIe card and the Intel FPGA OpenCL compiler cannot find the device. There are two ways for you
to choose:
1. Program the image into FPGA
Program the FPGA with the top.sof file by running the ./bringup_board.sh fpga in bringup/
<board name> folder as shown in Figure 3-6.
Note, the USB cable can be removed later if OpenCL code had been programmed to the startup
configuration flash of DE10-Pro by ‘./bringup_board.sh flash’ command.
◼ Driver Installation
Your system must recognize the card so that the Intel FPGA SDK for OpenCL driver can be loaded.
The install utility is used install the kernel driver on the host computer. Users of the Intel FPGA
SDK for OpenCL only need to install the driver once, after that the driver should be automatically
loaded each time the machine reboots.
First, in the Linux terminal, type ‘lspci |grep Altera’ to make sure the system recognizes the PCIe
card as shown in Figure 3-10.
The diagnose utility reports device information and identifies issues. The diagnose utility first
verifies the installation of the kernel driver and returns the overall information of all the devices
installed in a host machine.
In the Linux terminal, type “aocl diagnose” to check if the initialization completed successfully. If
successful, the programming message displays “DIAGNOSTIC_PASSED” as shown in Figure
3-12.
The program utility programs the board with the specified aocx file. Check whether the
hello_world OpenCL image configures the FPGA successfully. In the Linux terminal, type “cd
/root/intelFPGA_pro/19.1/hld/board/de10_pro/bringup/<board name>”, then type “aocl program
acl0 hello_world.aocx” to configure the FPGA with hello_world.aocx OpenCL image. If the
programming message displays “Program succeed” as shown in Figure 3-13, it means the
hello_world OpenCL image is programmed into the FPGA correctly.
This section will show how to compile and run the OpenCL kernel and OpenCL Host Program for
the Vector add example project. Developers can use the same procedures to compile and test other
OpenCL examples (included in the kit) for DE10-Pro.
You can get more example OpenCL applications from the OpenCL Design Examples page or
/root/intelFPGA_pro/19.1/hld/examples_aoc
The utility aoc (Altera SDK for OpenCL Kernel Compiler) is used to compile OpenCL kernel. For
detailed usage of aoc, please refer to the Intel FPGA SDK for OpenCL Programming Guide:
http://www.altera.com/literature/hb/opencl-sdk/aocl_programming_guide.pdf
Copyright Statement