Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All subapps use their own ComputeTaskPool by default #4791

Closed
james7132 opened this issue May 18, 2022 · 0 comments
Closed

All subapps use their own ComputeTaskPool by default #4791

james7132 opened this issue May 18, 2022 · 0 comments
Labels
A-App Bevy apps and plugins A-Rendering Drawing game state to the screen A-Tasks Tools for parallel and async work C-Bug An unexpected or incorrect behavior C-Performance A change motivated by improving speed, memory usage or compile times

Comments

@james7132
Copy link
Member

james7132 commented May 18, 2022

Bevy version

de2b1a4, also happens in v0.7.

Operating system & version

Any

What you did

Use RenderPlugin via DefaultPlugins

What you expected to happen

A single global ComputeTaskPool is spawned, with a 1:1 correspondence with the number of logical CPU cores on the machine (32).

What actually happened

Two separate ComputeTaskPool s were spawned, one for each subapp. A total of 65 threads were spawned (1 main + 32 for each sub app).

Additional information

ParallelExecutor inserts a default CompteTaskPool if there isn't one stored as a resource. When spawning the render sub-app, the main world's ComputeTaskPool is not cloned and inserted into the render app's.

@james7132 james7132 added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times A-Tasks Tools for parallel and async work A-App Bevy apps and plugins labels May 18, 2022
@bors bors bot closed this as completed in a02c5ae May 30, 2022
james7132 added a commit to james7132/bevy that referenced this issue Jun 7, 2022
# Objective
Fixes bevyengine#4791. `ParallelExecutor` inserts a default `CompteTaskPool` if there isn't one stored as a resource, including when it runs on a different world. When spawning the render sub-app, the main world's `ComputeTaskPool` is not cloned and inserted into the render app's, which causes a second `ComputeTaskPool` with the default configuration to be spawned. This results in an excess number of threads being spawned.

## Solution
Copy the task pools from the main world to the subapps upon creating them.

## Alternative
An alternative to this would be to make the task pools global, as seen in bevyengine#2250 or bevyengine/rfcs#54.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective
Fixes bevyengine#4791. `ParallelExecutor` inserts a default `CompteTaskPool` if there isn't one stored as a resource, including when it runs on a different world. When spawning the render sub-app, the main world's `ComputeTaskPool` is not cloned and inserted into the render app's, which causes a second `ComputeTaskPool` with the default configuration to be spawned. This results in an excess number of threads being spawned.

## Solution
Copy the task pools from the main world to the subapps upon creating them.

## Alternative
An alternative to this would be to make the task pools global, as seen in bevyengine#2250 or bevyengine/rfcs#54.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-App Bevy apps and plugins A-Rendering Drawing game state to the screen A-Tasks Tools for parallel and async work C-Bug An unexpected or incorrect behavior C-Performance A change motivated by improving speed, memory usage or compile times
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant