Build and Run a Sample Project Using Visual Studio Code
Extensions for Visual Studio Code Users
- From Visual Studio Code, click on the Extensions logo in the left navigation.
- Locate the extension titledSample Browser for Intel oneAPI Toolkits, or visit https://marketplace.visualstudio.com/publishers/intel-corporation to browse available extensions.
- Next, locate the extension titledEnvironment Configurator for Intel oneAPI Toolkits.
Create a Project Using Visual Studio Code
- Click on the oneAPI button on the left navigation to view samples.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 DevCloud using Visual Studio Code, see oneAPI Visual Studio Code Extensions.
- A list of available samples will open in the left navigation.
- To view the readme for the sample, click the next to the sample. If you choose to build and run the sample, the readme will also be downloaded with the sample.
- 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
- PressCtrl+Shift+P( orView -> Command Palette…) to open the Command Palette.
- TypeIntel oneAPI: Initialize environment variables. Click onIntel oneAPI: Initialize environment variables.
- From the left navigation, click README.md to view instructions for the sample.
Prepare Build Tasks from Make / CMake Files
- PressCtrl+Shift+PorView -> Command Palette…to open the Command Pallette.
- TypeIntel oneAPIand selectIntel oneAPI: Generate tasks.
- Select the build tasks (target) from your Make/CMake oneAPI project that you want to use.
- Run the task/target by selectingTerminal -> Run task....
- Select the task to run.
Build the Project
- PressCtrl+Shift+BorTerminal -> Run Build Task...to set the default build task.
- Select the task from the command prompt list to build your project.
- PressCtrl+Shift+BorTerminal -> Run Build Task...again to build your project.
Prepare Launch Configuration for Debugging
- PressCtrl+Shift+PorView -> Command Palette...to open the Command Palette.
- TypeIntel oneAPIand selectIntel 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 pressCtrl+Shift+D.
Debug, Analyze, Develop with More Extensions
- remote development
- connection to Intel DevCloud
- analysis configuration