This project is read-only.

cudafycl.exe fails

Jul 26, 2013 at 10:34 AM

I would like to embed my 'cufafied' module into my application (exe). However it reports the error below:

C:\CUDAfy\CudafyV1.22\bin\cudafycl.exe My_Applic.exe -arch=sm_20
Error: Cudafy.CudafyCompileException: Compilation error: CreateCudafyModule("auto_pos.exe", sm_20);
Error: Cudafy.CudafyCompileException: Compilation error: nvcc : fatal error : Visual Studio configuration file '(null)' could not be found for installation at '
C:\Program Files\Microsoft Visual Studio 10.0\VC\bin/../..'

I have found many suggestions for this kind of problems on the internet, but most of them had to do with x64 and i am using x86.

I have this problem on both win XP pro 32 bit as well as win 7 pro 32bit.

I am using Visual studio 2010 express C# and C++. Further i have installed cuda 5.0. My cudafy version is 1.22.

The application runs fine if it creates the cdfy itself (on my development pc).

Any help/suggestion would be appreciated.
Aug 13, 2013 at 7:42 PM
Not sure what is happening here. Maybe you can try building cudafy from sources so you can get more info on what is happening. Please let me know how you get on.
Sep 2, 2013 at 9:53 AM
Hello Nick,

I just installed V1.25 and now it works.

I have added the generated module to my exe file (as a post build event). However in that case i cannot start my application in debug mode I will try to move my 'cudafy related' code to a separate dll and add the generated module to that dll and hopefully the debugger will work again.
Sep 2, 2013 at 12:08 PM
With 'it works' i meant cudafycl.exe does not report an error anymore. With the -cdfy option (C:\CUDAfy\CudafyV1.25\bin\cudafycl.exe MyApp.exe -arch=sm_20 -cdfy) all works as expected. Without the -cdfy option (C:\CUDAfy\CudafyV1.25\bin\cudafycl.exe MyApp.exe -arch=sm_20) something happens to the exe file (its timestamp changes) but the program raises an exception when 'reading' the CudafyModule: km = GetType().Assembly.GetCudafyModule();

System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.

If i 'view' the exe file with 'CudafyModuleViewer.exe' i get the same errormessage.

I use cuda 5.0.35 and .NET 4.0 in MS Visual C# 2010 express

any suggestions ?
Sep 3, 2013 at 1:01 PM
Edited Sep 3, 2013 at 1:05 PM
I think i have found the problem (a bug in function Deserialize(Stream stream) in KernelModule.cs).

The function Deserialize(Stream stream) has a switch on NET35 and i use .NET 4.0 so i assume in my case i get the 'else' code. In that 'else' section the parameter on XDocument() is stream, which i think is wrong, it should be 'reader' (as in NET35). I have changed in my version and now it works. Can someone please confirm this is correct and fix it in next version.

public static CudafyModule Deserialize(Stream stream)
CudafyModule km = new CudafyModule();

if NET35

XmlReader reader = XmlReader.Create(stream);
XDocument doc = XDocument.Load(reader);


XmlReader reader = XmlReader.Create(stream);
XDocument doc = XDocument.Load(stream); // should be XDocument doc = XDocument.Load(reader);


return Deserialize(km, doc, null);
Sep 4, 2013 at 8:48 AM
Thank you for this. Commenting out XmlReader reader = XmlReader.Create(stream); also works. When creating the XmlReader the position of the stream is probably moved to the end and therefore spelling bad news for the .NET 4.x only XDocument doc = XDocument.Load(stream);
Fix has been committed.
Oct 3, 2013 at 11:54 AM
Hello Nick,

Is there a way i can get a 'beta/pre' release of next version (1.26). That is because i would like to have the above feature implemented without building the sources myselve (in that case i would have a lot of DLL's)
Oct 3, 2013 at 12:01 PM
Visit the download page to get a beta of 1.26.