Development OpenCL on Sodia Board

Board: MacnicaSodiaEvaluationBoard
State: planned

This is draft page

Prerequisite

This page present how to develop OpenCL using Sodia Board BSP and prebuilt SD card image.
You need following preparation for development OpenCL on Sodia Board:
  • Sodia Board
  • Linux or Windows Host PC
    Need to install following software in host PC.
    • Quartus Prime v15.1
    • SoC EDS v15.1
    • Altera SDK for OpenCL v15.1
      License is needed to compile FPGA using Altera SDK for OpenCL. Please contact to distributor.
  • External USB SD Card Reader or SD Card slot.
  • SD Card or SDHC Card over 4GB. Actual image size is 2GB, but normally SD Card has bad sector, so there is possibility to cause boot issue.
  • [ Optional ] Local Ethernet Network with DHCP server to apply IP address for target board.

Sodia Board Settings

This section described board settings for OpenCL exection. Please set according to below.

sodia photo top.png

  • MSEL (J7)
    OpenCL SD Card image will configure FPGA from HPS. So MSEL is needed to set as FPP mode. Sodia Board has MSEL jumper(J7-J11) on the left upper side. Please set as follows:

msel_table.PNG   MSEL.png

  • BSEL & CSEL
    Select BSEL as SD Card boot(101b). CSEL setting is not related to OpenCL execution. Set as 00b .

bsel_table.PNG

csel_table.PNG
  BSEL.png

  • USB-UART Connector (CN11)
    Use as console. Please connect to host PC via USB cable.

  • SD Card Slot (CN13)
    Please insert SD Card.

  • HPS Ethernet Connector (CN10)
    This will use for data exchange between host PC and Linux on target board.
  

Download Contents

Item Download Ver. Note
All In One SD Card Image sodia_opencl_sdimage_v1511_r3.tar.gz v15.1

For Linux PC :
$ sudo dd if=xxx.img of=/dev/sdx bs=1M or
$ sudo dd if=xxx.img of=/dev/mmcblkx bs=1M

For Windows PC:
You can use free software such as Win32DiskImager tool

Please see following link:
http://rocketboards.org/foswiki/view/Documentation/GSRD151SdCard
http://rocketboards.org/foswiki/view/Documentation/GSRD151BootLinuxSd

All In One SD Card Image sodia_opencl_sdimage_v161_r3.zip v16.1 Same as above
Board BSP sodia.zip v15.1 OpenCL BSP v15.1 for Sodia Board
Board BSP sodia.zip v16.1 OpenCL BSP v16.1 for Sodia Board
Prebuild OpenCL Application hello_world.elf v15.1

OpenCL Application for ARM Linux (Build by SoC EDS v15.1)

This image is created from following example:
Hello World Design Example

Prebuild OpenCL Application hello_world.elf v16.1

OpenCL Application for ARM Linux (Build by SoC EDS v16.1)

This image is created from following example:
Hello World Design Example

Prebuild OpenCL Kernel Image hello_world.aocx v15.1

Kernel Image compiled by Altera SDK for OpenCL v15.1

This image is created from following example:
Hello World Design Example
Prebuild OpenCL Kernel Image hello_world.aocx v16.1

Kernel Image compiled by Altera SDK for OpenCL v16.1

This image is created from following example:
Hello World Design Example

How to execute OpenCL

Prepare SD Card

Please refer to " Creating and Updating SD Card" page how to prepare SD Card. All In One Image is provided from above Download Contents. We recommend to use Embedeed_Command_Shell(within SoC EDS) to extract archive file as follows.
$ tar zxf sodia_opencl_sdimage_v1511_r3.tar.gz

 

Boot Linux

Please refer to " Creating and Updating SD Card" page how to connect terminal software.

Type "root" when displayed login prompt. login prompt will be out of alignment by network info, but you can type "root".

login.png

OpenCL execution with prebuild OpenCL application & kernel image

This section describe how to execute OpenCL using prebuild OpenCL app & kernel image.

