Howto:Activate multi core and multi GPU support: Difference between revisions
m (Switch to the {{forum url}} template for all forum links.) |
|||
Line 8: | Line 8: | ||
{{FGCquote | {{FGCquote | ||
|the aforementioned threading related directives are only relevant at the OSG/rendering level, i.e. will only tell the underlying OpenSceneGraph implementation to try to do certain tasks "concurrently", for a more detailed explanation, please refer to: [[Howto:Use_the_system_monitor]] | |the aforementioned threading related directives are only relevant at the OSG/rendering level, i.e. will only tell the underlying OpenSceneGraph implementation to try to do certain tasks "concurrently", for a more detailed explanation, please refer to: [[Howto:Use_the_system_monitor]] | ||
|{{cite web |url= | |{{cite web |url={{forum url|p=231703}} | ||
|title=<nowiki>Re: Multiprocessor Support</nowiki> | |title=<nowiki>Re: Multiprocessor Support</nowiki> | ||
|author=<nowiki>Hooray</nowiki> | |author=<nowiki>Hooray</nowiki> | ||
Line 17: | Line 17: | ||
{{FGCquote | {{FGCquote | ||
| OSG threading support is largely specific to offloading '''rendering-related''' computations (i.e. culling) to different threads, it will NOT directly help conventional FlightGear subsystems runing in the main loop, not without explicit coding - i.e. multi-threading or multi-processing and IPC. | | OSG threading support is largely specific to offloading '''rendering-related''' computations (i.e. culling) to different threads, it will NOT directly help conventional FlightGear subsystems runing in the main loop, not without explicit coding - i.e. multi-threading or multi-processing and IPC. | ||
|{{cite web |url= | |{{cite web |url={{forum url|p=153269}} | ||
|title=<nowiki>Re: [SUGGESTION] Multi-core FlightGear support</nowiki> | |title=<nowiki>Re: [SUGGESTION] Multi-core FlightGear support</nowiki> | ||
|author=<nowiki>Hooray</nowiki> | |author=<nowiki>Hooray</nowiki> | ||
Line 29: | Line 29: | ||
The multithreading support in OSG must be explicitly supported by following certain OSG coding patterns and coding protocols. Otherwise, you won't benefit at all.<br/> | The multithreading support in OSG must be explicitly supported by following certain OSG coding patterns and coding protocols. Otherwise, you won't benefit at all.<br/> | ||
Obviously, OSG really is extremely powerful and also pretty good at parallelizing things, but you cannot necessarily see that when running FlightGear, but there is other OSG-based software which is making really good use of this. | Obviously, OSG really is extremely powerful and also pretty good at parallelizing things, but you cannot necessarily see that when running FlightGear, but there is other OSG-based software which is making really good use of this. | ||
|{{cite web |url= | |{{cite web |url={{forum url|p=153295}} | ||
|title=<nowiki>Re: [SUGGESTION] Multi-core FlightGear support</nowiki> | |title=<nowiki>Re: [SUGGESTION] Multi-core FlightGear support</nowiki> | ||
|author=<nowiki>Hooray</nowiki> | |author=<nowiki>Hooray</nowiki> | ||
Line 39: | Line 39: | ||
|Even distribution across the cores doesn't in itself indicate that a process is using multiple threads. The operating system will switch tasks between cores for even temperature distribution, even with a single-threaded program. | |Even distribution across the cores doesn't in itself indicate that a process is using multiple threads. The operating system will switch tasks between cores for even temperature distribution, even with a single-threaded program. | ||
The indication that a program is multi-threaded is when the overall usage of the program goes above the capacity of one core. For that to happen it must have different threads running on different cores at the same time. | The indication that a program is multi-threaded is when the overall usage of the program goes above the capacity of one core. For that to happen it must have different threads running on different cores at the same time. | ||
|{{cite web |url= | |{{cite web |url={{forum url|p=231646}} | ||
|title=<nowiki>Re: Multiprocessor Support</nowiki> | |title=<nowiki>Re: Multiprocessor Support</nowiki> | ||
|author=<nowiki>sanhozay</nowiki> | |author=<nowiki>sanhozay</nowiki> | ||
Line 83: | Line 83: | ||
You can set the osg threading model upon startup with '''--prop:/sim/rendering/multithreading-mode{{=}}CullDrawThreadPerContext''' | You can set the osg threading model upon startup with '''--prop:/sim/rendering/multithreading-mode{{=}}CullDrawThreadPerContext''' | ||
If it still does not work, try DrawThreadPerContext or even SingleThreaded and see if this helps. | If it still does not work, try DrawThreadPerContext or even SingleThreaded and see if this helps. | ||
|{{cite web |url= | |{{cite web |url={{forum url|p=228282}} | ||
|title=<nowiki>Re: Error when trying to run FlightGear with three monitors</nowiki> | |title=<nowiki>Re: Error when trying to run FlightGear with three monitors</nowiki> | ||
|author=<nowiki>Torsten</nowiki> | |author=<nowiki>Torsten</nowiki> | ||
Line 160: | Line 160: | ||
== Related content == | == Related content == | ||
* | * {{forum url|p=69706}} | ||
* http://www.mail-archive.com/osg-users@openscenegraph.net/msg09620.html | * http://www.mail-archive.com/osg-users@openscenegraph.net/msg09620.html | ||
* http://www.opensubscriber.com/message/flightgear-devel@lists.sourceforge.net/14221108.html | * http://www.opensubscriber.com/message/flightgear-devel@lists.sourceforge.net/14221108.html | ||
* | * {{forum url|t=8890}} | ||
* http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg19265.html | * http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg19265.html | ||
* http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg18808.html | * http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg18808.html |
Revision as of 16:40, 7 June 2019
FlightGear supports a number of different threading modes to make use of multiple CPUs or GPUs, this applies mostly to high-end multi-core or multi-GPU, multi-screen (or multi-window) setups and may improve performance (see Howto: Configure camera view windows).
Note In its current form, this section/article is largely based on quotes collected from various related discussions/channels (devel list, forum etc) using the Instant-Cquotes script. Wiki users and other contributors are encouraged to help rewrite/edit contents accordingly to help get rid of unnecessary quoting (i.e. while the wiki is not intended to be a collection of quotes, quotes are sometimes the best/easiest way to bootstrap new articles, while also providing a good way to link back to related discussions in the archives).
While rewriting usually only entails changing first person speech to 3rd person. However, please try to retain references/links to the original discussion whenever possible. |
Multicore |
---|
Configuration |
Ongoing Efforts |
Proposals & RFCs |
Background |
For developers |
Selecting threading modes
Note Beginning with FlightGear 3.0, you should be careful when changing the default OSG threading settings, as enabling multi-threading seems to be an increasingly reliable way to trigger race conditions/segfaults (crashes). Also see ticket #1393 and [1]
|
Caution
|
There is a property supported named /sim/rendering/multithreading-mode this can be set either in the preferences.xml file located in the flightgear data folder (base package: $FG_ROOT) or by using the --prop:/sim/rendering/multithreading-mode=... parameter from the console (or fgrun) this affects directly the osgviewer threading mode, supported values are:
* AutomaticSelection * CullDrawThreadPerContext * DrawThreadPerContext * CullThreadPerCameraDrawThreadPerContext
Further information on threading modes can be found here: http://www.mail-archive.com/osg-users@openscenegraph.net/msg09620.html and here: http://www.mail-archive.com/osg-users@openscenegraph.net/msg09611.html
To set this in a separate XML file, just include it from preferences.xml (toplevel PropertyList node):
threadingmode.xml:
<?xml version="1.0"?>
<PropertyList>
<sim>
<rendering>
<multithreading-mode>AutomaticSelection</multithreading-mode>
</rendering>
</sim>
</PropertyList>
This property must be set during initialization, modifying it at runtime has no effect.
Multithreading modes allocate two instances of OpenGL resources to speed up rendering . Default implicit buffer attachment policy adds depth buffer to FBOs if only color buffer was attached.
if you have a single graphics card, having a thread per camera (each one with a graphics context) doesn't necessarily improve the performance, what is more, it can degrade it. The reason is that each thread will be competing for the graphics card, which is an exclusive resource, and the driver is forced to perform many context switchs. If you are using multiple graphics contexts then by default the OSG/OpenGL will be creating OpenGL objects (like textures) on a per context basis. So one osg::Texture in the scene graph even if it's rendered on two contexts you'll have two separate TextureObjects/OpenGL texture objects.
Related content
- https://forum.flightgear.org/viewtopic.php?p=69706#p69706
- http://www.mail-archive.com/osg-users@openscenegraph.net/msg09620.html
- http://www.opensubscriber.com/message/flightgear-devel@lists.sourceforge.net/14221108.html
- https://forum.flightgear.org/viewtopic.php?t=8890
- http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg19265.html
- http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg18808.html
- http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg29272.html
- http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg29519.html