6

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.

JoeTaicoon
  • 1,383
  • 1
  • 12
  • 28

1 Answers1

5

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.

Marson Mao
  • 2,935
  • 6
  • 30
  • 45
  • I see it used in the engine, but searching online for unreal engine 4 and ParallelFor gives absolutely no information. That seems rather odd to me. Are you sure it is performent and meant for developer use? – JoeTaicoon Jul 28 '16 at 07:29
  • 1
    @JoeTaicoon Yeah I think it is working. And yes it's for developer to use, I think you can say that the whole code base is for developer to use regardless some of them are not well documented. Don't be surprised if you can't find certain piece of document online, most of the Unreal magic is not online, they are only inside the source codes so you have to read the codes carefully. – Marson Mao Jul 28 '16 at 09:36