Nsight graphics как пользоваться с visual studio
Перейти к содержимому

Nsight graphics как пользоваться с visual studio

  • автор:

Debugging with Nsight

As of the latest version of NVIDIA’s Nsight (4.0 I believe), it is able to attach to chrome’s GPU process and let us debug/profile low level D3D and OpenGL commands. It’s also very useful for viewing the results of each draw call without having to write additional application code to display intermediate buffers.

Here is what’s needed to get it working:

Nsight 4.0, Visual Studio and an NVIDIA GPU are required. There is an Eclipse version of Nsight but it has not been tested.

Open any project in Visual Studio (just needs to be something to "run"), right click the startup project and select Nsight User Properties.

Set the radio box to "Launch external program", check "Application is launcher" (this is the new feature as of 4.0) and set the command line arguments to at least —no-sandbox —disable-gpu-watchdog and —gpu-startup-dialog. —disable-gpu-program-cache is optional; if you use it, you’re able to step through the shader source lines, otherwise only the disassembly is available.

image

From the NSIGHT menu in Visual Studio, select "Start Graphics Debugging". Wait until the gpu startup dialog shows up and connect to it.

image

Navigate to any page you wish to debug. The Nsight HUD doesn’t seem to be interactive with chrome though.

When you want to debug a frame, go to the NSIGHT menu in Visual Studio and select "Pause and Capture Frame".

Nsight will open a few overlays on top of chrome that let you step through the frame (check the taskbar, sometimes they appear behind chrome).

image

It will also open some new windows in Visual Studio for viewing the current D3D/GL state and allocated GPU resources, stepping through the shaders for debugging (recently caught a HLSL shader optimization bug this way), profiling the CPU/GPU speed of each call and finding out what kind of bottlenecks we’re hitting (input assembly, pixel/vertex shader, texture fetch, blend, etc).

Name already in use

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Nsight Visual Studio Code Edition

Nsight Visual Studio Code edition is an extension for Visual Studio Code that provides support for CUDA development, including features such as Intellisense, debugging, debugger views, and productivity enhancements.

Higher Productivity
Using smart CUDA auto-code completion features improves the overall development experience and enables users to save time and effort when writing code.

Interactivity
Debugging with Nsight Visual Studio Code Edition provides diverse benefits, including code formatting, easy navigation through source code, displaying and interacting with different source files, building executables, and testing.

Remote Development Support
Nsight Visual Studio Code Edition enables developers to implement CUDA code in various cluster environments such as Virtual Machines or remote Docker containers. It also supports code development for Linux systems via the Remote – WSL extension.

Free
As with other Nsight tools from NVIDIA, Nsight Visual Studio Code Edition is offered free of charge. We love it when your code works better and is delivered sooner. Enjoy!

CUDA Syntax Highlighting for Code Development and Debugging
Edit code productively with syntax highlighting and IntelliSense for CUDA code. Auto-completion, go to definition, find references, rename symbols, and more all seamlessly work for kernel functions the same as they do for C++ functions.

CUDA Kernel Breakpoint Support and Kernel Execution Control
Break into a debugging session in CPU or GPU device code using standard breakpoints, including support for conditional breakpoints with expression evaluation. GUI controls allow you to step over, into, or out of statements in the source code, just like normal CPU debugging. Breakpoints are evaluated for every kernel thread and will halt execution when any thread encounters them.

GPU and Kernel State Inspection
Break into the debugger to see all the detailed information at any point in the application with GPU debugging support for register, variable, and call-stack. There is watchlist support to add specific variables of interest for tracking. Additionally, there are focus controls to manually select block and thread coordinates to switch the debugger focus.

Want to know more?

See the Nsight VSCode Edition spotlight video
This Nsight VSCode Edition spotlight shows you how Nsight VSCode Edition fits in with the other NVIDIA IDE debuggers and can be set up in Microsoft’s Visual Studio Code. Then, you’ll see all the key features in action. You’re going to love it!

