简体   繁体   English

虚幻引擎4的并行计算

[英]Parallel computation with unreal engine 4

I am currently researching the usability of Unreal Engine for a computational intensive project and Google have not been terribly helpful. 我目前正在研究虚幻引擎在计算密集型项目中的可用性,而Google并没有提供任何帮助。

I need to do some heavy computation, in the background of the game loop, for the project, which is currently implemented using OpenMP. 我需要在游戏循环的背景下对该项目进行一些繁重的计算,该项目目前使用OpenMP实现。 A fluid simulation. 流体模拟。

Unreal Engine on windows compiles and builds using visual studio and should as such have support for what the visual studio compiler has, but it is unclear to me if you can make UE compile with the proper settings for OpenMP. Windows上的虚幻引擎使用Visual Studio进行编译和构建,因此应该支持Visual Studio编译器所具有的功能,但是我不清楚您是否可以使用OpenMP的正确设置来编译UE。 Alternatively, I could easily make this work with Intels threading building blocks TBB, which is apparently already used in UE... though perhaps only the memory allocator part? 或者,我可以轻松地使用Intel的线程构建模块TBB来完成这项工作,虽然显然只有UE才使用它,但是它似乎已经在UE中使用了……

In general I guess my question is what support there is for cross platform heavily parallelized computation with UE. 总的来说,我想我的问题是对跨平台与UE高度并行化的计算有什么支持。 If you need to do a large number of identical computations running on all available cores, how do you do that in UE? 如果您需要在所有可用内核上运行大量相同的计算,那么如何在UE中进行呢? I am not interested in manually creating some number of threads, run them on blocks code, wait for completion by joining and then move on. 我对手动创建一些线程,在块代码上运行它们,通过加入等待完成然后继续前进不感兴趣。 I would much prefer a parallel_for loop for my purpose. 我非常希望使用parallel_for循环。

Further more, I wonder how easy it is to use other frameworks such as CUDA or OpenCL from within a UE "script". 此外,我想知道从UE“脚本”中使用其他框架(如CUDA或OpenCL)有多么容易。

I come from Unity where I made c# wrappers around native dlls, written in c++, for high performance, but I am getting a bit tired of this wrapping native in c#, so I would much prefer a c++ based engine... but if that itself is limited in what I can do in my c++ code, then it is not much help... I assume it can all work, when I learn how, but I am a bit confused by not being able to find any info about any of the above questions. 我来自Unity,在那里我用c ++编写了本机dll周围的c#包装器,以实现高性能,但是我对使用c#进行本机包装感到有些厌倦,所以我会更喜欢基于c ++的引擎...但是如果那样的话本身在我的c ++代码中可以做的事情有限,所以并没有太大的帮助...当我学习如何时,我想它可以全部工作,但是由于找不到任何关于任何信息的信息,我有点困惑以上问题。 Anything with the word "parallel" in it generally lead to blueprints. 任何带有“平行”一词的东西通常都会导致设计图。

There's a ParallelFor() in UE, defined here: "Engine\\Source\\Runtime\\Core\\Public\\Async\\ParallelFor.h" UE中有一个ParallelFor(),定义如下:“ Engine \\ Source \\ Runtime \\ Core \\ Public \\ Async \\ ParallelFor.h”

Signature is void ParallelFor(int32 Num, TFunctionRef<void(int32)> Body, bool bForceSingleThread = false) 签名为void ParallelFor(int32 Num, TFunctionRef<void(int32)> Body, bool bForceSingleThread = false)

Example use can be found easily in the source codes. 在源代码中可以轻松找到示例用法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM