Cuda debugging using Single GPU with visual studio - debugging

I am working on Windows 7, Visual studio 2010.
Can we debug cuda code using single GPU which also providing display to the monitor in the same PC?
What tools are available ? NSIGHT seems to be working with two GPUs.

Windows 7 support has been dropped in newer versions of Nsight, (see here) basically anything that was released in 2020 or newer. So you're stuck with older versions. Older versions will also have a support chart like the one I previously linked which explains the supported debug scenarios. Generally speaking, single GPU debug as you describe should be possible with a "newer" GPU like Kepler or newer.
The last Nsight version that supported Win 7 is 2019.4 and the associated documentation indicates support for single GPU debugging.
Note that in the 2019.x timeframe, the Nsight tools had both a "legacy" and "next gen" debugger, and the one you should use will depend on which GPU you are using (and possibly driver model WDDM/TCC), see here.
Also note that the last CUDA toolkit that had official support for VS 2010 was in the CUDA 9.x generation.

Related

Windows-SDK vs. Visual-Studio compatibility

Is there any compatibility matrix as to what Visual Studio Versions (Say, ranging 2005 - 2017) are compatible with which Windows SDK Versions?
Should any Windows SDK be fully compatible with "any" C++ compiler, or are the different Windows SDK versions bound to certain compiler versions?
For example(!), we have a legacy C++ application that is still compiled with VS2005. We found that we'd like to use GetDpiForMonitor from this application. But to use this function, would require to use the headers+libs from at least an SDK supporting Windows 8.1 (e.g. the 8.1 SDK headers at C:\Program Files (x86)\Windows Kits\8.1\Include\um)
Generally, should a developer expect to be able to switch to a newer Windows SDK version without upgrading his compiler / Visual Studio?
Please refrain from suggesting to upgrade VS: This question tries to establish what you should do when upgrading VS is not an option for now, but you want to use stuff from (and depend on) functionality only available in newer Windows (SDK) versions.
concerning the "compatibility matrix": I don't think anybody made the effort to up to create one, also I'm not sure if this is really needed.
Rule of thumb: those API headers don't change quite often, and when they do, they are usually pretty much backward compatible.
The tricky part may be to teach your older VS to get along with a new SDK, you may need to change the VC+ include/source/lib directories for your solution/project manually.
(if it complies & links in your old VS, you should be fine)

MSVC2012 - does it have 10 toolset?

I need to compile some CUDA code with MSVC2010 but I might consider buying MSVC2012 instead of MSVC2010 if I can switch toolset to 10 from MSVC2012 options.
Is that possible or MSVC2012 just ships with the 11 toolset?
As noted in the comments, you can only get the v100 toolset in VS2012 if VS2010 was already installed on the machine. So high odds that you'll need to choose VS2010 if the Cuda tool-chain you use doesn't support VS2012 yet.
A quick google turned up this blog post, showing you how to setup VS2012 to run the NVidia Cuda 5.0 tool-chain. It isn't clear from your question whether this applies. Do take a look at this, VS2012 is an excellent VS2010 service pack ;)

Qt development in windows. Do I need pay for Microsoft tools?

Considering to develop a desktop application with Qt for Windows. It will be a free download application, but for a commecial SERVICE. (need an account with our commercial service to work).
I think we could use the Qt for Windows from Nokia (LGLP version) because its free app. But the lastest one version of Qt needs a C++ complier from Microsoft.
Which one?
Do I need to pay for an C++ compiler from Microsoft, or do they have a free version to use with Qt?
Reading info docs, googling and we still cann't understand what tools do I need.
If you want to use the Visual Studio compilers, you can download the free Windows SDK. The following link takes you to the SDK for Visual Studio 2008:
Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1
This includes all the C++ compilers and tools you need. (There is a more recent version available, but Visual Studio 2010 is not yet a "level 1 supported" platform for Qt.) We are using this on standalone build machines and it works fine.
Just a personal opinion, but we have found that using anything other than MSVC on Windows (for example, MinGW) causes a lot of problems. It is not that the other toolchains are bad, it is just that they are all treated as second-class citizens. We had lots of problems with third-party libraries not being able to build in MinGW or having nonexistent build instructions and having to do a lot of manual Makefile editing, etc. You are much more likely to have things "just work" if using MSVC.
For the most part (static linking), you cannot mix and match. You need to pick one toolchain and stick with it. If I were starting from scratch, I'd definitely go with MSVC.
Just our experience (we started with MinGW); your mileage may vary.
No, you do not need to pay for anything.
The Microsoft toolchain is available for free as part of the Microsoft Windows Software Development Kit.
Additionally, the following article may also be of interest to you:
Developing Windows Applications in C++: The tools you need
The alternative supported by Qt is MinGW. The runtime libraries are free from copyright, so you can do whatever you want with them.
It is basically the Windows counterpart of the GNU Compiler Collection (GCC) under Unix.

