是否可以使用 managedCUDA 包装器从 Unity C# 脚本进行 运行 并行计算?
Is it possible to use the managedCUDA wrapper to run parallel computations from a Unity C# script?
我正在尝试找出从 Unity C# 脚本调用 CUDA 代码的最佳方法。
managedCUDA 项目似乎是将 C# 接口包装到 CUDA 内核的最佳方式,但是如果 C# 脚本是由 Unity 编译的,这种方法可行吗?
如有任何见解,我们将不胜感激。
谢谢
与其尝试做一些非常复杂的事情,我更愿意使用 Computer Shader which is available and built in Unity. Compute shaders are basically programs that run on the graphics card, outside of the normal rendering pipeline. The only draw back is you need to know about shader programming (HLSL) which is not C# unfortuately. There is a nice tutorial here。
Cuda(和 managedCUDA)使用完全相同的方法,使用计算着色器在 GPU 中编译和 运行 用 C(或 C#)语言编写的程序。
否则,您可以将外部 c# 库添加到您的项目中,只需将 managedCUDA 中的 dll 添加到您的资产文件夹中,然后在您的解决方案中引用它们。然后 运行 来自 Unity 脚本的 Start 方法的 cuda 代码。
希望对您有所帮助。
我正在尝试找出从 Unity C# 脚本调用 CUDA 代码的最佳方法。
managedCUDA 项目似乎是将 C# 接口包装到 CUDA 内核的最佳方式,但是如果 C# 脚本是由 Unity 编译的,这种方法可行吗?
如有任何见解,我们将不胜感激。
谢谢
与其尝试做一些非常复杂的事情,我更愿意使用 Computer Shader which is available and built in Unity. Compute shaders are basically programs that run on the graphics card, outside of the normal rendering pipeline. The only draw back is you need to know about shader programming (HLSL) which is not C# unfortuately. There is a nice tutorial here。
Cuda(和 managedCUDA)使用完全相同的方法,使用计算着色器在 GPU 中编译和 运行 用 C(或 C#)语言编写的程序。
否则,您可以将外部 c# 库添加到您的项目中,只需将 managedCUDA 中的 dll 添加到您的资产文件夹中,然后在您的解决方案中引用它们。然后 运行 来自 Unity 脚本的 Start 方法的 cuda 代码。
希望对您有所帮助。