Using Cuda with a Forms based GUI in xp
Brand new at CUDA programming so please bear with me. I finally got cuda to work in console application using Visual studio 2008 on win xp (32 bit). But my main target is to port an existing program to port to cuda. This program is very computational intensive and is based on a complex gui. So, porting to cuda makes sense as it will cut down on my computational time significantly. I did some research and found no example where cuda is used with a forms based application. Its always been with a console application. But converting my gui into a console based application will be out of the question.
So, I tried doing a test (forms based gui) where I included the .cu file in my project. But on compile i get this linker error
fatal error LNK1313: ijw/native module detected; cannot link 开发者_JS百科with pure modules
So I guess cuda doesn't play nice with managed code.
My question is: IS there anyway to use cuda with a form in visual studio 2008?Another question: Has anyone even tried this as I have not seen any such example?
Please help....
Edit:-- Ok I changed the the properties->configuration->general->common language runtime support to /clr, and it compiled without any problem. But when I tried to run it i got a nasty popup dialog box with Debug Assertion failed error in file dbgheap.c, Expression _CRTisValidHeapPointer(pUserData). So close but no cigar. Any Ideas?????
I've done this with a WPF application written in C# that used C++/CLI to interop with a mixed CLI/native assembly that in turn called CUDA code in a separate project. I've not tried WinForms but I don't see any reason why this shouldn't work. You end up writing quite a lot of plumbing code to handle the interop though.
I'd need more info about what your application was doing when __CRTisValidHeapPointer failed. Your heap has gotten corrupted somehow. It may or may not be related to CUDA code.
C# to C++ interop:
http://www.ademiller.com/blogs/tech/2009/09/c-optimization-revisited-part-3-the-native-option-c/
C++ and CUDA side-by-side:
http://www.ademiller.com/blogs/tech/2011/03/using-cuda-and-thrust-with-visual-studio-2010/
(Visual Studio 2010, CUDA 5.0) Try to set:
Linker->System->Subsystem: Not Set
Linker->Advanced->Entry Point: Empty
精彩评论