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

add max_render_threads config to thread num for render_depth #17

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/quad.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use_multithreading_depth_rendering: true # Enable multithreading for depth rende
use_rk4_for_dynamics_update: false # Enable Runge-Kutta 4th order integration for dynamics, otherwise Euler integration is used
use_rk4_for_dynamics_control: false # Enable Runge-Kutta 4th order integration for dynamics, otherwise Euler integration is used

max_render_threads: 8 # Maximum number of threads for rendering

rerun_blueprint: "config/peng_default_blueprint.rbl"

simulation:
Expand Down
2 changes: 2 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ pub struct Config {
pub planner_schedule: Vec<PlannerStep>,
/// Rerun blueprint path
pub rerun_blueprint: String,
/// Maximum number of threads for rendering
pub max_render_threads: Option<usize>,
/// Use rerun.io for recording
pub use_rerun: bool,
/// Render depth
Expand Down
6 changes: 6 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ fn main() -> Result<(), SimulationError> {
config.camera.near,
config.camera.far,
);
if let Some(thread_count) = config.max_render_threads {
rayon::ThreadPoolBuilder::new()
.num_threads(thread_count)
.build_global()
.unwrap();
}
let mut planner_manager = PlannerManager::new(Vector3::zeros(), 0.0);
let mut trajectory = Trajectory::new(Vector3::new(0.0, 0.0, 0.0));
let mut previous_thrust = 0.0;
Expand Down