cudafy.net with NSight, debugger not working - visual-studio-2010

As the topic states, I cant get the debugger working. Below is the sequence of steps ive done.
Note: I have Cuda 5.0 installed and NSight visual studio edition 3.0 installed. Ive heard that it is possible to debug now with a single GPU. I'm assuming 5.0 is OK and I don't need the 5.5 release candidate?
1) Changed code to include the following as per the instructions on the site:
CudafyModes.Target = eGPUType.Cuda;
CudafyModes.DeviceId = 0;
CudafyTranslator.Language = eLanguage.Cuda;
CudafyModule km = CudafyTranslator.Cudafy(eArchitecture.sm_20);
//Included this line.
CudafyTranslator.GenerateDebug = true;
_gpu = CudafyHost.GetDevice(eGPUType.Cuda);
_gpu.LoadModule(km);
2) Set a break point just after this.
3) Stopped debugging once break point was hit.
4) Solution Explorer, selected "Show all files" and found the "CUDAFYSOURCETEMP.cu" file.
5) Right clicked and selected "Add to project".
6) Open NSIGHT HUD Launcher 3.0.
7) Set setting as follows:
8) Clicked ok.
9) Double clicked CUDAFYSOURCETEMP.cu and set a break point in the code.
10) Went to the NSight Monitor and click "NSight Monitor Ooption" -> CUDA and the set the following:
11) Went back to VS2010 and selected NSight-> Start Cuda Debugging.
once that's done, I hovered the cursor over variables, once the break point has been hit, but nothing shows up. Only ones which show something are blockDim, blockIdx and threadIdx.
I've also opened the CUDA WarpWatch1 window, typed in a variable yet that's giving the following error "Could not resolve name "num2".
Am i missing a step or something?
EDIT Here is the output from the Output window during compilation.
The thread 'vshost.LoadReference' (0x1f78) has exited with code 0
(0x0). 'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed
(v4.0.30319)): Loaded 'C:\Users\FrazMann\Desktop\Market Adj Entry CUDA
- MK2\FrazerMann.Profiler.UserInterface\bin\x64\Debug\FrazerMann.Profiler.UserInterface.exe',
Symbols loaded. 'FrazerMann.Profiler.UserInterface.vshost.exe'
(Managed (v4.0.30319)): Loaded 'C:\Users\FrazMann\Desktop\Market Adj
Entry CUDA -
MK2\FrazerMann.Profiler.UserInterface\bin\x64\Debug\Cudafy.NET.dll'
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data.OracleClient\v4.0_4.0.0.0__b77a5c561934e089\System.Data.OracleClient.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_64\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll'
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_64\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.Wrapper.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded 'Anonymously Hosted DynamicMethods Assembly'
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Accessibility\v4.0_4.0.0.0__b03f5f7f11d50a3a\Accessibility.dll'
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.SqlXml\v4.0_4.0.0.0__b77a5c561934e089\System.Data.SqlXml.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xaml\v4.0_4.0.0.0__b77a5c561934e089\System.Xaml.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.Composition\v4.0_4.0.0.0__b77a5c561934e089\System.ComponentModel.Composition.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Build.Framework\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.Framework.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Caching\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.Caching.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.ApplicationServices\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.ApplicationServices.dll'
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.DirectoryServices.Protocols\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.DirectoryServices.Protocols.dll', Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.DirectoryServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.DirectoryServices.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.
FrazerMann.Profiler.UserInterface.TaskManager x threadIdx x blockIdx x
blockDim Length Length x threadIdx x blockIdx x blockDim Length x
threadIdx x blockIdx x blockDim GetLength x threadIdx x blockIdx x
blockDim QuickSortOfValues1 x threadIdx x blockIdx x blockDim
QuickSortOfValues1 QuickSortOfValues1
FrazerMann.Profiler.UserInterface.TaskManager/o__SiteContainer0
Compiler version: v5.0
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\bin\nvcc -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.0\include" -m64 -arch=sm_20 "C:\Users\FrazMann\Desktop\Market Adj Entry CUDA - MK2\FrazerMann.Profiler.UserInterface\bin\x64\Debug\CUDAFYSOURCETEMP.cu"
-o "C:\Users\FrazMann\Desktop\Market Adj Entry CUDA - MK2\FrazerMann.Profiler.UserInterface\bin\x64\Debug\CUDAFYSOURCETEMP.ptx"
--ptx CUDAFYSOURCETEMP.cu tmpxft_000010d0_00000000-5_CUDAFYSOURCETEMP.cudafe1.gpu
tmpxft_000010d0_00000000-10_CUDAFYSOURCETEMP.cudafe2.gpu
'FrazerMann.Profiler.UserInterface.vshost.exe' (Managed (v4.0.30319)):
Loaded
'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Dynamic\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Dynamic.dll',
Skipped loading symbols. Module is optimized and the debugger option
'Just My Code' is enabled.

Unless you specify the -G switch to the nvcc compiler driver, there will be no symbols, and the debugger can't do what you want (identify or show specific variable values) without symbols.
It seems like others have asked how to add the -G switch to the nvcc compilation phase within cudafy, and one approach seems to be discussed here.

The mistake you're making is to put CudafyTranslator.GenerateDebug = true; after the CudafyTranslator.Cudafy call.
If you do this, the translator has already generated the GPU binaries without the symbols, then you tell it symbols are needed.
To fix this, simply put CudafyTranslator.GenerateDebug = true; before the CudafyTranslator.Cudafy call.

Related

New to Visual Studio, can't display form

I don't know how to search this error. I'm new to Visual Studio and as I'm trying the "Hello World" example on Visual Basic, I cannot seems to see the form running. The error is this:
'WindowsApp1.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[3492] WindowsApp1.exe' has exited with code -1073741816 (0xc0000008) 'An invalid handle was specified'.
Then I tried to create new project without any code just a form and when I start, the error still occurred.
I'm sorry if there's already a post about this. Just don't know what to search about this.
I managed to find the solution for this if anyone encounter this problem. What I did was change the "Any CPU" to x64(in my case) and it seems my problems have been solved.

Break at Win32-API to inspect process's behaviors

I am debugging 'smartgit for windows'.
I want to know how it invokes 'git' (command it pass to git). I start VS and attach the process of smartgit.
I suspect it communicates with git by windows pipe, and other APIs like ReadFile and WriteFile and so on, so set breakpoints at those functions.
After some Options be set, I tick off 'Just My Code' and delete all exclude modules In symbol settings then I download symbols. and I can ensure that 'Kernel32.pdb' was loaded.
'smartgit.exe' (Win32): Loaded 'Q:\Program Files (x86)\SmartGit\bin\smartgit.exe'. Module was built without symbols.
'smartgit.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
'smartgit.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
'smartgit.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
'smartgit.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Symbols loaded.
_ReadFile#20:
765EF0C0 8B FF mov edi,edi
765EF0C2 55 push ebp
765EF0C3 8B EC mov ebp,esp
765EF0C5 6A FE push 0FFFFFFFEh
765EF0C7 68 C0 52 68 76 push 766852C0h
but still I got the disasm code view when bps were triggered. I am quiet sure that I have ticked 'Show Source Code' option.
WHY? and how to view C code of ReadFile, I want to know what it(smartgit) reads and writes. So I inspect through lpBuffer.
pdb files not containing source code. it can containing information how map RVA address to source file/line. but this information is useful only if you have this source files. because you have no source files for windows system dlls (ntdll, kernel32, kernelbase..) you and can not view it c/c++ code in debugger. and usual information about source files/lines is stripped from system pdbs - because source files anyway not exist for download. but with pdb files you can view internal functions and symbols names (not only exported symbols) - already great advantage which very help in debugging.
in case ReadFile - for what you need source code here ? when you can view say lpBuffer address in [esp + 8] at first instruction (765EF0C0 in your dump) and then in [ebp+0xc] ?

An unhandled exception of type 'System.AccessViolationException' occurred - MFC

this is my stack trace .. i get this bug when i debug the code.How to solve this 'System.AccessViolationException' issue ? i m using Visual studio 2010 and visual c++ MFC code.
'UROC GUI.exe': Loaded 'C:\Windows\SysWOW64\msvcr110_clr0400.dll', Symbols loaded (source information stripped).
'UROC GUI.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\ce5f61c5754789df97be8dc991c47d07\mscorlib.ni.dll', No native symbols in symbol file.
'UROC GUI.exe' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'UROC GUI.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\ZC440Z0rr1\Desktop\UROC 11 alpha 6\UROC Software\Release\UROC GUI.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'UROC GUI.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll', Symbols loaded (source information stripped).
First-chance exception at 0x522fa208 (mfc100u.dll) in UROC GUI.exe: 0xC0000005: Access violation reading location 0x0000006c.
'UROC GUI.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Symbols loaded (source information stripped).
An unhandled exception of type 'System.AccessViolationException' occurred in UROC GUI.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