View the Microsoft announcement for the VSCode extension by Nsight VSCE
CUDA Support in Visual Studio Code with Julia Reid

Visit the Nsight VSCode Edition overview page
The Nsight VSCode Edition overview page is your information hub for general information, availability, videos, and other links to other NVIDIA tools for GPU code development.

CUDA Toolkit: Install the CUDA Toolkit to get important tools for CUDA application development including the NVCC compiler driver and cuda-gdb, the NVIDIA tool for debugging CUDA.

Microsoft vscode-cpptools: Install Microsoft’s C/C++ for Visual Studio Code to get Intellisense support for CUDA C++ code. Nsight VS Code Edition will automatically install this extension.

Open or create a new CUDA application.
Configure the debugging connection
by creating a launch configuration to launch and debug your application, or
an attach configuration if the target application is already running

Start debugging!

Reach out to us for feedback and questions via our developer forum.

Data and telemetry

This extension collects usage data and sends it to NVIDIA to help improve our products. This extension respects the «telemetry.enableTelemetry» setting, for more info see Visual Studio Code Telemetry.

About

A Visual Studio Code extension for building and debugging CUDA applications.

RenderDoc#

Custom visualization shader to display stencil values#

Nvidia Insight#

Installation#

For the full on debug experience (shader GPU debugging), you’ll need a target & host machine because the debugger’s going to halt your GPU which means no OS updates.

High-level installation steps:

Install the latest nVidia drivers on the target machine

Install nVidia Insight on your target & host machine

Ensure the requisite firewall exceptions have been set on both machines

NSight Monitor needs to have an exception on the host & target

Visual Studio needs to have an exception on the host

Download and detailed configuration instructions: http://developer.nvidia.com/nvidia-nsight-visual-studio-edition (You’ll need to register for a free dev account).

Debug the Unity Project#

Open up the Unity solution in visual studio and configure the remote debugging options for nvidia nsight.

Unity can’t use msbuild to generate the solution so you have to build your project inside of Unity (so do a standalone Development build with script debugging to a Debug/ folder)

Make sure you set this as the working directory for Nvidia’s Nsight profiler and make sure to add this directory to the list of directories to synchronize

Select the Launch External Program option and set the path to your Unity project

