Over recent years, cloud processing has become cheaper and more available to the point where cloud desktops are now viable alternatives to our regular desktops. RAM and memory intensive programs can benefit from being run on Amazon Web Services (AWS) instead of on a regular desktop and Vitis is no exception to this rule with a minimum RAM requirement of 32GB for embedded and 100GB hard disk space. Running multiple jobs on a desktop can be impossible and can even freeze the computer, making running tasks in parallel impossible, decreasing an engineer’s efficiency.

AWS presents a great solution to this because of the scaling nature of the cloud. Want to have three simulations running at once? No problem. Just start three instances. This is incredibly useful for FPGA development where a complex simulation can take hours or even days. The cloud even lets us increase the amount of RAM, so that simulations can be run without fear of running out of memory.

This also makes it great for regressional testing, which can often involve multiple memory intensive runs. With AWS these tests can be performed in the background or overnight, so we can get on with development of our core IP without the fear of crashing a simulation.

The use of cloud for embedded systems seems counter-intuitive. Surely we need to be able to run Vitis on our desktop so that we can plug in our development boards and debug from there? It is true in this case we need Vitis on desktop, but for the most part how much time we spend debugging on our boards is dependent on the project. For most academic projects that focus on exploring a wide design space of different architectures for acceleration, little time needs to be spent testing on the board itself, whilst for industrial systems integration projects large amounts of time may be spent testing on the board. Even in those cases the project can benefit from a hybrid system, for instance regressional tests may run in the cloud, whilst simultaneously running system tests on the desktop.

In this tutorial, we cover the basics of starting up a CentOS AWS instance, creating a cloud desktop and then setting a full development environment for embedded Vitis with the following programs installed:

  • Petalinux
  • Vitis
  • XRT

Our particular Setup

  • Operating System: Windows 10

Prerequisites

Instructions

Starting an AWS Instance

  • We need to make sure to use an Amazon Machine Image (AMI) that runs a version of Linux that is officially supported by Linux. We will be using CentOS 7, but other version are supported. Please check Vitis Installation Requirements
  • We will also need to ensure that our Amazon instance has sufficient RAM for Vitis, which is 32GB
  • Login to AWS or create an account if you haven’t already done so
  • Go to the CentOS hompage in the AWS marketplace and click ‘Continue to Subscribe’
  • Read the terms and conditions and then click ‘Continue to Configuration’
  • Choose the latest Software Version and the region you wish to use and click ‘Continue to Launch’
  • On the launch page, use following configuration:
    • ‘Choose Action’: Launch from Website
    • ‘EC2 Instance Type’: t2.2 large. This contains 32GiB of RAM, minimum required for Vitis
    • ‘VPC Settings’: Keep as default
    • ‘Subnet Settings’: Keep as default
    • ‘Security Group Settings’ : click ‘Create New Based on Seller Settings.’ Provide a name and description for the security group. In the table beneath, change ‘Source’ to ‘My IP.’ Save the settings
    • ‘ Key Pair Settings’:
      • Hit ‘Create a key pair in EC2.’ This will open a window of your key pairs.
      • Click ‘Create key pair’ and provide a name. For ‘File Format’ use ‘ppk’ and then hit ‘Create key pair.’
      • This should download the key pair as a.ppk file, make sure to keep this safe and secure
      • Back to our ‘Key Pair Settings,’ hit the refresh symbol and select our generated key pair
    • Launch the instance
  • This will take us to the EC2 dashboard
  • Under ‘Instances’-> ‘Instances,’ ensure the instance is running and the status checks have passed
  • Under ‘Network and Security’->’Security Groups,’ go to the Security Group, we created and ensure that in ‘inbound rules,’ ‘source’ is set to your IP and that in ‘outbound rules,’ ‘destination’ is set to 0.0.0.0/0
  • We are now ready to connect to our AWS instance and setup our cloud desktop

Connecting to our AWS instance

  • Launch PuTTY
  • We are going to create a new session so that we can use this session everytime we want to connect to the AWS
  • Under the ‘Category’ tab, click ‘Session’->’Logging’
  • Under ‘Saved Sessions’ type ‘centos1’ and hit save. This will be our session
  • Under ‘Host Name’ we need to put in:
<user_name>@<public_dns_name>
  • For CentOS, the user_name is: ‘centos’
  • We can find our public DNS name by going back to the AWS console: ‘Instances’->’Instances’ and clicking the connect button on the instance. This should launch a window that mentions ‘Connect to your instance using its Public DNS:’ Copy this data and use it as the public DNS name in ‘Host Name’
  • In ‘Categories’ go to ‘Connections’->’SSH’->’Auth.’ Under ‘Private key file for authentication:’ click Browse and find the .ppk file that we downloaded earlier.
  • We also need to increase the amount of available storage space we have as Vitis and Vitis projects tend to be very large, in ‘Elastic Block Storage’-> ‘volumes’ find the storage volume that is associated with our AWS and right click it and hit ‘Modify Volume’
  • In the window that opens change Size to 500GiB (or more/less depending on your budget) and click ‘Modify.’ We will need to check that Linux has recognised the increased storage space later and if it hasn’t we will need to extend our partitions
  • Make sure to save the Session and then click ‘Open’
  • If this is the first time connecting to the instance, we will recieve a warning about trusting the Host. Click ‘Yes’
  • If all goes well then we should be able to login to our instance. If you have any troubles, more details for connecting can be found here

