Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

I need to do some heavy computation, in the background of the game loop, for the project, which is currently implemented using 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. 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?

In general I guess my question is what support there is for cross platform heavily parallelized computation with UE. If you need to do a large number of identical computations running on all available cores, how do you do that in 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.

Further more, I wonder how easy it is to use other frameworks such as CUDA or OpenCL from within a UE "script".

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. Anything with the word "parallel" in it generally lead to blueprints.

like image 838
JoeTaicoon Avatar asked Jul 24 '16 17:07

JoeTaicoon


People also ask

Can you use C# in unreal?

Unreal Engine also allows you to use code written in C++ and C#. Even if you're not familiar with programming, there are many extensions out there that can help you use it.

Can you use blueprints and C++ together in Unreal engine?

Introductory information for gameplay programmers getting started with Unreal Engine. C++ classes can be extended with Blueprints, allowing programmers to set up new gameplay classes in code that can be built upon and changed with Blueprints by level designers.

How many objects can unreal handle?

The default limit set in Unreal Engine is 2,162,688 UObjects.

Can you make a game in unreal with blueprints?

You will learn how to create a game using the Blueprint Visual Scripting system. Blueprint is a complete gameplay scripting system based on the concept of using a node-based interface to create gameplay elements from within Unreal Editor. This course is for absolute beginners.


1 Answers

There's a ParallelFor() in UE, defined here: "Engine\Source\Runtime\Core\Public\Async\ParallelFor.h"

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

Example use can be found easily in the source codes.

like image 104
Marson Mao Avatar answered Sep 24 '22 16:09

Marson Mao