r/KerbalSpaceProgram • u/-Aeryn- • Apr 08 '16
Discussion Some KSP 1.1 multi-core scaling testing
A lot of people have been talking about performance gains in 1.1 via improved multithreading support, potentially having each craft use its own CPU core etc. I did some tests previously and some people reported conflicting results, so i decided to do a few more.
For testing purposes i built a 100 part block that's mostly fuel tanks but has a lot of RCS thrusters, some RTG's and reaction wheels, a probe core etc.
I looked at CPU load and FPS in four situations; four of them stuck together as a 400 part craft on the launchpad, split up into 4x 100 part crafts on the launchpad and then the same thing in space - once with them stuck together as 400 parts, once as 4 seperate 100 part crafts.
I've noticed performance being better in orbit than on the ground and my previous test that showed a certain result was on planes sitting on the ground, so i thought to expand testing to orbit in case anything was different there.
raw data:
Microsat 1 (100 parts) - x4 as a single craft on launchpad
- 4c4t - 38% CPU load, 62fps
- 2c2t - 78% CPU load, 47fps
Microsat 1 - x4 as 4 seperate crafts on launchpad
- 4c4t - 43% CPU load, 77fps
- 2c2t - 83% CPU load, 61fps
Microsat 1 - x4 as a single craft in space
- 4c4t - 39% CPU load, 70fps
- 2c2t - 75% CPU load, 58fps
Microsat 1 - x4 as 4 seperate crafts in space
- 4c4t - 40% CPU load, 90fps
- 2c2t - 85% CPU load, 82fps
There is some interesting stuff to see here:
- 4c4t is about 1.205x faster than 2c2t on average
- CPU load as a percentage of overall CPU is dramatically higher when half as many cores are enabled, it's about twice as high on average, even when there are 4x 100 part crafts making up most of the CPU work. The highest stable CPU load seen on 4c4t was 43%.
- The 2c2t setup gains 1.349x more FPS when splitting the craft into 4 parts while the 4c4t gains 1.265x.
which means..
- FPS gains from splitting a craft into smaller parts seem to be from efficiency and each part taking less CPU when the craft itself has fewer parts. If the gains came from splitting each craft onto its own thread to run in parallel, you could see much more massive gains on the CPU with more cores.
- 4c4t is 16.8% faster than 2c2t when running 4 seperate 100 part crafts. Perfect scaling would be 100% faster, as there are 100% more cores and the task is highly CPU limited.
There is obviously some margin for error in testing, but i think the results are pretty clear and match previous tests. 4x single 100 part crafts that are not connected takes less work to run than a 400 part craft. Based on this and other data, i'm pretty sure that "one craft per core" is either not implemented or providing very little benefit.
I'm not disputing 1.1 performing a lot better than 1.0.5 - there have been some obviously massive improvements made that make the game more fun for everyone with systems ranging from low end to flagship status. The stuff that i am curious about and testing is -how- that performance improvement happened, which parts of the code have improved, if a significant percentage of the performance gain can be attributed to improvements in multi-core scaling and such.
4
u/-Aeryn- Apr 08 '16
Please comment if you have any questions, suggestions for more testing etc
1
u/Eric_S Master Kerbalnaut Apr 08 '16
Depends on your definition of perfect scaling. Even in raw, low level PhysX benchmarks, going from one core two two cores was only showing a 50% benefit. KSP is still quite a bit short of that, so this is really more clarification on what is theoretically possible without assuming improvements on PhysX's part as well.
1
u/gfrodo Apr 08 '16
Did you notice a higher CPU consumtion in SPH or VAB? Thanks to unity, KSP is usable again on my lowend dualcore. With small crafts I have about 5-15 FPS at 70% cpu load, in VAB or SPH performance is worse at 100% cpu load.
1
u/Slow_Dog Apr 09 '16
Here's some other suggestions:
You haven't done the test against 1.05, which is the meaningful point of comparison. But that's onerous. How about running it against the single core 1.05 would have used?
I don't think your craft is big enough (for the test you did; it's big enough had you done a single core). You want something that's going to max out the lower number of cores. A core can't go past 100%; what's the game like with two cores at 100% vs 4 at 75%? Surely there's a performance gain then?
Also, it isn't necessarily just FPS where the gain is going to show. If the game can't cope, it extends the physics timestep, and the time bar goes yellow. Can you run bigger or more craft with more cores before this happens?
2
u/Dakitess Master Kerbalnaut Apr 08 '16
Really really Nice, well done and thanks !
2
u/[deleted] Apr 08 '16
What does 4c4t and 2c2t mean? I missed that description in your post.
1
u/[deleted] Apr 09 '16
I'd be curious whether the same scaling is true for 4x400 part ships vs one 1600 part ship.
And also the same numbers (for both sets) for 1.0.5.