Skip to content

Commit

Permalink
add max_render_threads config to thread num for render_depth (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
makeecat authored Nov 12, 2024
1 parent 000bc53 commit 18ebb39
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
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

0 comments on commit 18ebb39

Please sign in to comment.