Skip to content

Commit

Permalink
measure get_buffer_for_opt
Browse files Browse the repository at this point in the history
  • Loading branch information
shu5620 committed Oct 1, 2023
1 parent 45d1a7a commit 8aa4bb4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion border-async-trainer/src/async_trainer/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,21 @@ where
info!("Starts training loop");
loop {

let record = agent.opt(&mut async_buffer.get_buffer_for_opt().lock().unwrap());
let record = {
let time_tmp = SystemTime::now();
let buf = async_buffer.get_buffer_for_opt();
let mut buf = buf.lock().unwrap();
println!("time get_buffer_for_opt: {}", time_tmp.elapsed().unwrap().as_secs_f32());

let time_tmp = SystemTime::now();
let record = agent.opt(&mut buf);
println!("time opt: {}", time_tmp.elapsed().unwrap().as_secs_f32());
record
};

if let Some(mut record) = record {
let time_tmp = SystemTime::now();

opt_steps += 1;
opt_steps_ += 1;

Expand Down Expand Up @@ -352,6 +364,7 @@ where
info!("Sends the trained model info to ActorManager");
self.sync(&agent);
}
println!("time others: {}", time_tmp.elapsed().unwrap().as_secs_f32());
}
}
info!("Stopped training loop");
Expand Down

0 comments on commit 8aa4bb4

Please sign in to comment.