Setting up our virtual desktop

  • Now we have access to our AWS. We could just use Vitis purely through terminal, but this can make debugging difficult, so instead we will be setting up a cloud desktop
  • In our PuTTY terminal, we need to setup the environment to be able to run VNC. First we need to update our software:
 sudo yum -y update 
  • Then all the Gnome GUI packages
 sudo yum groupinstall -y "Server with GUI" 
  • We then need to modify the boot settings
 sudo systemctl set-default graphical.target       
 sudo systemctl default 
  • We also need to install VNC
 sudo yum install -y tigervnc-server
  • We also need to setup the password the we will use for our centos user
 sudo passwd centos
  • Change the password to something memorable
  • We also need set a password for our VNC server:
 vncpasswd
  • Change the password to something memoriable
  • Start the VNC server. Note that each time we wish to login we must use this command to start the vncserver again, unless we modify the boot sequence as explained here
 vncserver
  • We now need to connect our host computer to the server. The first we need to do is convert our key to .pem which can be used by ssh
  • To do this open the app ‘PuTTYgen’ which should have come with PuTTY. Under ‘Actions’, next to ‘Load an existing private key file’ click load and find the .ppk file we created
  • To convert this to a .pem file, in the toolbar go to ‘Conversions’->’Export SSH key.’ We should recieve a warning that we did not create a passphrase. Click Ok and save the new key
  • Open up a new terminal or powershell on your host computer and type:
 ssh -L 5901:localhost:5901 -i <your.pem> centos@<public IP/DNS name>
  • Supply the password that we just set for our centos user and we should be able to login to the server
  • Open the ‘VNC Viewer’ app, go to ‘File’->’New Connection’
  • In the ‘Properties’ window, in the ‘General’ tab, fill in ‘VNC Server’ with:
 localhost:1
  • In the ‘Options’ tab, change picture quality to ‘High’
  • Then click ‘Ok’
  • Supply the VNC server password when asked by authentication
  • If all has gone correctly, then we should be able to see CentOS start screen. We can then login using our centos user password (not the VNC server password)

Checking our storage space

  • The first thing we need to do is expand our storage space so we can actually fit all the programs we need to download
  • In our new CentOS GUI, open a terminal and write:
 sudo file -s /dev/xvd* 
  • This should list our available partitions and identify which we need to extend:
/dev/xvda:  x86 boot sector; partition 1: ID=0x83, active, starthead 32, startsector 2048, 1048573919 sectors, code offset 0x63
/dev/xvda1: SGI XFS filesystem data (blksz 4096, inosz 512, v2 dirs)
  • In the terminal write:
 lsblk 
  • In our case this returned:
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
 xvda    202:0    0  500G  0 disk 
  xvda1  202:1    0  500G  0 part /
  • We can see that the sizes of both paritions match what we changed it to. If these have not changed, we can increase them through the AWS official information guide

Setting up the Vitis environment

Using AWS to program hardware

As mentioned one sacrifice for using AWS, it is more difficult to program and debug on the embedded platform itself, but this does not make it impossible. We can use AWS to generate the SD card image which we can then use ‘scp’ to copy the files to the host machine and program the board.

Where to from here?

Now we have Vitis setup from an AWS platform, meaning we can begin programming our FPGA projects. We hope you found this helpful for getting setup and if you would like to know how to get started with programming FPGAs with Vitis check out our tutorial series on Computer Vision.

If you have enjoyed this tutorial but are in current need of talent to build advanced Computer Vision systems on FPGAs, consider joining our ClickCV Early Access programme. ClickCV Early Access provides bespoke service and support for developing advanced Computer Vision systems on FPGAs. We use our own proprietary Computer Vision Library, ClickCV, to provide our clients the cutting edge in low latency, high definition processing. Contact us today to find out how we could build your next-generation system.

About the Author: Andrew Swirski is the founder and managing director of Beetlebox, a Computer Vision Acceleration specialist. The company develops the Computer Vision Acceleration library called ClickCV, which is designed to fully utilise the hardware adaptability and performance of FPGA chips. Beetlebox is currently running an Early Access programme, where the company provides bespoke service and support to develop client’s Computer Vision systems on FPGAs. Before Beetlebox, Andrew Swirski previously worked at Intel (formerly Altera) in FPGA encoding and decoding. He completed a Masters’ in Electrical and Electronic Engineering from Imperial College London in 2017.

Leave a Comment

Studio 1.10,

Chester House,

1-3 Brixton Road,

London,

United Kingdom,

SW9 6DE

 

Beetlebox Limited is a

company registered in

England & Wales with

Company Number 11215854

and VAT no. GB328268288

 

2020 Beetlebox Limited