CUDAfy.NET给Win32Exception:系统找不到指定的文件找不到、文件、系统、CUDAfy

2023-09-03 02:11:11 作者:  尐βèň潴 | 尐潴βèň

我添加了一个引用通过的NuGet的 CUDAfy.NET 库。

 <包ID =CUDAfy.NET版本=1.12.4695.21111targetFramework =net45/>
 

当我运行我的程序,我打了一个 Win32Exception

  

该系统找不到指定的文件

这发生在该计划的第一个实际行:

  CudafyModule公里= CudafyTranslator.Cudafy();
 
xp系统不是有效的win32应用程序怎么解决

有从异常对象,什么文件,他们正在试图加载任何指示。

如何才能闯过这个问题?

修改

使用.NET 4.0的codePLEX下载在VS2010运行捆绑的例子,当我看到了同样的异常。

在STRACK轨迹是:

 在System.Diagnostics.Process.StartWithCreateProcess(的ProcessStartInfo的StartInfo)
在Cudafy.CudafyModule.Compile(eGPUCompiler模式,布尔deleteGenerated code)
在Cudafy.Translator.CudafyTranslator.Cudafy(的ePlatform平台,eArchitecture拱,版本cudaVersion,布尔编译,键入[]类型)
在Cudafy.Translator.CudafyTranslator.Cudafy(的ePlatform平台,eArchitecture拱,键入[]类型)
在Cudafy.Translator.CudafyTranslator.Cudafy()
 

解决方案

设置VS打破在抛出的异常显示在堆栈中的当地人顶部的的ProcessStartInfo 对象调试器的面板。

相关属性是:

  =文件名NVCC
参数= -m64 -arch = sm_12C:\<路径> \ CUDAFYSOURCETEMP.cu-oC:\<路径> \ CUDAFYSOURCETEMP.ptx--ptx
 

从这篇文章解释的一些信息该 CUDA工具包的必须安装。不够公平。

  

确保C ++编译器(cl.exe时)的搜索路径。这种设置NVCC其实是整个过程中最困难的阶段,因此请坚持下去。阅读你仔细得到任何的错误 - 他们很有可能将涉及到找不到cl.exe时或没有32位或64位的CUDA工具包

这是本文讨论的工具包4版本,但5版现已上市,因为CUDAfy v1.1的支持。

下载从https://developer.nvidia.com/cuda-downloads

需要注意的是64位版本的CUDA工具包5.0是一个942 MB的下载。如果你安装了一切,你需要一个额外的2815 MB。该工具包单独需要928 MB。

修改安装CUDA工具包5.0后,程序失败的一个 CudafyCompileException 在同一源代码行:

  

编译错误:NVCC:致命错误:无法找到编译器的cl.exe'在PATH

在搜索我的系统驱动器:

  C:\> DIR /秒的cl.exe
 

这表明许多不同版本的编译器/连接器,无论是从VS 10.0和11.0。显然,只有 cl.exe时版本9和10的支持,所以我选择了VS10.0 AMD64版本,我包括在我的 PATH以下环境变量:

  

C:\ Program Files文件(x86)的\微软的Visual Studio 10.0 \ VC \ BIN \ AMD64

您的路径可能会有所不同,这取决于你的CPU。我建议运行搜索,看看你的选择。

请注意,你将有改变 PATH 环境变量后,重新启动VS,如果你已经拥有了它打开。

在采取这些措施,我的基本程序成功运行。

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()

解决方案

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.