-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Using ComputeTaskPool for a par_for_each query only uses half of available logical cores #1907
Copy link
Copy link
Open
Labels
A-AppBevy apps and pluginsBevy apps and pluginsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile timesD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!S-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
Metadata
Metadata
Assignees
Labels
A-AppBevy apps and pluginsBevy apps and pluginsC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile timesD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!S-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
Bevy version
0.5
Operating system & version
Linux
What you did
I have a CPU heavy task and running it as part of a query
par_for_eachloop in aComputeTaskPooland only half of my cores are being utilised. I originally used an AsyncTaskPool but this has even fewer threads assigned.I know why this happens but it was unexpected:
bevy/crates/bevy_core/src/task_pool_options.rs
Line 54 in 75ae20d
What you expected to happen
When not using the
IoTaskPoolorAsyncComputeTaskPoolI would expect theComputeTaskPoolto use all logical cores. Likewise I would expect the other pools to expand to optimally use the CPU available.Alternatively, documentation should be updated to make clear what the current behaviour is and steps to create a new task pool.
What actually happened
Only half of the available core were used.