Using the Nvidia Sight Debugger

Enter Title Minimize
Debugging with Parallel NSight is possible! Will be made easier in future Cudafy release but here’s an example of how to do it with V1.3:

public void SetUp()
{
_cm = CudafyTranslator.Cudafy();

// Add this block
if (_cm.CompilerOptionsList.Count == 0)
_cm.CompilerOptionsList.Add(NvccCompilerOptions.Createx64());
_cm.CompilerOptionsList[0].GenerateDebugInfo = true;
_cm.Compile(eGPUCompiler.CudaNvcc);
_cm.Serialize();

_gpu = CudafyHost.GetDevice(CudafyModes.Target, deviceId);
_gpu.LoadModule(_cm);
}

You’ll need Visual Studio 2010 and NSight 2.0 installed.

Once you’ve ran the code successfully one time a *.cdfy file will be in your working directory. Go to Visual Studio 2010’s solution explorer and at top click Show All Files. You’ll see your bin directory there. Go to the working directory and find the CUDAFYSOURCETEMP.cu file. This is the generated file. Right click it and say Include in Project.

Now double click and open the file. Go ahead and add some break points.

Next up, open the NVIDIA Parallel NSight User Settings by clicking the green ball beside the Show all Files button you just clicked. Set the Working Directory to match the directory where the exe is running from.

Make sure Parallel NSight Monitor is running.

Make sure you are running the code on a different GPU than where your monitor(s) are attached. Set the GPU device id if necessary in Cudafy by passing a device id to CudafyHost.GetDevice method.

Remember you can use the Cudafy emulator, too, by also selecting this in CudafyHost.GetDevice .

From V1.4 of Cudafy and in the sources available on codeplex the following is possible:

public void SetUp()
{
CudafyTranslator.GenerateDebug = true;
_cm = CudafyTranslator.Cudafy();
_gpu = CudafyHost.GetDevice(CudafyModes.Target, 0);
_gpu.LoadModule(_cm);
}