Posted on

Parallel NSight Debugging on Single GPU!!

I remember and if I’m not wrong, on Oct, 2009 (to be very precise 😉 ) NVIDIA launched its first development environment for massively parallel computing; found its place inside Microsoft Visual Studio, the world’s most popular development environment, known as the NEXUS.

By the way the product is now known as the Parallel Nsight. The current release is 2.0. NVIDIA® Parallel Nsight™ brings lots of feature set to the massively parallel programmers and developers giving access to more tools and workflows they expect from developing on the CPU, support to Microsoft Visual Studio 2008/2010, support for CUDA Toolkit version 3.2/4.0, attach to process support, PTX/SASS assembly debugging, other advanced debugging and analysis capabilities, graphics performance and stability enhancements. No matter the environment is fantastic and helpful in many ways.

In the Past, lots of developers and enthusiasts have shown there interests in this particular tool. On top of it this tool is Free-of-charge for the visual studio developers. Remember that I’m stressing on “Visual Studio”!! In fact the environment is only available on Windows(Windows Vista and Windows 7, both x86 and x64 platforms) and visual studio.

NVIDIA® Parallel Nsight™ software supports GeForce 9, 200 and 400 Series Graphics Processors, as well as, select Quadro and Tesla GPUs. For complete list of supported GPU’s, see here. That means you must have atleast one of them to use the NSight.

NSight supports one or more hardware configuration, namely:

  • Single GPU
  • Dual GPU
  • Two Systems with Single GPU in each
  • Dual GPU System
    SLI MultiOS

To know more about these configurations, kindly visit this link->Hardware Configurations.

I guess that’s enough introduction to the NSight tool. You must try this tool as soon as possible if you are interested in massively parallel programming or if you are already doing so, grab a copy of it from NSight Developer site.

Coming back to the actual motive of this article, “Debugging on Single GPU system”.

Past few months I have seen lot many people asking “How can I debug my CUDA program on a single GPU system? I can’t debug my program on a single GPU system, its worthless downloading NSight for single GPU owners”. To be honest NSight was actually targeted towards enterprise development and scientific R&D. Over the years the GPU’s have become powerful, affordable and realization of power of GPU was brought by NVIDIA CUDA. So GPGPU is no more an enterprise or scientific R&D field.

Many enthusiasts have shown there interests and have started integrating the CUDA into there applications. CUDA has also found its place among the student projects and most of them have been using Single GPU systems.

Back to the topic:

Debugging CUDA applications on single GPU machine have always been a priority amongst the enthusiasts. This type of Debugging is also known as the “Local Debugging”.

Local Debugging, because both host and target is the same machine. As per the NVIDIA® Parallel Nsight™ you cannot perform the C/C++ debugging unless that particular machine has at-least two GPU’s each must adhere to the supported list of GPU’s. See the available hardware configurations that NVIDIA suggests. So technically speaking you cannot perform a debugging on a Single GPU machine. This is due to fact that debugging may produce undesirable results that might hang or force restart the display driver, and if you have only single GPU then you might not be able to debug the application as you would desire.

But don’t worry this article will show you how to do that even if you have a single GPU system. There is a simple trick behind this procedure.

So before starting to explore this tip/trick, check your gear first (Going with the current versions):

Assuming that you are familiar with GPU programming with CUDA and some background of NSight. If you have used CUDA only and no idea about this environment, then the following video might help you think a little! Have a good look at the features what NSight has to give you.

  • Download and Install NVIDIA CUDA Toolkit 4.0 (You must be a registered developer at NVIDIA Developer Site)
  • Install Microsoft Visual Studio 2010
  • Download and Install NVIDIA Parallel NSight 2.0 (You must be a registered developer at NVIDIA Developer Site)
  • NVIDIA Drivers (270.61 WHQL as on writing this article)
  • Motherboard Drivers and Display drivers.

To achieve debugging on a single GPU system,

  • You must switch of your system. Oh yes and I am not joking.
  • Boot your system and enter into the BIOS setting. Go to the advance BIOS Settings or search for an option that says “Display Init First” or something like that. Default must be PCI or PEG (PCI Express Graphics). Change it to “On-board”. Switch of again.
  • Now physically connect you display to the  on-board display output feed. If you have multiple monitors then switch to one of them which is connected to the on-board display. If you have single display then you can also use external display switch.
  • Boot the PC and log on to Windows. Install the motherboard drivers and display drivers if you haven’t already.
  • Now you can run Visual Studio and NSight to debug your program.
  • That’s all you are done.

At this time your primary display is on-board. PCIe GPU acts as secondary GPU. When you launch NSight it checks for dual display in the windows registry. So simply speaking a Single NVIDIA GPU system can be used for debugging.

There is one more thing I would like to clear at this stage. NVIDIA suggests and advertise that NSight is only compatible with GeForce 9 Series and above. In reality NSight can be used with few GeForce 8-Series also. For this your card must at-least support Compute Capability(CC) 1.1. For example GeForce 8400GS, 8500GT also support NSight. Rather all cards that support CC 1.1 and above are supported by NSight.

Learn more about Nsight at Dr.Dobbs

About GPUToaster

7 responses to “Parallel NSight Debugging on Single GPU!!

  1. rashad ⋅

    what are the cons of doing this?
    in other words why won’t NVIDIA inform us about this?

    • You mean … the cons of debugging on single GPU. Then that has been mentioned in the article, as debugging may produce undesirable results and might hang you system’s GPU. So if you are on single GPU system where you can see your program and debugger HANGED!, you have to restart your system in order to restore back the optimal working environment.

      Its not NVIDIA has hidden or not have informed to its developers; its because the kind of operation is not recommended for users and this has been discussed many times in forums and webinars.

      And since I also mentioned, NSIGHT has found its popularity amongst many enthusiasts and considering that most systems are not multi-GPU or SLI based, this could help them enable CUDA debugging on their present systems without incurring extra cost for another GPU.

      But remember that if you are doing a really serious business with CUDA, then multi-GPU systems is a must.

      Give a try to this; both ways; Single GPU and the method I suggested.

      I myself run a single GPU system. I do programming on my laptop and run it via a LAN on target GPU.

      If you need more explanation on this, would be happy to help you.


  2. Hi,

    It’s posible use a non CUDA enable GPU (PCI or PCI-e) for debugging on a motherboard without SLI?


    • Hi Manuel,

      Technically, the answer is NO. CUDA is a technology that can be leveraged only on Nvidia GPU’s. If you have a ATI Radeon GPU then you can go for STREAM. Keep in mind that these technologies can only be run on respective vendor GPU’s. If you’re looking for cross platform solution, then go for OpenCL.

      Read more about CUDA and STREAM on respective vendor developer websites.


      • Sorry, I had not explain me correctly. I would mean to use a second non CUDA GPU only for debugging a CUDA code executed in a nVidia GPU (Single computer). I mean if the solution you give in this post works for a PCI or PCI-e GPU card.

        Sorry about my poor english.

      • Hi Again,

        I am assuming that you have two descrete GPU’s one nvidia and one non nvidia! The answer is YES you can. Connect your PC primary display to non nvidia one and make the nvidia one secondary. In layman’s term, the output of non nvidia will now render your display. (remember to load both the type of display drivers)

        Once you are done with it, launch your debugging session as described in the article.

        “I would mean to use a second non CUDA GPU only for debugging a CUDA code….. “, CUDA code can run only on nvidia GPU’s FYI only. 🙂



  3. Very good article. I am dealing with many of these issues as

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s