In the last Alveo blog, we installed the Alveo U200 accelerator card and ensured the card could be correctly validated. In this blog, we are going to look at what remains to be done to run the first executable program on the Alveo card itself.
First, let us do a little recap. In the previous blog, we installed the XRT and the deployment target platform. Once installed, these were available under the /opt/Xilinx/XRT and /opt/Xilinx/DSA directories in the file system. We used some of the available commands to update and validate the Alveo card.
To get started creating our own application on the Alveo card, we need to also install the development target platform. This will also be in the /opt directory once installed and will provide the acceleration platform.
You can download the development target platform for your Alveo card from the Xilinx Alveo getting started pages.
Once this has been downloaded, we need to install the development target platform which can be done with the following command:
sudo apt install Xilinx-u200-xdma-201830.2-dev-2580015_18.04.deb
When the installation completes, you will be able to see the platform installed under the /opt directory.
We also need to install the Vitis software platform so we can develop applications for the Alveo card. If you do not already have Vitis, it can be downloaded here.
To set up Vitis and the acceleration platform, we need to install several additional packages:
sudo apt-get install ocl-icd-libopencl1
sudo apt-get opencl-headers
sudo apt-get ocl-icd-opencl-dev
sudo add-apt-repository ppa:xorg-edgers/ppa
sudo apt-get update
sudo apt-get install libgl1-mesa-glx
sudo apt-get install libgl1-mesa-dri
sudo apt-get install libgl1-mesa-dev
sudo add-apt-repository --remove ppa:xorg-edgers/ppa
With the packages installed for Vitis and the data center platform, we are ready to create our first Hello World application.
Ensure you have sourced the Xilinx Run Time and start Vitis. Select the workspace you wish to work in.
To get started, we need to create a new application project. When selecting this, you will be asked to define the platform you wish to use. Initially there will be no platforms available. Select Add Platform and point them to the /opt/Xilinx/platforms directory.
This will make the installed platforms available, one of which should be the U200 platform.
With the platform selected, we are able to create a new project and system project.
To create our simple Hello World application which will demonstrate we have everything set up as expected, we are going use the Vector Addition example.
Clicking Finish will result in the project being created. The project will be configured for a software emulation build by default.
To test out the card, however, we need to have a hardware build. Building the hardware is easy from the drop-down menu on the application project settings tab. Select Hardware from the active build configuration option.
This will accelerate the VAdd kernel into the programmable logic and implement all of the necessary communication networks.
Once this is completed, click on the build icon (hammer) located on the menu bar and the application will be built. It took about one hour to generate the necessary output files on my machine.
All we need to do now is open a terminal window in the build directory and execute the program. The program is called Hello World and the accelerated kernel is called binary_container_1.xlcbin.
As such, we can issue the following command:
./hello_world binary_container_1.xlbin
By running this on my system, I was able to see the application loading and the test results.
Now that we know the basic flow and that the card is working as intended, we can get started creating more interesting applications.
See My FPGA / SoC Projects: Adam Taylor on Hackster.io
Get the Code: ATaylorCEngFIET (Adam Taylor)
Comments