Spring is running in SMP
Moderator: Moderators
Re: Spring is running in SMP
Roughly 15-20% when you have many units on screen and/or high terrain detail. It does not seem to benefit much from more than 2 cores since a single thread makes all the GL calls anyway.
The real gain would come from multithreading the Sim which is, to say the least, utterly difficult.
The real gain would come from multithreading the Sim which is, to say the least, utterly difficult.
- clericvash
- Posts: 1394
- Joined: 05 Oct 2004, 01:05
Re: Spring is running in SMP
Well some good optimization is better than none, good job, can't wait to see the benefits when it is all released.
Re: Spring is running in SMP
Have you thought about (imho) most obvious design of running two main loops (in 2 threads), one for rendering and one for sim.zerver wrote:Roughly 15-20% when you have many units on screen and/or high terrain detail. It does not seem to benefit much from more than 2 cores since a single thread makes all the GL calls anyway.
The real gain would come from multithreading the Sim which is, to say the least, utterly difficult.
Then pick right granularity of locking to prevent stuff like rendering a unit in render thread while it is being deleted and the memory reused in sim thread.
(Could pick some parts of sim and use separate locks for each, so e.g. units can't be rendered while units are being simulated, projectiles can't be rendered while projectiles are being simulated etc.; or could pick a lock per unit/projectile, or some combination of both.)
I don't think the fact that this, from users point of view, introduces inconsistent reads (ie. some units may be one frame in future compared to other units) is a significant problem.
In any case keep synced simulation entirely in one thread, I don't want to know how painful MT + sync debugging would be.
Re: Spring is running in SMP
Yes, now that most (all?) GL calls seem to be removed from the sim, it would be possible to do something like that.
Some units rendered one frame ahead could make the animations a bit jerky. Not a big deal, but I'd prefer a solution that did not have this problem.
Some units rendered one frame ahead could make the animations a bit jerky. Not a big deal, but I'd prefer a solution that did not have this problem.
Re: Spring is running in SMP
Then pick locking granularity that solves this, ie. don't render any units while any unit is being simulated.
Then worst that could happen is that e.g. projectiles are rendered one frame ahead/back from units.
Then worst that could happen is that e.g. projectiles are rendered one frame ahead/back from units.
Re: Spring is running in SMP
btw zerver check buildbot after you commit
http://buildbot.no-ip.org:8010/waterfall
http://buildbot.no-ip.org:8010/waterfall
Re: Spring is running in SMP
request adding a -D_GML_ buildbot, since I get really bogus errors on gcc 4.3/mingw:
line number is offset somewhat, the culprit is this piece of code:
edit: removing GML_GLAPIENTRY helps with this one, looks like a gcc wart.
Code: Select all
rts/lib/gml/gml.cpp:156: error: invalid conversion from 'GLUquadric* (*)()' to 'GLUquadric* (*)()'
Code: Select all
gmlSingleItemServer<GLUquadric *, GLUquadric *(GML_GLAPIENTRY *)(void)> gmlQuadricServer(&gluNewQuadric, 100, 25);
Re: Spring is running in SMP
Q: would it be possible to remove any linking to gml.h if GML isn't used?
Re: Spring is running in SMP
issues left to fix which I have no idea how to:
Code: Select all
rts\Rendering\UnitModels\s3oParser.cpp: In member function 'void CS3OParser::DrawSub(SS3O*)':
rts\Rendering\UnitModels\s3oParser.cpp:302: error: 'GML_FUNCTION_NOT_IMPLEMENTED' was not declared in this scope
rts\Rendering\GL\VertexArray.cpp: In member function 'void CVertexArray::DrawArrays(int, int)':
rts\Rendering\GL\VertexArray.cpp:64: error: 'GML_FUNCTION_NOT_IMPLEMENTED' was not declared in this scope
Re: Spring is running in SMP
What is the configure commandline? (can it be done with scons configure?)imbaczek wrote:request adding a -D_GML_ buildbot, since I get really bogus errors on gcc 4.3/mingw:
If it can only be done with cmake: I didnt create any cmake builder yet but I can do it, in particular if someone points me to accurate instructions on how to build it with it.
Re: Spring is running in SMP
it can't, I hardcoded that in my SConstruct.
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Spring is running in SMP
It doesn't compile:
and lots of similar errors. Using gcc 4.3.1 (without _GML_).
Code: Select all
spring/trunk/rts/lib/gml/gml.cpp:145: Fehler: keine passende Funktion für Aufruf von »gmlSingleItemServer<unsigned int, GLhandleARB (*)()>::gmlSingleItemServer(GLuint (**)(), int, int)«
spring/trunk/rts/lib/gml/gmlcls.h:804: Anmerkung: Kandidaten sind: gmlSingleItemServer<T, C>::gmlSingleItemServer(C, int, int) [with T = unsigned int, C = GLhandleARB (*)()]
spring/trunk/rts/lib/gml/gmlcls.h:794: Anmerkung: gmlSingleItemServer<unsigned int, GLhandleARB (*)()>::gmlSingleItemServer(const gmlSingleItemServer<unsigned int, GLhandleARB (*)()>&)
Re: Spring is running in SMP
I thought I fixed these in r6121 and r6122 - please check those out and try similar measures. Much of the issue stems from the fact that gcc can't properly handle attributes of functions in template arguments (I guess).
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Spring is running in SMP
It was your change that broke it, when i replaceimbaczek wrote:I thought I fixed these in r6121 and r6122 - please check those out and try similar measures. Much of the issue stems from the fact that gcc can't properly handle attributes of functions in template arguments (I guess).
Code: Select all
#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ < 3)
Code: Select all
#if 0

Re: Spring is running in SMP
Yes, but maybe only on Windows, don't have any Linux box with gcc 4.3. BTW, my commit was actually:Auswaschbar wrote:It was your change that broke it, when i replacewithCode: Select all
#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ < 3)
in gml.cpp and gml.h it worksCode: Select all
#if 0
. Are you sure this stuff is needed?
Code: Select all
#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Spring is running in SMP
I inserted that "<" to test if it works. When cross-compiling with gcc 4.3.1, I also have to insert "#if 0" to make it work.imbaczek wrote:Yes, but maybe only on Windows, don't have any Linux box with gcc 4.3. BTW, my commit was actually:Auswaschbar wrote:It was your change that broke it, when i replacewithCode: Select all
#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ < 3)
in gml.cpp and gml.h it worksCode: Select all
#if 0
. Are you sure this stuff is needed?
if you had < instead of >=, that may have been it.Code: Select all
#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
Re: Spring is running in SMP
that's bad. fix it so it works for linux crosscompiles, I'll wait for gcc 4.3.1 official mingw release and then we'll consider options we have.
-
- Spring Developer
- Posts: 1254
- Joined: 24 Jun 2007, 08:34
Re: Spring is running in SMP
Do you know how to check the last version number for gcc?
4.3.1 -> "1"?
4.3.1 -> "1"?
Re: Spring is running in SMP
__GNUC_PATCHLEVEL__ IIRC.
Re: Spring is running in SMP
so will 0.77 support multi core cpu ? if yes will it be two different exe ? or the same one with an option to enable disable or ... ?