CUDA installation on Windows

I installed CUDA Toolkit 3.2, CUDA SDK and MS Visual Studio 2008 (not necessarily in this order) on my Windows 7 that does not have an nvidia graphics card.
But when I try running my CUDA code, the CUDA keywords are'nt identified.
I am a beginner. Pls tell me what I am doing wrong here.
Thanks
Are you building using nvcc? If not, Visual C++ will choke on the CUDA-specific syntax.
You should be able to build the SDK samples with your setup, but you won't be able to run since you do not have a CUDA capable GPU. Emulation is no longer supported, so you have a couple of options available:
gpuocelot
PGI CUDA x86
Check out this stackoverflow post for details of syntax highlighting and more in VS2008.
Incidentally, if you installed the Toolkit before VS2008 then the rules files will not have been copied to the VS directories (clearly, since they didn't exist). You can find them and instructions in the CUDA Toolkit in the extras directory.
You if are trying to execute cuda programs on non gpu machines, I would suggest you to try mCUDA. It doesn't need GPU or Graphics card for CUDA execution.
The installation of CUDA development tools on a system running the appropriate version
 Verify the system has a CUDA‐enabled GPU and a supported version of OS.
Many [NVIDIA products today contain CUDA‐enabled GPUs][1]. These include:
 NVIDIA GeForce® 8, 9, 200, and 400 series GPUs
 NVIDIA Tesla™ computing solutions
 Many of the NVIDIA Quadro® products
 Verify the NVIDIA driver and the CUDA software.
 Update the NVIDIA driver.
 Install the CUDA software.
 Verify the the CUDA software linking With VS2008/VS2010
For that you can check my Blog Also http://hemprasad.wordpress.com/2012/10/12/cuda-installation-on-vs-2010/
Test your installation by compiling and running one of the sample programs in the
CUDA software to validate that the hardware and software are running correctly and
communicating with each other.
If you don't have a NVIDIA card, you can still use the emulator but you need to install the SDK and the toolkit. Try to fix your problem by adding in your Visual Studio project settings the include and library path of CUDA.
CUDA is only supported on machines with nVidia video cards. That is likely an issue.
Furthermore, you need to install drivers (dev or otherwise) that is new enough to support the CUDA Toolkit version.
Third, what do you mean by the keywords aren't identified? Do you mean there's no syntax highlighting in your IDE? If so, try [this][1]http://codereflect.com/2008/09/04/how-to-enable-syntax-highlighting-for-cuda-files-in-visual-studio-2005/

How to debug into CUDA kernel code using visual studio 2008?

Hey,
I am using Visual Studio 2008, with CUDA 3.2. I am trying to debug into a function with this signature:
MatrixMultiplication_Kernel<<<dimGrid, dimBlock>>>(Md, Nd, Pd, Width);
I can step into the function, however when I get into the function it doesn't let me step over any of the code and tells me that no source is available. Anybody knows how to debug into this properly?
Thank you!
You can now debug on a single machine with only one GPU using NSight.
Thought I'd update this, since the previous answers are no longer correct (you no longer need 2 GPUs) and it sent me off in the wrong direction for a while.
Update: Parallel Nsight is now free and supports debugging with only one GPU in your system.
To debug device code within Visual Studio you will need Parallel Nsight. The standard version is free and offers the debugging you require as well as device code profiling.
If you want to debug on a single machine then you will need two GPUs (since the GPU running the code will be stopped when it hits a breakpoint, and hence your display would block as well). They don't need to be high-end GPUs though, anything from G92 onwards will do (including most Fermi GPUs as listed here).
Are you using Nsight? Vanilla Visual Studio cannot step into device code, but with Nsight, this is possible. Unfortunately, limitations of the Windows device driver model mean there are some serious restrictions. It used to be that two machines were required to do the debugging. The target machine would run the CUDA code on it's GPU, and had to be using the TCC driver. The host machine would run Visual Studio and control the target. It seems that it is now possible to debug CUDA code on the same machine as long as you have two GPU's, one for compute and one for display. There are a number of other problems mentioned in the user guide.
This may not be an acceptable answer, but: If you can compile your code on Linux, you can use cuda-gdb to debug kernels. cuda-gdb is part of the Linux CUDA toolkit.
You can't debug CUDA kernel code using visual studio. Visual studio can only debug programs that run on the CPU.
In fact, I don't think that you can debug CUDA kernel code in Windows at all any more. CUDA used to have a host emulation mode, but that was removed in 3.0. The only debugging tools available are cuda-gdb and ocelot, and, as far as I know, neither of them supports Windows.

Resources