Developing Games on Intel Graphics
If you are gaming on graphics integrated in your Intel Processor, this is the place for you! Find answers to your questions or post your issues with PC games
486 Discussions

parallelize CPU workload in game engine ?

Anderson_C_Intel
Employee
493 Views

Hello,

I would like to know how to parallelize CPU workload in game engine  ex. Unity or Unreal ?

any related doc ?

0 Kudos
1 Solution
Bernard
Valued Contributor I
493 Views

My answer is not directly related to your question it is more about simulation and modelling, but you may got interested in the details.

I am currently working on my own project modelling and simulation of air-to-air missile written  mainly in C++ and I usually rely on OPENMP directives and pragmas to parallelize code which does not have any interdependencies. The best candidates for such a parallelization are major "hotspot" functions. Hence I presume that maybe 3D Game Engines or their physics part could implement similar solutions.

View solution in original post

0 Kudos
4 Replies
Michael_C_Intel2
Employee
493 Views

Hi Anderson,

I am unaware of a doc that will cover how to parallelize the CPU workload in the game engine. I am checking to see if one exists for you.

-Michael

0 Kudos
Michael_C_Intel2
Employee
493 Views

Hi Anderson,

There is no doc perse on this but you might want to look at what the engines already do behind the scenes in relation to threading on the CPU.  Beyond that if you are looking at how to explicitly parallelize your workload there should be some kind of job system in each engine that if the work is put in chunks the engine can parallelize for you.

Also check out this this thread for info on the UE4 async framework:

https://forums.unrealengine.com/showthread.php?56398-New-Core-Feature-Async-Framework-%28Master-Branch-and-4-8%29

-Michael

0 Kudos
Michael_C_Intel2
Employee
493 Views

Hi Anderson,

I have some info for you on Unity3D. The basic System.Threading lib is available, so any .NET multithreading tutorial should do the trick for general calculations.  The key rule is to not use any Unity API methods on a separate thread as they are not thread safe.

There are certain asynchronous API versions of typical operations available marked with the word ‘Async’ at the end of the function name.  For example, Application.LoadLevelAsync vs Application.LoadLevel.

This posts answer goes into detail about how this can be leveraged: http://answers.unity3d.com/questions/180243/threading-in-unity.html

Here are a few other posts that go into more details:

                http://answers.unity3d.com/questions/357033/unity3d-and-c-coroutines-vs-threading.html

                http://answers.unity3d.com/questions/908054/unity-5-multithreading.html

-Michael

0 Kudos
Bernard
Valued Contributor I
494 Views

My answer is not directly related to your question it is more about simulation and modelling, but you may got interested in the details.

I am currently working on my own project modelling and simulation of air-to-air missile written  mainly in C++ and I usually rely on OPENMP directives and pragmas to parallelize code which does not have any interdependencies. The best candidates for such a parallelization are major "hotspot" functions. Hence I presume that maybe 3D Game Engines or their physics part could implement similar solutions.

0 Kudos
Reply