Technical Article

  • 0.10
  • 10/21/2020
  • Public Content

Local Usage of Visual Studio Code with Intel® oneAPI Toolkits on Linux*

This document explains how to use Visual Studio Code to locally develop with Intel® oneAPI Toolkits. For instructions on how to develop remotely, see Remote Visual Studio Code Development with Intel® oneAPI Toolkits on Linux*.

Set oneAPI Environment Variables and Launch VSCode

  1. Open a terminal session and source the
    script from the command line. (For detailed instructions, see Configure Your System.) You can find the
    script in the root folder of your oneAPI installation, which is typically
    when installed as root or sudo.
    If you did not install as sudo or root,
    will be in
    . If you customized the installation folder,
    will be in that custom location.
  2. Launch VSCode in the same terminal session
    in which you sourced
    by typing
    at that terminal prompt. This insures that VSCode inherits the oneAPI environment variables that were created by the

Installing the Visual Studio Code Extension for Browsing Samples

  1. From Visual Studio Code, install the oneAPI CLI Samples Browser by clicking on the Extensions logo in the left navigation.
  2. Locate the extension titled
    Sample Browser for Intel oneAPI Toolkits
    , or visit to browse available extensions.
  3. Click
  4. After the extension installs, you may need to restart VS Code.

Explore oneAPI Samples with VSCode

  1. After the oneAPI Samples Browser extension is installed, you can view samples by clicking on the oneAPI button on the left navigation.
  2. A list of available samples will open in the left navigation.
  3. Select a sample. Instructions for how to build and run that sample will appear in a preview window.
  4. To view the readme for the sample, right click on the sample and select
    Open Readme
  5. To build and run a sample, click the
    to the right of the sample name. If some dependencies are missing, you may see an alert like the one below:
  6. Create a new folder for the sample. The sample will load in a new window:
  7. Click to view instructions for the sample.
Not all oneAPI sample projects use CMake. The
file for each sample specifies how to build the sample. We recommend that you check out the CMake extension for VSCode that is maintained by Microsoft.

Try Debugging (CPU Only)

Debugging GPU applications is not supported in VSCode.
This section assumes that you can build your sample and have installed the Microsoft VSCode C/C++ Extension. The C/C++ extension is required to configure the oneAPI C/C++ debugger.
The Intel
oneAPI Base Toolkit
includes a special version of GNU* GDB (
) designed to support oneAPI C/C++ applications. To debug your DPC++ application using this special debugger, you will need to make changes to the
configuration file.
  1. Go to
    Open Configurations
    , and open the
    configuration settings.
    If you are prompted to select a debug environment, choose
    C++ (GDB/LLDB)
    Screenshot showing command pallet prompting for debugger
  2. Copy the code shown below into your
    file, and replace the
    property's value with the path to your project's executable (that is, the application that you are going to debug).
    If VSCode doesn't recognize the application name, you may have to insert the full path and filename into the
  3. Add
    to your
    application should have been added to your path when you ran
    to configure the oneAPI development environment, prior to starting VSCode. If you prefer, you can specify the full path and filename to the
    application in your
    { "version": "0.2.0", "configurations": [ { "name": "(gdb-oneapi) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/build/array-transform", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "gdb", "miDebuggerPath": "gdb-oneapi", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ] } ] }
  4. Bring up the debug view by selecting the
    icon in the
    Activity Bar
    . You can also use the keyboard shortcut (
    Screenshot showing VSCode recommended extension installation popup
  5. Start the run and debug session by clicking the green
    run and debug
    icon, or go to
    Start Debugging
    Screenshot showing VSCode recommended extension installation popup

Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804