After login,please type "ls" to check files for setup a OpenCL that stored in current directory.
$ ls

ls.png

Setup a OpenCL environment by execute following command. This script will set environment variable and install device driver for OpeCL.
$ source ./init_opencl.sh

Type following command to diagnose OpenCL device.
$ aocl diagnose

aocl diag.png

Transfer prebuild OpenCL app & kernel image to Linux on target board. In this section, SCP command is using to transfer data via ethernet for this purpose as one of an example,but you can use another way to transfer data. This command is executing from Embedded_Command_Shell on host PC. At this time, IP address of target board and host PC should be set in same segment. IP address of target board and host PC is needed in same segment. (Please set IP address for your environment)

$ scp hello_world.aocx root@XX.XX.XX.XX:/home/root/hello_world.aocx
$ scp hello_world.elf root@XX.XX.XX.XX:/home/root/hello_world.elf

Note: Please type "yes", if you will see any errors such as host can not registered. Data transfer is normally completed.

After data transfer, you can see following files from Linux console.

after scp.png

Program OpenCL kernel (This command is not must, but better.)

$ aocl program /dev/acl0 hello_world.aocx

Execute OpenCL application。 (Need to store "hello_world.aocx" in same directory)

$ ./hello_world.elf

exec prebuild image.png

You can see OpenCL is executed on Sodia board using prebuild images.

Compile OpenCL kernel using Sodia Board BSP

Install BSP for Sodia board

Please download sodia.zip from Download Contents section and extract it under the install directory of Altera SDK for OpenCL as follows:

C:\altera\15.1\hld\board\

Setup Host PC

Launch "Embedded_Command_Shell".

emb cmd shell.png

Setup environment variable to compile OpenCL kernel image. You need to set following environment variable for compilation.

$ export ALTERAOCLSDKROOT="C:\altera\15.1\hld"
$ export PATH=${ALTERAOCLSDKROOT}/bin:$PATH
$ export AOCL_BOARD_PACKAGE_ROOT=${ALTERAOCLSDKROOT}/board/sodia

Then type following command to confirm environment variable is set properly. You can see BSP for Sodia board.

$ aoc --list-boards

aoc board list.png

Download Sample Design

Some examples are provided from ALTERA Web Site. In this section, use VectorAdd example for your reference. Please download "v15.0 Arm32 (Linux and Windows) package (.tgz)" from following link.

VectorAdd Sample.PNG

Extract it in any directory.

Modify "Makefile" under vector_add directory to avoid a conflict of destination name. Modify "TARGET" of Line 57 to "vector_add.elf".

makefile.PNG

Move to "vector_add" directory, and then type following command to compile OpenCL kernel. This command will do FPGA compilation, so you need to wait roughly 20-40 min (It depend on your PC spec). Also, license is needed for this command. Please contact to distributor for license.

$ aoc -v device/vector_add.cl -o bin/vector_add.aocx --board sodia_sharedonly

build kernel.png

After compalation is finished, "vector_add.aocx" is generated under "bin" directory.

ls after kernel compile.png

Build OpenCL application for ARM

Build application for ARM Linux that is working on target board. Type following command in "vector_add" directory to create application.

$ make all

make app.png

After build is successful, "vector_add.elf" is created under "bin" directory.

Execute Own OpenCL app & kernel

Transfer those images that is generated by above section to Linux working on target board.

$ scp bin/vector_add.aocx root@XX.XX.XX.XX:/home/root/vector_add.aocx
$ scp bin/vector_add.elf root@XX.XX.XX.XX:/home/root/vector_add.elf

Note: Please type "yes", if you will see any errors such as host can not registered. Data transfer is normally completed.

Proogram OpenCL kernel & Execute OpenCL app using following command. (Need to store "vector_add.aocx" in same directory)

$ ./vector_add.elf"

exec vector add.png

You can execute own OpenCL app & kernel.

© 1999-2024 RocketBoards.org by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Privacy Policy - Terms Of Use

This website is using cookies. More info. That's Fine