Problem: For some reason, when the file gets sync’ed over, the app bitches when it gets launched on the target machine, saying it can’t find the [project]_Data folder. Still investigating this, but for now, workaround is to just manually copy over the project directory to the target machine. (Default: C:\Users\[current-user-on-target]\AppData\Roaming\NVIDIA Corporation\Nsight\Monitor\Mirror\[hostname]\[host-outdir] so for example

Debugging_wNsight_NVidiaInsight

All the Paths you specify are relative to the target machine’s synchronization directory (the default is specified above). However, if you select «Don’t synchronize», all of the paths will be relative to the machine

Profiling Tips#

HUD can be activated in real-time by pressing CTRL-Z

Will show you in real-time performance counters & graphs overlayed on your Unity Window

Problem: In full screen mode, the Unity Oculus app won’t release the hardware cursor to allow you to click around the Nvidia Nsight graphs. Just alt-tab in and out of the app and that should fix your problem.

CTRL+D will give you a depth complexity test. Test to see if you’re getting a lot of overdraw => do better culling, render front to back, z-only pass

CTRL+M will give you minimum geometry

Frame Capture: Allows you to capture an entire frame’s rendering

Can scrub through the timeline to see the drawcalls build on

Hold CTRL+SHIFT key to get an even more zoomed in view around mouse cursor

Hold SHIFT to zoom around a render target.

Right click to re-center everything

Shader Debugger: Can set breakpoints in your shader, step-in/over functions, add variables to watch. Full on visual studio editing for your shaders

Can also dynamically modify your shaders and A/B test your shaders

Graphics Focus picker allows you to visually see the pixel/vertices that have changed. Can also pick the pixel you want to break on

Can also pick a pixel to show the entire pixel history to see the different values of the pixel

Breakpoint conditionals evaluated on GPU so it’s at full speed

Launch Project with NSight HUD#

Commandline: C:\\Program Files (x86)\\NVIDIA Corporation\\Nsight Visual Studio Edition 5.3\\Monitor\\Common\\Nvda.Launcher.exe» «%1»

Ex: C:\\Program Files (x86)\\NVIDIA Corporation\\Nsight Visual Studio Edition 5.3\\Monitor\\Common\\Nvda.Launcher.exe» «C:\\UE4Editor.exe» BBR.uproject -log

Nsight + Visual Studio#

Debug an Exe Not Part of VS Solution#

Sometimes, you may want to debug an executable that is not part of a Visual Studio project. It may be an executable you created outside of Visual Studio or an executable you received from someone else.

The usual answer to this problem is to start the executable outside of Visual Studio and attach to it using the Visual Studio debugger. For more information, see Attach to Running Processes with the Visual Studio Debugger

Attaching to an application requires some manual steps, so it takes a few seconds. This slight delay means that attaching will not help if you are trying to debug a problem that occurs during startup. Also, if you are debugging a program that does not wait for user input and finishes quickly, you may not have time to attach to it. If you have Visual C++ installed, you can create an EXE project for such a program.

To create an EXE project for an existing executable

On the File menu, click Open and select Project.

In the Open Project dialog box, click the drop-down list next to the File name box, and select All Project Files.

Locate the executable, and click OK.

This creates a temporary solution that contains the executable.

Debugging External Applications#

NVIDIA® Nsight™ Development Platform, Visual Studio Edition 4.2 User Guide

Early versions of NVIDIA Nsight were only able to debug projects built in Visual C++. However, with NVIDIA Nsight 4.2, CUDA and graphics debugging are now supported for both C++ and C# projects.

If you would like to use NVIDIA Nsight to debug an application that is built in an environment other than C++ or C#, use the tutorial outlined below.

Using NVIDIA Nsight Debugging with Other Project Types

In Visual Studio, create a «dummy» project by going to File > New > Project.

On the node for Visual C++ templates, select Empty Project.

Enter the name for your project and click OK.

LaunchingNsight_2DebuggingExternal

  1. Select the project’s Nsight User Properties to edit the default settings. (As an alternative, you can also go to the Project menu > Nsight User Properties.)

LaunchingNsight_SolutionExplorer

  1. Select Launch external program, and enter the path to the external program for the application that is to be debugged.

LaunchingNsight_4Launch

  1. Configure any other launch options or file synchronization settings which may be necessary for your particular debugging environment.

Click OK to save your settings.

You can now begin debugging your application with NVIDIA Nsight.

To do so, go to the Nsight menu or right-click on your project, then select the appropriate activity (Start CUDA Debugging, Start Graphics Debugging, etc.).

Debugging Graphics using NVIDIA Parallel Nsight and Visual Studio

sir, I have downloaded the eclipse-SDK-4.2.2-linux-64 bit for CUDA programming and now i am looking for Nsight eclipse plugin to do the same. Can you help me in locating the same as Nsight visual studio plugin is available everywhere but not Nsight eclipse plugin..Any help is appreciated.

Well Nsight eclipse IDE is available as a part of CUDA 5 but i am using CUDA 4.2 so is there any way we can use Nsight eclipse in CUDA 4.2.

Bunny D, There would be no problem if you install Latest CUDA 5.0, what you have to change is just path variable(if you want to use command line or Terminal in case of Linux) other than, like Windows if you have already installed with Visual studio , same in Linux with Eclipse, after that if you install CUDA 5.0 or any other version (no need to uninstall previous CUDA 4.2, it will prompt you to choose version while creating new project) it will detect and make all the require changes and setting(s) in you Visual studio or eclipse in case of Linux.

Apart from this, I'll try to look at web for Nsight eclipse plugin, seperatly, if available .. then i'll let you know with link.
Best of Luck

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *