Intel® VTune™ Profiler

Cookbook

ID 766316
Date 12/20/2024
Public
Document Table of Contents

Using Intel® VTune™ Profiler Server with Visual Studio Code and Intel® DevCloud for oneAPI (NEW)

This recipe demonstrates how you use Intel® VTune™ Profiler as a web server when you develop and tune performance on a remote development machine. For a remote machine, the recipe uses a compute node at Intel® DevCloud for oneAPI.

Content expert: Jennifer DiMatteo

Ingredients

NOTE:
  • Starting with the 2020 release, Intel® VTune™ Amplifier has been renamed to Intel® VTune™ Profiler.

  • Most recipes in the Intel® VTune™ Profiler Performance Analysis Cookbook are flexible. You can apply them to different versions of Intel® VTune™ Profiler. In some cases, minor adjustments may be required.

  • Get the latest version of Intel® VTune™ Profiler:

Setup Overview

With v2021.1.1 and newer versions, you can run Intel® VTune™ Profiler as a server and access it remotely using a web browser. This setup is useful when you develop applications on a remote system.

  • You can run Intel® VTune™ Profiler on the system where you do development, so it has direct access to the binaries, debug info, and source files.
  • Intel® VTune™ Profiler also stores the collected traces and processed data on the same system so you do not have to transfer this heavy data to your client system for analysis.
  • You do not need to install anything on your client system. You only need a web browser to access the Intel® VTune™ Profiler GUI.

The following figure illustrates this setup:

Option 1: Use Intel® VTune™ Profiler Server for Remote Development with Visual Studio Code

  1. Log into Intel® DevCloud for oneAPI.

  2. Set up the VS Code connection. When you complete this procedure, you should get local VS Code connected to a compute node in the DevCloud.

  3. Run Intel® VTune™ Profiler server on the compute node from the VS Code terminal:

    vtune-backend --enable-server-profiling
  4. Open the URL displayed by Intel® VTune™ Profiler server in the VS Code terminal. This starts the Intel® VTune™ Profiler GUI in your web browser.

  5. Finish the setup.

Option 2. Use Intel® VTune™ Profiler Server on a Remote System via SSH Terminal

In this case, you must manually set up SSH tunneling. To simplify this procedure, run Intel® VTune™ Profiler on a specific port (55001 in this example). You can select a different port if 55001 is busy.

  1. Log into Intel® DevCloud for oneAPI.

  2. Follow the instructions for Windows or Linux / MacOS systems and set up an SSH connection into the DevCloud.

  3. Log into the DevCloud login node:

    ssh devcloud
  4. Reserve a DevCloud compute node:

    qsub -I
    NOTE:
    Do not close the terminal after this step, as the action will release your compute node.
  5. Open a new terminal.

  6. Log into the DevCloud node again, this time with SSH Port forwarding enabled:

    ssh -L 127.0.0.1:55001:127.0.0.1:55001 devcloud
  7. Establish an SSH connection from the login node to the compute node with one more SSH tunnel:

    ssh -L 127.0.0.1:55001:127.0.0.1:55001 s000-n000

    Replace s000-n000 with your compute node name.

  8. Start Intel® VTune™ Profiler server on the compute node:

    vtune-backend --web-port=55001 --enable-server-profiling
  9. Open the Intel® VTune™ Profiler GUI. Use your web browser to open the URL displayed by the Intel® VTune™ Profiler server.

  10. Finish the setup.

Finish Setup

To complete the setup:

  1. Accept the Intel® VTune™ Profiler server certificate.

    NOTE:

    When you open the Intel® VTune™ Profiler GUI, your web browser may prompt you about the Intel® VTune™ Profiler server self-signed certificate. You can proceed safely without installing the certificate because the SSH tunnel provides protection from Man-in-the-Middle (MitM) attacks. For more information on transport security, see Set Up Transport Security.

  2. Set the passphrase.

    When you run Intel® VTune™ Profiler server for the first time, the URL that it displays should contain a one-time-token. When you open this URL on a browser, Intel® VTune™ Profiler server prompts you to set a passphrase. Other users cannot access your Intel® VTune™ Profiler server without the passphrase. The hash of the passphrase is persisted on the server. Also, your browser stores a secure HTTP cookie so that you do not need to enter the passphrase each time you open the VTune GUI. Once you set the passphrase, the Intel® VTune™ Profiler welcome screen opens.

  3. Create a project.

  4. Configure an analysis. Your remote machine (running the Intel® VTune™ Profiler server) is selected as the target system by default since you ran the server with --enable-server-profiling option.

  5. Set the target application path and any command-line arguments. For more information, see Set Up Analysis Target.

  6. Run the analysis.

Usage Considerations

  • The setup described in Option 1 relies on the functionality of the VS Code Remote - SSH extension to watch port numbers used by processes that are started through the VS Code terminal. The Remote - SSH extension automatically forwards these ports through the SSH tunnel. This action is controlled by the remote.autoForwardPorts setting, which is enabled by default.

  • You can use the --enable-remote-profiling command-line option to enable the system that hosts VTune server as the performance profiling target. This option is disabled by default for security because running a VTune analysis involves launching a target application, which is an arbitrary command line. If multiple users have access to a single instance of VTune server, they would get access to execute arbitrary code on behalf of the user account that runs the Intel® VTune™ Profiler server. Enable --enable-remote-profiling only when VTune server is intended for a single user and you do not share the passphrase used to access the server.

  • Use the --web-port=PORT command-line option to run Intel® VTune™ Profiler server on a specific port. Otherwise, Intel® VTune™ Profiler may run on any arbitrary port available on the system. If the specific port is already in use, increase the number until a free port is available.

  • Intel® VTune™ Profiler server displays this warning in the output:

    warn: Server access is limited to localhost only. To enable remote access restart with
        --allow-remote-ui.
    Because this procedure uses SSH port forwarding, you do not need to enable --allow-remote-ui. Incoming connections to the Intel® VTune™ Profiler server come from the SSH server and they are localhost connections. If you enable --allow-remote-ui, Intel® VTune™ Profiler server builds a URL with the real network card IP address or FQDN name, which may not be accessible from your client machine.

  • By default, Intel® VTune™ Profiler server stores profiling results in your home directory. Use the --data-directory command-line argument to specify a different data directory. You can also use this argument to open pre-collected Intel® VTune™ Profiler results in Intel® VTune™ Profiler server. Intel® VTune™ Profiler can locate its results in any child folders.