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/
Related
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.
I need to do fast image processing so I decide to go for OpenCV with CUDA support. Now I'm trying to build OpenCV as dll to use it in my project, but I am not even able to generate the VS project since CMake keeps giving me this error:
CMakeError. I am on Windows 10, CMake 3.11 with VS 15 2017 x64 generator, OpenCV 3.4 (the last release).
I have installed CUDA 9.2, 9.1 and 8.0 and set CUDA_HOME environment variable as the CUDA toolkit directory. Nothing seems to work.
Then I try to set the CUDA_SDK_ROOT_DIR through the CMake GUI, but the CUDA toolkit directory seems to be not the right one and I'm not able to find the CUDA sample directory anywhere.
I have googled a lot, but I found nothing that had been able to help me. Did someone face this very same issue? How can I solve it?
PS: I have successfully created the dll with TBB and IPP (without CUDA) and it is still not fast enough, so I really need to use Cuda.
I have solved using Cuda 9.1 and VS 15.45. To install CUDA in a correct way you need to use custom installation and delete the VS integration, since it seems to have some problems. Once installation is complete, CMake should detect it.
This is a guide that could help.
I'm trying to build a simple application with CUDA and I've been trying for hours on end and I just can't make it work on windows. nvcc absolutely refuses to compile without Visual Studio's compiler which doesn't support things I need. I tried building using nvcc with clang but It just asks me to use Visual Studio's compiler. I've also tried using clang directly since it now supports CUDA but I receive this error:
clang++.exe: error: Unsupported CUDA gpu architecture: compute_52
This makes no sense to me because I have the CUDA toolkit version 7.5 and my graphics card is a GTX 970 (two of them). I have googled this extensively and everywhere I come across the error the person always has is their CUDA toolkit is < 7.5. I'm on the brink of tears right now trying to get something as simple as VLA to work on this CUDA application and I just can't achieve it...
The CUDA windows toolchain requires the Visual Studio C++ compiler. You cannot use anything else on that platform. If the VS compiler doesn't support the language features you need within CUDA host code, you have no choice but to change platforms, or your expectations.
You can still potentially compile non-CUDA host code using another compiler and then link that code using NVCC and the VS toolchain.
Try to use clang-cl, --cubin=clang-cl.exe
It may be worth to work on a Linux VM or WSL2 within windows. As per the CUDA docs.
To compile new CUDA applications, a CUDA Toolkit for Linux x86 is
needed. CUDA Toolkit support for WSL is still in preview stage as
developer tools such as profilers are not available yet. However, CUDA
application development is fully supported in the WSL2 environment, as
a result, users should be able to compile new CUDA Linux applications
with the latest CUDA Toolkit for x86 Linux.
https://docs.nvidia.com/cuda/wsl-user-guide/index.html#:~:text=However%2C%20CUDA%20application%20development%20is,becomes%20available%20within%20WSL%202.
I downloaded and installed:
Visual Studio 2010
CUDA Toolkit 4.1
N-Body Simulation sample(extracted to desktop in a folder called "NVIDIA GPU Computing SDK")
When I opened the nbody_vs2010.sln inside "NVIDIA GPU Computing SDK\C\src\nbody" , I got 2 could not be found errors for:
NVIDIA GPU Computing SDK\shared\shrUtils_vs2010.vcxproj
NVIDIA GPU Computing SDK\C\common\cutil_vs2010.vcxproj
When am I doing wrong?
I read this to mean that you downloaded the individual n-body sample here rather than the complete SDK. I just downloaded that package and confirmed that it is missing the shrUtils library (it has the headers, but no source or project files). This is a bug.
For now, to work around the issue, please download the entire SDK package (32-bit or 64-bit), and I will report the problem!
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.