Intel® oneAPI Base Toolkit and
Intel® oneAPI HPC Toolkit
Note
An internet connection is required to download the samples for oneAPI toolkits. For information on how to use this toolkit offline, see
Developing with Offline Systems in the Troubleshooting section.
To watch a video presentation of how to install extensions and use them to set up your environment, explore sample code, and connect to the Intel® Developer Cloud using Visual Studio Code, see
oneAPI Visual Studio Code Extensions.
This procedure requires the Sample Browser extension to be installed. The next section will describe how to install it. If you have already installed it, skip to
Create a Project Using Visual Studio Code.
Extensions for Visual Studio Code Users
To watch a video presentation of how to install extensions and use them to set up your environment, explore sample code, and connect to the Intel® Developer Cloud using Visual Studio Code, see
oneAPI Visual Studio Code Extensions.
You can use VS Code extensions to set your environment, create launch configurations, and browse and download samples:
From Visual Studio Code, click on 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.
- Next, locate the extension titled
Environment Configurator for Intel oneAPI Toolkits.
- Click
Install.
For more information about VS Code extensions for Intel oneAPI Toolkits, see
Using Visual Studio Code* to Develop Intel® oneAPI Applications.
Create a Project Using Visual Studio Code
- Set the oneAPI environment:
- Press Ctrl+Shift+P ( or
View -> Command Palette…
) to open the Command Palette.
- Type
Intel oneAPI to view options of the installed extensions.
- Click on
Intel oneAPI: Initialize environment variables.
- If prompted, locate the setvars file in
<install_dir>/opt/intel/oneapi/
- In the case of multiple folders in workspace, select the appropriate one. All tasks, launches, and terminals created from VS Code will now contain the oneAPI environment.
- Click on the oneAPI button on the left navigation to view samples.

- A list of available samples will open in the left navigation.
- Select a sample. Instructions for how to build and run that sample will appear in a preview window.
- Find the sample you want to build and run. Click the
to the right of the sample name.

- Create a new folder for the sample. The sample will load in a new window:

Set the oneAPI Environment
- Press
Ctrl+Shift+P ( or
View -> Command Palette…
) to open the Command Palette.
- Type
Intel oneAPI: Initialize environment variables. Click on
Intel oneAPI: Initialize environment variables.

- From the left navigation, click README.md to view instructions for the sample.
Prepare Build Tasks from Make / CMake Files
- Press
Ctrl+Shift+P or
View -> Command Palette…
to open the Command Pallette.
- Type
Intel oneAPI and select
Intel oneAPI: Generate tasks.

Select the build tasks (target) from your Make/CMake oneAPI project that you want to use.

Run the task/target by selecting
Terminal -> Run task...
.
Select the task to run.
Note
Not all oneAPI sample projects use CMake. The
README.md file for each sample specifies how to build the sample. We recommend that you check out the
CMake extension for VS Code that is maintained by Microsoft.
Build the Project
The oneAPI extensions enable the ability to prepare launch configurations for running and debugging projects created using Intel oneAPI toolkits:
- Press
Ctrl+Shift+B or
Terminal -> Run Build Task...
to set the default build task.
- Select the task from the command prompt list to build your project.
- Press
Ctrl+Shift+B or
Terminal -> Run Build Task...
again to build your project.
Prepare Launch Configuration for Debugging
The oneAPI extensions enable the ability to prepare launch configurations for running and debugging projects created using Intel oneAPI toolkits:
- Press
Ctrl+Shift+P or
View -> Command Palette... to open the Command Palette.
- Type
Intel oneAPI and select
Intel oneAPI: Generate launch configurations .

- Select the executable (target) you want to debug.
Optional: select any task you want to run before and/or after launching the debugger (for example, build the project before debug, clean the project after debug).
- The configuration is now available to debug and run using the gdb-oneapi debugger. You can find it in
.vscode/launch.json. To debug and run, click on the Run icon or press
Ctrl+Shift+D.
Note
Some oneAPI sample projects use Make and some use CMake. The
README.md file for each sample specifies how to build the sample. For those samples that use CMake, we recommend that you install the
CMake extension for VS Code that is maintained by Microsoft*. Your macOS* system does not come with CMake installed; you will have to install it manually if you wish to use CMake with the Intel oneAPI toolkits.
For more information on oneAPI extensions and remote development with VS Code, see
Using Visual Studio Code with Intel® oneAPI Toolkits.