DE10 Standard OpenCL 18.0
DE10 Standard OpenCL 18.0
com
July 3, 2018
CONTENTS
DE10-Standard is a robust hardware design platform built with Intel System-on-Chip (SoC) FPGA.
It is designed for Intel University Program. This document gives introduction on how to setup
OpenCL development environment, compile, and execute example projects for DE10-Standard.
Users can refer to Intel SDK for OpenCL Programming Guide for more details about OpenCL
coding instruction.
http://www.altera.com/literature/hb/opencl-sdk/aocl_programming_guide.pdf
The DE10-Standard OpenCL Board Support Package (BSP) contains required resources for users to
develop OpenCL project based on DE10-Standard Board. The BSP is available from the website:
http://de10-standard.terasic.com/cd
The following items are required to setup OpenCL for DE10-Standard board:
An OpenCL project consists of OpenCL Kernel and Host Program, as shown in Figure 1-2. The
Kernel is realized on the FPGA part of SoC FPGA. The Host Program is not the ARM part of the
SoC FPGA. It is cross-compiled by Intel SoC EDS installed on Windows or Linux. The Kernel is
developed in Quartus and OpenCL SDK is installed on Windows or Linux.
This section describes how to execute OpenCL demo on DE10-Standard from the Linux image file
included in DE10-Standard Board Support Package (BSP). Windows or Linux Host is required to
setup the demo.
The following software should be installed on the Windows host PC to complete the setup.
The following software should be installed on the Linux host PC to complete the setup.
NOTE: Minicom – a terminal which can be installed via command “yum install minicom” or
“apt-get install minicom”
1. Download DE10-Standard BSP from http://de10-standard.terasic.com/cd and extract the
linux image file de10_standard_opencl.img from de10_standard_opencl.zip.
2. Write the Linux image file de10_standard_opencl.img into the microSD card with Disk
Imager.
⚫ Insert the microSD card into a card reader and connect it to the host PC. If the
microSD card already contains an image, existing partitions will be mounted
automatically. Please unmounts all the partitions.
⚫ Type dmesg|tail command to check which device name is assigned to the microSD
card. It’s likely to be /dev/sdb (change /dev/sdb to the device name found in the
previous step).
⚫ Run “sudo dd if=de10_standard_opencl.img of=/dev/sdb bs=1M”
⚫ Run “sync”
3. Insert the microSD card into the microSD card slot (J11) of DE10-Standard.
4. The DIP switch (SW10) on DE10-Standard for MSEL[4:0] must be set to 01010.
5. Connect the host PC to the UART-to-USB port (J4) on DE10-Standard with an USB cable.
Users should install the UART-to-USB device Linux driver as described in the FTDI driver
http://www.altera.com/literature/hb/opencl-sdk/aocl_c5soc_getting_started.pdf
This section describes how to install the software required for developing OpenCL project on
DE10-Standard.
Intel Quartus Prime and OpenCL SDK are available from the website:
http:/fpgasoftware.intel.com/18.0/?edition=standard&platform=windows&download_manager=dlm
3
For Quartus Prime installation, please make sure the Cyclone V device package is selected.
Intel SoC EDS tool is required to cross-compile the Host Program for ARM processor. The software
is available from the website:
http://fpgasoftware.intel.com/soceds/18.0/?edition=standard&platform=windows&download_mana
ger=dlm3
Please make sure the DS-5 is installed during the installation of SoC EDS.
After Quartus Prime and OpenCL SDK are installed, please create a new folder “terasic” under the
folder “G:\software\intelFPGA\18.0\hld\board”, assuming Intel Quartus Prime is installed under the
folder “G:\software\intelFPGA\18.0”. Please download the DE10-Standard BSP file
DE10-Standard_OpenCL_BSP.zip from
http://de10-standard.terasic.com/cd
Please uncompress the zip file and copy the “de10_standard” folder to the “terasic” folder created
previously, as shown in Figure 2-1.
An Quartus license is required to compile OpenCL project. Users can purchase the license from
Intel. A file named “license.dat” will be given upon purchasing Quartus license. For license
installation, please place the file “license.dat” in the local disk drive “c:\” and create a Windows
environment variable LM_LICENSE_FILE with value “c:\license.dat”. The value of this
environment variable needs to match the actual location of “license.dat” file.
The procedures below show how to create the LM_LICENSE_FILE environment variable in
Windows 10:
1. Right click on Computer. Select Properties.
2. Select Advanced system settings.
Please add the following paths into the User environment variables:
◼ OpenCL Configuration
For the operating system to find the OpenCL utilities correctly, users need to create a new
environment variable named INTELFPGAOCLSDKROOT and add the following paths into the
PATH environment variable:
1. %INTELFPGAOCLSDKROOT%\bin
2. %INTELFPGAOCLSDKROOT%\host\windows64\bin
7. Select PATH item in the Variable list and click the Edit button.
8. In the Edit User Variable dialog shown in Figure 2-4, add the following two strings into
the Value edit box. The strings should be separated by the symbol “;”.
⚫ %INTELFPGAOCLSDKROOT%\bin
⚫ %INTELFPGAOCLSDKROOT%\host\windows64\bin
For Intel OpenCL SDK to find the kit location of DE10-Standard correctly, Users need to create an
environment variable AOCL_BOARD_PACKAGE_ROOT and set
“%INTELFPGAOCLSDKROOT%\board\terasic\de10_standard”
This section shows how to confirm the OpenCL environment is setup correctly. Please open
Command Prompt window by clicking Windows Start button and click All Programs. Click
Accessories and then click Command Prompt.
◼ Verify Utility
Type “aocl version” command in the command prompt window and see if the version displayed
matches the number shown in Figure 2-6. If the ‘aocl’ command cannot be found, please check if
the “%INTELFPGAOCLSDKROOT%\bin” path is added to the PATH environment variable
correctly.
DE10-Standard OpenCL 16 www.terasic.com
July 3, 2018
Figure 2-6 Aocl version of Intel FPGA SDK for OpenCL in the command prompt
Type “aoc -list-boards” command in the command prompt window and make sure
“de10_standard_sharedonly” is listed in the Board list, as shown in Figure 2-7. If “de10_standard
_sharedonly” is not listed, please check if the AOCL_BOARD_PACKAGE_ROOT environment
variable is assigned correctly.
The value of environment variables can be retrieved by typing ‘echo’ in the command prompt
window. For example, type “echo %AOCL_BOARD_PACKAGE_ROOT%” can retrieve the value
of environment variable AOCL_BOARD_PACKAGE_ROOT, as shown in Figure 2-8.
This section shows how to compile and execute OpenCL kernel and OpenCL Host Program
provided in the DE10-Standard BSP. Users can follow the same procedures to compile and execute
The utility aoc (Intel SDK for OpenCL Kernel Compiler) is used to compile OpenCL kernel. Type
“cd G:\intelFPGA\18.0\hld\board\terasic\de10_standard\test\boardtest” in the command prompt
window to change the current directory to the folder boardtest and then type:
to compile the OpenCL kernel. It will take approximately half an hour to complete the compilation.
When the compilation process is complete, an OpenCL image file boardtest.aocx is generated
under the bin folder. Figure 2-9 shows the OpenCL kernel is compiling. For more details about the
usage of aoc, please refer to the Intel SDK for OpenCL Programming Guide:
http://www.altera.com/literature/hb/opencl-sdk/aocl_programming_guide.pdf
The Host Program is compiled in Intel SoC EDS. Please launch embedded command shell by
executing the “Embedded_Command_Shell.bat”, as shown in Figure 2-10, under the folder
“G:\intelFPGA\18.0\embedded”, assuming Intel SoC EDS is installed under the directory
“G:\intelFPGA\18.0”
“cd /cygdrive/G/intelFPGA/18.0/hld/board/terasic/de10_standard/test/boardtest/”
to change the current directory to the folder where the boardtest project is located. Type “make” to
build the host project shown in Figure 2-11. If the compilation is successful, a binary file
boardtest_host will be generated under the boardtest folder.
Please boot DE10-Standard with the Linux image generated from Chapter 1.4 for DE10-Standard
OpenCL. Users need to copy both the kernel file boardtest.aocx and host file boardtest_host
generated from the previous section from the host PC to Linux running on DE10-Standard. Users
can copy the file by typing Linux “scp” command through Ethernet or USB storage.
After these two files are copied to Linux running on DE10-Standard, please go to the terminal and
type “source ./init_opencl.sh” to setup OpneCL environment. Type “chmod +x boardtest_host” to
add execution attribute to the host file. Type “./boardtest_host” to launch the host application, as
shown in Figure 2-12.
This chapter describes how to setup the environment for the development of OpenCL on Linux,
build OpenCL project including kernel and host application, followed by execution and verification
of OpenCL project.
For more details about OpenCL on Linux, please refer to the Getting Started Guild of Intel OpenCL
Cyclone V SoC:
http://www.altera.com/literature/hb/opencl-sdk/aocl_c5soc_getting_started.pdf
This section describes where to download and how to install the software required for OpenCL on
DE10-Standard.
Intel Quartus Prime and OpenCL SDK are available from the website of Intel PSG:
http://fpgasoftware.intel.com/opencl/18.0/?edition=standard&download_manager=dlm3
Follow the link and select Linux operation system with version 18.0, as shown in Figure 3-1.
Choose Direct Download as the download method since the download manager is for Windows only.
Click the arrow to download Intel FPGA Design Software, as shown in Figure 3-2., and make sure
the Cyclone V device is included. Users can download Intel SDK for OpenCL as standalone
installer or RPM package.
Figure 3-2 Download Intel OpenCL SDK Linux version with Cyclone V device support
Intel SoC EDS tool is required to cross-compile the host program for ARM processor. The software
is available from the website:
http://fpgasoftware.intel.com/soceds/18.0/?edition=standard&platform=linux&download_manager=
direct
Please make sure DS-5 is installed during the installation of SoC EDS.
After Quartus Prime and OpenCL SDK are installed, please create a new folder named as the terasic
to the Intel OpenCL SDK folder “/root/intelFPGA/18.0/hld/board/”, refer to your own path, and
uncompressing the OpenCL BSP to this folder. as shown in Figure 3-3.
A license for Quartus is required to compile OpenCL project. Users can purchase the license from
Intel. After users have obtained a license file named “license.dat”, it needs to be placed in the local
disk such as “/root/intelFPGA/18.0/hld/license.dat”. Users also need to create an environment
variable LM_LICENSE_FILE and set its value as “/root/intelFPGA/18.0/hld/license.dat”, which
corresponds to the actual location of the license file. If you use a floating license on a license server,
The next section will describe how to setup the license environment.
If users install the Intel FPGA development software and OpenCL SDK on a system that does not
contain any .cshrc or bash resource file (.bashrc) in the directory, the INTELFPGAOCLSDKROOT
and PATH environment variables must be set manually. Users also need to create an environment
variable AOCL_BOARD_PACKAGE_ROOT for Intel OpenCL SDK to find the kit location of
DE10-Standard correctly. The value of this environment variable needs to be set as:
“$INTELFPGAOCLSDKROOT/board/terasic/de10_standard”
Alternatively, users can edit the “/etc/profile”, and append the environment variables to it. It can be
done by typing “gedit /etc/profile” command in the terminal to open the profile file with the gedit
editor tool and append the following settings to the profile file. After the edit is complete, save the
file and type “source /etc/profile” command in the terminal to apply the settings.
export QUARTUS_ROOTDIR=/root/intelFPGA/18.0/quartus
export INTELFPGAOCLSDKROOT=/root/intelFPGA/18.0/hld
export
PATH=$PATH:$QUARTUS_ROOTDIR/bin:/root/intelFPGA/18.0/embedded/ds-5/bin:/root/intelFPGA/18.0/embedd
ed/ds-5/sw/gcc/bin:$INTELFPGAOCLSDKROOT/bin:$INTELFPGAOCLSDKROOT/arm32/bin
export LD_LIBRARY_PATH=$INTELFPGAOCLSDKROOT/arm32/lib
export AOCL_BOARD_PACKAGE_ROOT=$INTELFPGAOCLSDKROOT/board/terasic/de10_standard
export QUARTUS_64BIT=1
export LM_LICENSE_FILE=/root/intelFPGA/18.0/hld/license.dat
This section shows how to make sure the OpenCL environment is setup correctly. Please open the
terminal window in Linux.
◼ Verify Utility
Type “aoc -list-boards” command in the terminal and make sure “de10_standard_sharedonly” is
displayed in the Board list, as shown in Figure 3-5. If “de10_standard_sharedonly” is not listed,
please check if the AOCL_BOARD_PACKAGE_ROOT environment variable is assigned
correctly.
The values of environment variables can be retrieved by typing ‘echo’ command in the terminal.
For example, type “echo $AOCL_BOARD_PACKAGE_ROOT” can dump the value of
environment variable AOCL_BOARD_PACKAGE_ROOT, as shown in Figure 3-6.
This section shows how to compile and test OpenCL example project and OpenCL host program
provided in DE10-Standard BSP. Users can follow the same procedures to compile and test other
OpenCL projects for DE10-Standard.
The utility aoc (Intel SDK for OpenCL Kernel Compiler) is used to compile OpenCL kernel. Type
“cd /root/intelFPGA/18.1/hld/board/terasic/de10_standard/test/boardtest” in the terminal to change
the current directory to the boardtest project folder. Type
to compile the OpenCL kernel. The compilation process will take about one hour. When the
compilation process is complete, an OpenCL image file boardtest.aocx is generated under the bin
folder. Figure 3-7 shows the screenshot after the OpenCL kernel is compiled successfully. For more
information about the usage of aoc, please refer to the Intel SDK for OpenCL Programming
Guide:
http://www.altera.com/literature/hb/opencl-sdk/aocl_programming_guide.pdf
Intel SoC EDS is used to compile the host program. Please launch the embedded command shell by
executing the “Embedded_Command_Shell.sh”, as shown in Figure 3-8, under the folder
“/root/intelFPGA/18.0/embedded”, assuming Intel SoC EDS is installed under the directory
“/root/intelFPGA/18.0/”.
“cd /root/intelFPGA/18.0/hld/board/terasic/de10_standard/test/boardtest”
and the current directory will be changed to the folder where the boardtest project is located. Type
“make” to build the host project, as shown in Figure 3-9. If the host project is compiled successfully,
a host binary file boardtest_host will be generated under the boardtest folder.
Please boot DE10-Standard with the Linux image for DE10-Standard OpenCL described in Chapter
1.4. Users need to copy the generated kernel file boardtest.aocx and the host file boardtest_host
from the host PC to the Linux system running on DE10-Standard. This can be done by establishing
SSH connection via Ethernet with “scp” command or via usb-storage with “mount” command.
After these two files are copied to the Linux system running on DE10-Standard, please add
executable attribution with “chmod +x boardtest_host” command and type “source ./init_opencl.sh”
to setup OpneCL environment, then type “./boardtest_host” to launch the host application as shown
in Figure 3-10.
Copyright Statement