CUDAfy.NET giving Win32Exception: The system cannot find the file specified

家住魔仙堡 提交于 2019-11-30 15:07:29

问题


I've added a reference to the CUDAfy.NET library via NuGet.

<package id="CUDAfy.NET" version="1.12.4695.21111" targetFramework="net45" />

When I run my program, I hit a Win32Exception:

The system cannot find the file specified

This happens on the first actual line of the program:

CudafyModule km = CudafyTranslator.Cudafy();

There's no indication from the exception object as to what file they're attempting to load.

How can I get past this problem?

EDIT

I see the same exception when running the bundled examples from the Codeplex download in VS2010 using .NET 4.0.

The strack trace is:

at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Cudafy.CudafyModule.Compile(eGPUCompiler mode, Boolean deleteGeneratedCode)
at Cudafy.Translator.CudafyTranslator.Cudafy(ePlatform platform, eArchitecture arch, Version cudaVersion, Boolean compile, Type[] types)
at Cudafy.Translator.CudafyTranslator.Cudafy(ePlatform platform, eArchitecture arch, Type[] types)
at Cudafy.Translator.CudafyTranslator.Cudafy()

回答1:


Setting VS to break on thrown exceptions shows the ProcessStartInfo object at the top of the stack in the locals pane of the debugger.

The relevant properties are:

FileName = nvcc
Arguments = -m64 -arch=sm_12 "c:\<path>\CUDAFYSOURCETEMP.cu" -o "c:\<path>\CUDAFYSOURCETEMP.ptx" --ptx

Some information from this article explains that the CUDA Toolkit must be installed. Fair enough.

Ensure that the C++ compiler (cl.exe) is on the search path. This set-up of NVCC is actually the toughest stage of the whole process, so please persevere. Read any errors you get carefully - most likely they are related to not finding cl.exe or not having either 32-bit or 64-bit CUDA Toolkit.

That article discusses version 4 of the toolkit, but version 5 is available now and supported since CUDAfy v1.1.

Download from https://developer.nvidia.com/cuda-downloads

Note that the 64-bit version of the CUDA Toolkit 5.0 is a 942 MB download. If you install everything you'll need an additional 2815 MB. The toolkit alone requires 928 MB.

EDIT After installing the CUDA Toolkit 5.0, the program failed with a CudafyCompileException at the same source line:

Compilation error: nvcc : fatal error : Cannot find compiler 'cl.exe' in PATH

Searching my system drive:

C:\>dir /s cl.exe

This shows many different versions of the compiler/linker, both from VS 10.0 and 11.0. Apparently only cl.exe versions 9 and 10 are supported, so I opted for the VS10.0 amd64 version, I included the following in my PATH environment variable:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64

Your path may be different, depending upon your CPU. I recommend running the search to see your options.

Note that you will have to restart VS after changing the PATH environment variable if you already have it open.

After taking these steps, my basic program ran successfully.




回答2:


This may also happen if you had at some point installed CUDA Toolkit v7.5, but realized that the most recent version of CUDAfy supports CUDA 7.0. On uninstalling CUDA 7.5 from the control panel, some files/folders may still remain. You should delete these manually. You may use CUDAfyViewer to see which version of CUDA Toolkit is being accessed.



来源:https://stackoverflow.com/questions/14338482/cudafy-net-giving-win32exception-the-system-cannot-find-the-file-specified

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!