intel FPGA Development oneAPI Toolkits with Visual Studio Code on Linux User Guide
- June 9, 2024
- Intel
Table of Contents
- FPGA Development oneAPI Toolkits with Visual Studio Code on Linux
- Install the oneAPI Sample Browser Extension
- Build and Run the FPGA Emulation Image for Fast Compile
- Generate and View the FPGA Optimization Report
- Build and Run the FPGA Hardware Image
- References
- Read User Manual Online (PDF format)
- Download This Manual (PDF format)
FPGA Development for Intel® oneAPI
**Toolkits with Visual Studio Code on Linux*
User Guide**
FPGA Development oneAPI Toolkits with Visual Studio Code on Linux
FPGA Development for Intel® oneAPI Toolkits with Visual Studio Code on
Linux
You can integrate the Intel® oneAPI Base toolkit with Visual Studio (VS)
Code on Linux* to support a seamless software development environment. You can
use VS code for FPGA development in the same way you would use for CPU or GPU.
The process is same for setting the oneAPI environment variables, launching VS
Code, creating a project from a sample, and code editing.
NOTE
- If you are a Windows user, perform the instructions in [Developing a Visual Studio Code Project for SSH Development on Windows Subsystem for Linux](https://www.intel.com/content/www/us/en/develop/documentation/using-vs-code-with-intel-oneapi/top/ssh-development-top/ssh-wsl.html)* to set up your system and then, follow the instructions provided in this document.
- If you are working with the Get Started | Intel® DevCloud, refer to Using VSCode | Intel® DevCloud that also describes how to use VS Code sample browser extension in Intel® DevCloud including the FPGA workflow.
- To configure your system environment and settings for Intel oneAPI toolkits, install the Environment and Launch Configurator for Intel® oneAPI Toolkits extension for Visual Studio Code.
FPGA development flow involves the following steps:
- Setting up the environment variables.
- Building and running the emulation image using the fast compile method.
- Generating and viewing the static HTML optimization report.
- Building and running an actual FPGA hardware image.
For more information about this workflow, refer to the FPGA
Flow section in the
Intel ® oneAPI Programming Guide.
Prerequisites
Download and install the following software:
Set the Environment Variables and Launch the Visual Studio Code
Perform these steps to set the environment variables:
-
Open a terminal session.
-
Locate the setvars.sh script. The location depends of your oneAPI installation, and it will be one of the following:
• If you installed as root or sudo, then find the script in the root directory of your oneAPI installation, which is typically /opt/intel/oneapi.
• If you did not install as sudo or root, then find the script in the ~/intel/oneapi/ directory.
• If you customized the installation folder, then find the script in your custom installation folder. -
Run the setvars.sh script from the command line using the following command: source
/setvars.sh
For more information, refer to Set Environment Variables for CLI Development. -
In the same terminal session, launch VS Code by running the following command: code
NOTE
The benefit of sourcing the oneAPI setvars.sh script before launching VS Code is that all terminal sessions and child processes of VS Code includes the oneAPI development environment setup.
Install the oneAPI Sample Browser Extension
You can browse and download samples in Visual Studio Code using the Sample Browser extension. Perform these steps to install the extension:
- In the VS Code, click the Extensions logo in the left navigation.
- Locate the extension titled Sample Browser for Intel oneAPI Toolkits or visit https://marketplace.visualstudio.com/publishers/intel-corporation to browse available extensions.
- Click Install.
- After the extension installs, click the oneAPI icon to view a list of available samples in the left navigation pane.
For a quick demonstration, refer to Exploring oneAPI Samples with the Sample Browser in Visual Studio Code.
Build and Run the FPGA Emulation Image for Fast Compile
The FPGA emulation image is a fast-running compile that can help you achieve
functionally correct code. For detailed information, refer to Types of FPGA
Compilation in the Intel ® oneAPI Programming Guide. You can
compile a basic FPGA sample to the FPGA emulator target by performing the
following:
NOTE
Not all oneAPI sample projects use CMake. The README.md file for each sample
specifies how to build the sample. For samples that use CMake, Intel®
recommends you refer to the CMake Tools
Extension for Visual Studio Code article that is
maintained by Microsoft*.
-
Under the FPGA > Tutorials section, hover over the Compile Flow sample and click + to create a project. You are promoted to select a folder to save the project.
-
Save the project. A new VS Code session is now open with the Compile Flow sample.
-
Open a terminal in VS Code.
-
Run the cd command to move to the top-level directory of the newly created project.
-
Run the following command to create a directory named build: mkdir build
-
Run the cd command to move to the newly created build directory.
-
Run the following command to build the sample. The project build files are written into the build directory. cmake ..
-
Run the following command to select the emulation build target: make fpga_emu
NOTE Refer to the FPGA code sample README file to find the right make target.
You should now observe an executable named compile_flow.fpga_emu in your directory. Use this file as the emulator executable for the design. -
Execute the following command to run the emulator executable: ./compile_flow.fpga_emu
FPGA Development for Intel® oneAPI Toolkits with Visual Studio Code on Linux*
Generate and View the FPGA Optimization Report
The FPGA optimization report can provide high-level details about your
application performance even before you run an actual FPGA hardware image.
NOTE
The report is generated by the Intel® oneAPI DPC++/C++ Compiler in the form of
HTML pages that you can view in a web browser. For more information about
using the FPGA optimization report for achieving best performance, refer to
the Review the
report.html section in the FPGA Optimization
Guide for Intel® oneAPI Toolkits.
- Ensure that you are in the build directory in the VS Code terminal session.
- Run the following command to generate the report: make report
- Move to the compile_flow_report.prj/reports directory and locate the optimization report you generated. cd compile_flow_report.prj/reports
- Use the following command to launch the report in the Mozilla Firefox* browser: firefox report.html
Build and Run the FPGA Hardware Image
In this step, you build an executable intended to run on an actual FPGA hardware. It may take several hours to complete. Refer to Intel ® oneAPI DPC++/C++ Compiler System Requirements for the recommended build system configuration. Other caveats include the following:
- To build the FPGA hardware image, execute the make fpga command, which is the non-default make target. Refer to the FPGA code sample README file for detailed steps.
- To build an executable, you must install the Intel® Quartus® Prime Pro Edition software and BSPs separately. For more information, refer to the Intel ® FPGA development flow for oneAPI webpage and Installation Guide for Intel oneAPI Toolkits for steps to install the software.
- To run the executable, you need an FPGA hardware on your system. For more information about how to set up the system, refer to Install Software for Intel® FPGA Development Flow.
References
- Exploring oneAPI Samples with the Sample Browser in Visual Studio Code
- Explore SYCL* Through Intel® FPGA Code Samples
- Installation Guide for Intel® oneAPI Toolkits
- Get Started with Intel® Distribution for GDB on Linux OS Host
- Get Started with the Intel® oneAPI Base Toolkit for Linux*
- Intel® oneAPI Programming Guide
- FPGA Optimization Guide for Intel® oneAPI Toolkits
Notices and Disclaimers
Intel technologies may require enabled hardware, software or service
activation.
FPGA Development for Intel® oneAPI Toolkits with Visual Studio Code on Linux
No product or component can be absolutely secure.
Your costs and results may vary.
© Intel Corporation. Intel, the Intel logo, and other Intel marks are
trademarks of Intel Corporation or its subsidiaries. Other names and brands
may be claimed as the property of others.
Product and Performance Information
Performance varies by use, configuration and other factors. Learn more at
www.Intel.com/PerformanceIndex.
Notice revision #20201201
Unless stated otherwise, the code examples in this document are provided to
you under an MIT license, the terms of which are as follows:
Copyright 2022 Intel® Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
References
- Publisher Intel - Visual Studio Marketplace
- Today I Learned for programmers - Tiloid
- Running Visual Studio Code on Linux
- CMake Tools Extension for Visual Studio Code - C++ Team Blog
- Using VSCode | Intel® DevCloud
- Get Started | Intel® DevCloud
- Environment Configurator for Intel® oneAPI Toolkits - Visual Studio Marketplace
- Publisher Intel - Visual Studio Marketplace
- oneAPI-samples/DirectProgramming/C++SYCL_FPGA at master · oneapi-src/oneAPI-samples · GitHub
- Intel® oneAPI DPC++/C++ Compiler System Requirements
- Configure Your CPU or GPU System
- FPGA Optimization Guide for Intel® oneAPI Toolkits
- Review the author=\"vmalkaix\" time=\"20221028T134452-0500\"FPGA...
- Get Started with Intel® Distribution for GDB on Linux OS Host
- Install Software for Intel FPGA Development Flows
- FPGA Flow
- Types of SYCL* FPGA Compilation
- Developing a Visual Studio Code Project for SSH Development
- Installation Guide for Intel® oneAPI Toolkits
- Intel® oneAPI Base Toolkit: Essential oneAPI Tools & Libraries
- Overview - 1 | Performance Index
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>