OpenGL program works in GL 3.x but not 4.x

To preface this question, I am new to openGL and Visual Studio, so I may be missing something rather obvious. I am following an openGL tutorial that's supposed to set up a basic window that displays information about the version of openGL you are using.
Tutorial |
Setup
For reference, I am running VS2010 on 64-bit Windows 7 on an NVidia GTX670m. When I specify that the boilerplate program run in openGL v3.x. It runs just fine. When I specify that it run in v4.x. It crashes with the following output (question to continue after):
'Engine.exe': Loaded 'D:\Engine\Engine\Release\Engine.exe', Symbols loaded.
'Engine.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\freeglut.dll', Binary was not built with debug information.
'Engine.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Symbols loaded.
'Engine.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\msvcr100.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\nvinit.dll', Cannot find or open the PDB file
'Engine.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Program Files (x86)\Common Files\Spigot\Search Settings\wth159.dll', Cannot find or open the PDB file
'Engine.exe': Loaded 'C:\Windows\SysWOW64\psapi.dll', Symbols loaded (source information stripped).
'Engine.exe': Loaded 'C:\Windows\SysWOW64\ig7icd32.dll', Cannot find or open the PDB file
'Engine.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Symbols loaded (source information stripped).
'Engine.exe': Unloaded 'C:\Windows\SysWOW64\version.dll'
The program '[7332] Engine.exe: Native' has exited with code 1 (0x1).
In googling this problem, I saw some people recommend pulling symbols from the MS server in the debug menu and turning off the option to treat warnings as errors. I tried both but the program still crashed. Even if it didn't, I feel like I should still investigate the cause.
Assumption: NVidia lists the GTX 670 as supporting openGL 4.x. It does not explicitly say the 670m is supported, but I am assuming that if the regular 670 is - that mobile version is.
Question: If the program works fine with openGL v3.x and my hardware should support openGL v4.x, what is causing my program to crash?
Your program didn't crash. Conditions in some of the logic may not have been met, causing a different branch to run, but it did run to completion.
None of the output you posted has any relation to your "problem" except the very last line, which suggests that the code entered a branch ending in ExitProcess(1) or return EXIT_FAILURE.
Thanks to everyone for their help. I ended up running this on another machine and did not run into a problem. Either I something is wrong with my laptop's specs or with freeglut

Breakpoint not hit in managed code

I have inherited an application consisting of a number of C#, C++/CLI and native C++ projects.
The app starts as an MFC application but loads the CLR during startup (via a process I'm not sure I fully understand yet†).
I've found that I can place breakpoints in native C++ code and that these work as expected. However, breakpoints in managed code do not work.
In C# I get:
"The breakpoint will not currently be hit. No symbols have been loaded for this document".
In C++/CLI I Get:
"The breakpoint will not currently be hit. No executable code is associated with this line. Possible causes include: preprocessor directives or compiler/linker optimizations".
I can even set two breakpoints in the same C++ file and have only one work, e.g.
#pragma unmanaged
int CMyClass::UnmanagedFunc()
{
// Breakpoint here works
return 1
}
#pragma managed
int CMyClass::ManagedFunc()
{
// Breakpoint here DOES NOT WORK!!
return 2
}
The project settings for "Enable unmanaged code debugging" (within the managed library projects) has no effect on these breakpoints.
Is there some setting or config or something that I do do to allow me to interrupt and step through the managed parts of the code base?
†: The process loads mscoree.dll, and involves a complicated routine including CLRCreateInstance, ICLRMetaHost, ICLRRuntimeHost, GetRuntime(..), Start() and ExecuteInDefaultAppDomain(..).
Since your main EXE is a native program, it is likely that the debugger starts up in unmanaged mode and will therefore not support setting breakpoints on managed code. Project + Properties, Debugging, Debugger Type setting. Change it from the default of Auto to Mixed or Managed Only. Mixed debugging only works in 32-bit mode.
UPDATE: starting with VS2012 you also have to force the debugger to use the legacy managed code debugging engine, the one that still supports C++/CLI. Tools > Options > Debugging > General > "Use managed compatibility mode" setting.
For me, the key was to change debugger type from Auto to Mixed, but for the startup application, not the library which contained the C++/CLI code (which is what I was trying to do).
For the same error it works with me when I specified debugger type to:
"Native Only" or "Managed Only" not to Mixed or Auto!!!
For me it was in project properties -> Linker -> Debugging -> Debuggable Assembly set to YES (/ASSEMBLYDEBUG)

Resources