Prefer Your Language

Search This Blog

Showing posts with label Compilation. Show all posts

How to specify architecture while compiling CUDA program in Visual profiler How to change command line flag in CUDA


How to specify architecture while compiling CUDA program in Visual profiler
How to change command line flag in CUDA

Hello, today I’ll let you know how to change compilation option such as flag in visual profiler. Sometimes it happens we need to specify the architecture of our GPU to run any sample code. For example, if your code contain “atomicAdd()” function then you SM architecture
should be > SM10, although you SM architecture is greater than 1.0 but you can’t Build your project in Visual profiler because of compiler flag is SM10. When you try to do this visual profiler through an error like this;
atomicAdd undefined identifier

In this case you specifically, specify architecture greater than SM10 in compiler flag.
Let us compile our code using command line;
nvcc –arch=sm__30

Same you want to do in your visual profiler. So you need to change this line
nvcc  -gencode=arch=compute_10,code=\"sm_30,compute_30\

To
nvcc  -gencode=arch=compute_30,code=\"sm_30,compute_30\

Procedure to achieve this;
Step 1: Open your project properties



Step 2: Go to your GPU option


Step 3: Change GPU architecture value to required SM value, in this case I have change it from SM10 to SM30




Step 4 : You are done



Got Questions?

Feel free to ask me any question by commenting below because I'd be happy to walk you through step by step! 

Want to Contact us? Click here

Installing NVidia Nsight Visual studio plugin for Debugging CUDA Kernel Code



So many visitors have asked me that,

“How to install NVidia Nsight Visual Studio plugin in Visual Studio for Debugging CUDA Code?”
                                                OR
“How to configure NVidia Nsight in Visual Studio for debugging CUDA code?”

Today I’m going to teach you a step by step guide to resolve above query.  Please follow below steps for correct installation and configuration afterword’s, I’ll show you a video that will let you know How to use Nvidia Nsight Visual studio  plugin for debugging CUDA code.


Step1: Get to know about requirement, follow below link and check that your Card and visual studio version met the requirement or not. Nsight Visual Studio Edition Requirements.

Step 2: Get to know Nsight Visual Studio Edition Supported GPUs, follow below link Nsight Visual Studio Edition Supported GPUs

Step3: To download Nsight Visual studio plugin you need to register at Developer website of NVidia. If you have an account already then download from here otherwise register at here (After registration, they send you a download link), download your Nsight Visual studio plugin setup and save in your Hard disk.

Step4: Start installation by double clicking on Setup of Nsight, Installation will start automatically. Be careful at this step, this is most important step at which you need to concentrate more. When you start installing check does any requirement doesn’t met, if yes then follow this link Install Nsight Visual Studio Edition

 

Completed all steps? Yes, Hurry you install Nsight perfectly (please verify it). Now it’s time to learn how to use it, here is the video which describe you how to use it.


                                                     

Debugging CUDA C using NVIDIA Parallel Nsight and Visual Studio 2008  

 

 

           Debugging Graphics using NVIDIA Parallel Nsight and Visual Studio 

  



Got Questions?
Feel free to ask me any question because I'd be happy to walk you through step by step!

References and External links

For Contact us….. Click on Contact us Tab

Compile and Run CUDA C/C++ Programs



Kernels can be written using the CUDA instruction set architecture, called PTX (Parallel thread Execution ). It is however usually more effective to use a high-level programming language such as C. In both cases, kernels must be compiled into binary code by nvcc to execute on the device.




Process 

Command Line Procedure 

Step 1: Save your program with the extension .cu   let say Example.cu

Step 2: Open command prompt (in Windows) or Terminal (in Linux) and locate your program     directory.

Step 3: Type in command prompt (Terminal in Linux)

            
 

C:\Users\Gnits> nvcc Example.cu    // for compiling 

C:\Users\Gnits> a.exe                    // To run your program 




[ Procedure is same in Linux ]

    


Feel free to comment...

Become a contributor to this blog. Click on contact us tab
Blogger Template by Clairvo