Remote Visual Studio Code Development with oneAPI on Windows Subsystem for Linux*
- A Linux distribution running on WSL with the Intel® oneAPI Base Toolkit (Base Kit) installed
Set oneAPI Environment Variables on the WSL Target Linux
- Open a WSL terminal and install the Base Kit on to that target Linux system using the appropriate Linux package manager.To get started, you need to install only the Base Kit on your WSL target; you can install additional oneAPI toolkits either now or at a later time.
- Configure your WSL Linux target so that the oneAPI development environment script (setvars.sh) runs when VS Code initiates a connection.Visual Studio Code does not currently provide a mechanism to automatically run scripts on your remote Linux target when it interacts with the WSL system (for example, runningsetvars.shautomatically). There are a variety of ways to get around this issue, only one of which is presented here. See the Bash Startup Files man page for more options.Add the following shell script lines to your remote Linux system's/etc/profilescript. This location (or in an/etc/profile.d/script) will ensure that all users of your WSL target development system will run thesetvars.shenvironment script when they connect using Visual Studio Code:. /opt/intel/oneapi/setvars.sh &>/dev/nullThe above assumes that you have installed your oneAPI toolkits on the WSL system in the default "root/sudo" installation location (/opt/intel/oneapi/). If you have installed the oneAPI tools in a different location on your remote Linux system, you will have to adjust the path tosetvars.sh.See Configure Your CPU or GPU System for more details regarding configuration of the oneAPI environment on a Linux system.
Configure Visual Studio Code on Your Local Host
- Install theRemote - WSLextension by Microsoft. Click theExtensionsicon and search for "remote wsl" in the search bar.
- Clickinstall. After installation, you seeRemote – WSLin theInstalled Extensionslist.
Connect to Your WSL Linux System
- Open a WSL terminal for your desired Linux distribution. From within the terminal, invoke VS Code from the command line to start a local instance connected to WSL.user@host:~$ code
- A new VS Code window opens and is connected to the WSL system.
- Once connected, add theC/C++ extensionto the VS Code instance. This extension is required to debug a remote session using the VS Code debug interface.