Get Started with the Intel® oneAPI Base Toolkit and Intel oneAPI HPC Toolkit for macOS*

Build and Run a Sample Project Using Visual Studio Code

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 the Sample Browser extension and create a project with Visual Studio Code, see Exploring oneAPI Samples with the Sample Browser in Visual Studio Code.

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

You can use VS Code extensions to set your environment, create launch configurations, and browse and download samples:

  1. From Visual Studio Code, click on the Extensions logo in the left navigation.

  2. Locate the extension titled Sample Browser for Intel oneAPI Toolkits, or visit https://marketplace.visualstudio.com/publishers/intel-corporation to browse available extensions.
  3. Click Install.
  4. Next, locate the extension titled Environment Configurator for Intel oneAPI Toolkits.
  5. 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

  1. Press Ctrl+Shift+P (or View>Command Pallette...) to open the Command Pallette.
  2. Type Intel oneAPI to view options of the installed extensions.

  3. Set the oneAPI environment:
    1. Press Ctrl+Shift+P ( or View -> Command Palette… ) to open the Command Palette.
    2. Type Intel oneAPI to view options of the installed extensions.
    3. Click on Intel oneAPI: Initialize environment variables.
    4. If prompted, locate the setvars file in <install_dir>/opt/intel/oneapi/
    5. 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.
  4. Click on the oneAPI button on the left navigation to view samples.

  5. A list of available samples will open in the left navigation.

  6. Select a sample. Instructions for how to build and run that sample will appear in a preview window.
  7. To build and run a sample, click the + to the right of the sample name.
  8. Create a new folder for the sample. The sample will load in a new window:

  9. Click README.md to view instructions for the sample.

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.

See Explore Data Parallel C++ Through Samples to learn more.