Remote Visual Studio Code Development with Intel® oneAPI Toolkits on Linux*
Set oneAPI Environment Variables on the Remote Host
- Log in to your remote Linux target usingsshand install the oneAPI Base Toolkit onto that target system.To get started, you need to install only the oneAPI Base Toolkit on your remote Linux target; you can install additional oneAPI toolkits either now or at a later time.
- Configure your remote Linux target so that the oneAPI development environment script (setvars.sh) runs when VSCode initiates a remote connection.Visual Studio Code does not currently provide a mechanism to automatically run scripts on your remote Linux target when it "remotes into" your target system (for example, runningsetvars.shremotely). 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 remote Linux target development system will run thesetvars.shenvironment script when they connect remotely using Visual Studio Code:if [ -z "$SSH_TTY" ] && [ -n "$SSH_CLIENT" ]; then . /opt/intel/inteloneapi/setvars.sh &>/dev/null fiThe above assumes that you have installed your oneAPI toolkits on your remote Linux target in the default "root/sudo" installation location (/opt/intel/inteloneapi/). 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.The script shown abovewill notexecute thesetvars.shscript when yousshinto your remote Linux system or if you are using it directly with a terminal session. Remove the first and third lines if you want it to execute for such interactive terminal sessions. 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 - SSHextension by Microsoft. Click theExtensionsicon and search for "Remote-SSH" in the search bar.
- Clickinstall. After installation, you seeRemote – SSHin theInstalled Extensionslist.
Connect to Your Remote Linux Target
- Click theremote-sshicon located in the lower left corner of your VSCode window. Aremote-ssh commandspalette appears near the top of the VSCode window. SelectRemote-SSH: Connect to Hostin that command palette.The first connection to your remote Linux target may require a minute or longer to download and install the necessary VSCode backend tools to your remote system. Subsequent connections to the remote system are generally faster. VSCode will indicate the installation process in the lower-right corner of your VSCode window.
- Enter the username and an IP address or valid hostname for your remote Linux target, using the same format you would use for an SSH connection into that system, and then pressEnter. In the image below, the username isubuntu.
- A new VSCode window opens and is connected to the remote host. If you do not have an SSH key-pair set up for this connection, you will be prompted to enter a password for your remote Linux target.
- Once logged in, add theC/C++ extensionto your remote VSCode instance. This extension is required to debug a remote session using the VSCode debug interface.
Create a New oneAPI Project
Disconnect from a Remote Host
Kill Remote VSCode Server
- Open the VSCode command palette ().
- Enterremotein the command palette dialog box.
- SelectRemote-SSH: Kill VS Code Server on Host.