c# - CUDAfy.NET 给出 Win32Exception : The system cannot find the file specified

标签 c# .net cudafy.net

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

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

当我运行我的程序时,我遇到了一个Win32Exception:

The system cannot find the file specified

这发生在程序的第一行:

CudafyModule km = CudafyTranslator.Cudafy();

异常对象没有指示他们试图加载什么文件。

我怎样才能解决这个问题?

编辑

当我使用 .NET 4.0 在 VS2010 中运行从 Codeplex 下载的捆绑示例时,我看到了同样的异常。

轨迹轨迹为:

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

最佳答案

将 VS 设置为在抛出异常时中断会在调试器的本地 Pane 中的堆栈顶部显示 ProcessStartInfo 对象。

相关属性是:

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

一些信息来自this article说明必须安装 CUDA 工具包。很公平。

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.

那篇文章讨论了该工具包的第 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 失败:

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

正在搜索我的系统驱动器:

C:\>dir /s cl.exe

这显示了来自 VS 10.0 和 11.0 的许多不同版本的编译器/链接器。显然只支持 cl.exe 版本 9 和 10,所以我选择了 VS10.0 amd64 版本,我在我的 PATH 环境变量中包含以下内容:

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

您的路径可能会有所不同,具体取决于您的 CPU。我建议运行搜索以查看您的选项。

请注意,如果您已经打开了 PATH 环境变量,则必须在更改后重新启动 VS。

执行这些步骤后,我的基本程序运行成功。

关于c# - CUDAfy.NET 给出 Win32Exception : The system cannot find the file specified,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14338482/

相关文章:

c# - 如何使用 linq 从表中跳过重复的 id 并选择仍然存在

C# 外部 LINQ 应用

c# - 在 CUDAfy 中的结构内传递数组

c# - 通过 CUDAfy 在 OpenCL 中启用 double

cudafy.net - CudafyModule km = CudafyTranslator.Cudafy();导致错误,找不到编译器

c# - 使用 XPath 排序 - 不是 XSL

java - 如何在 mono/linux 上从 Java 调用 .Net dll(函数)

c# - 如何计算已知字体大小和字符的 WPF TextBlock 宽度?

.net - Log4net登录到开发人员计算机中,但在测试服务器中未登录

.net - .Net4链接到EF的较早加载;也许像DataLoadOptions