mirror of https://github.com/tracel-ai/burn.git
[backend-comparison] Add URL to browse results on burn.dev website (#1573)
This commit is contained in:
parent
9a1459797f
commit
65222761fd
|
@ -207,6 +207,7 @@ dependencies = [
|
||||||
"github-device-flow",
|
"github-device-flow",
|
||||||
"indicatif",
|
"indicatif",
|
||||||
"os_info",
|
"os_info",
|
||||||
|
"percent-encoding",
|
||||||
"rand",
|
"rand",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"rstest",
|
"rstest",
|
||||||
|
|
|
@ -48,6 +48,7 @@ proc-macro2 = "1.0.79"
|
||||||
protobuf = "3.3"
|
protobuf = "3.3"
|
||||||
protobuf-codegen = "3.3"
|
protobuf-codegen = "3.3"
|
||||||
quote = "1.0.33"
|
quote = "1.0.33"
|
||||||
|
percent-encoding = "2.3.1"
|
||||||
r2d2 = "0.8.10"
|
r2d2 = "0.8.10"
|
||||||
r2d2_sqlite = { version = "0.23.0" }
|
r2d2_sqlite = { version = "0.23.0" }
|
||||||
rayon = "1.10.0"
|
rayon = "1.10.0"
|
||||||
|
|
|
@ -37,6 +37,7 @@ dirs = { workspace = true }
|
||||||
github-device-flow = { workspace = true }
|
github-device-flow = { workspace = true }
|
||||||
os_info = { workspace = true }
|
os_info = { workspace = true }
|
||||||
indicatif = { workspace = true }
|
indicatif = { workspace = true }
|
||||||
|
percent-encoding = { workspace = true }
|
||||||
rand = { workspace = true }
|
rand = { workspace = true }
|
||||||
reqwest = {workspace = true, features = ["blocking", "json"]}
|
reqwest = {workspace = true, features = ["blocking", "json"]}
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use clap::{Parser, Subcommand, ValueEnum};
|
use clap::{Parser, Subcommand, ValueEnum};
|
||||||
|
use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::process::ExitStatus;
|
use std::process::ExitStatus;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
@ -6,12 +7,14 @@ use strum::IntoEnumIterator;
|
||||||
use strum_macros::{Display, EnumIter};
|
use strum_macros::{Display, EnumIter};
|
||||||
|
|
||||||
use crate::burnbenchapp::auth::Tokens;
|
use crate::burnbenchapp::auth::Tokens;
|
||||||
|
use crate::persistence::system_info::BenchmarkSystemInfo;
|
||||||
|
|
||||||
use super::auth::get_tokens;
|
use super::auth::get_tokens;
|
||||||
use super::auth::get_username;
|
use super::auth::get_username;
|
||||||
use super::progressbar::RunnerProgressBar;
|
use super::progressbar::RunnerProgressBar;
|
||||||
use super::reports::{BenchmarkCollection, FailedBenchmark};
|
use super::reports::{BenchmarkCollection, FailedBenchmark};
|
||||||
use super::runner::{CargoRunner, NiceProcessor, OutputProcessor, VerboseProcessor};
|
use super::runner::{CargoRunner, NiceProcessor, OutputProcessor, VerboseProcessor};
|
||||||
|
use super::USER_BENCHMARK_WEBSITE_URL;
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[clap(author, version, about, long_about = None)]
|
#[clap(author, version, about, long_about = None)]
|
||||||
|
@ -199,6 +202,9 @@ fn run_backend_comparison_benchmarks(
|
||||||
pb.lock().unwrap().finish();
|
pb.lock().unwrap().finish();
|
||||||
}
|
}
|
||||||
println!("{}", report_collection.load_records());
|
println!("{}", report_collection.load_records());
|
||||||
|
if let Some(url) = web_results_url(token) {
|
||||||
|
println!("📊 Browse results at {}", url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_cargo(
|
fn run_cargo(
|
||||||
|
@ -237,3 +243,23 @@ fn run_cargo(
|
||||||
let mut runner = CargoRunner::new(&args, processor);
|
let mut runner = CargoRunner::new(&args, processor);
|
||||||
runner.run()
|
runner.run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn web_results_url(token: Option<&str>) -> Option<String> {
|
||||||
|
if let Some(t) = token {
|
||||||
|
if let Some(user) = get_username(t) {
|
||||||
|
let sysinfo = BenchmarkSystemInfo::new();
|
||||||
|
let encoded_os = utf8_percent_encode(&sysinfo.os.name, NON_ALPHANUMERIC).to_string();
|
||||||
|
let output = std::process::Command::new("git")
|
||||||
|
.args(["rev-parse", "HEAD"])
|
||||||
|
.output()
|
||||||
|
.unwrap();
|
||||||
|
let git_hash = String::from_utf8(output.stdout).unwrap().trim().to_string();
|
||||||
|
|
||||||
|
return Some(format!(
|
||||||
|
"{}benchmarks/community-benchmarks?user={}&os={}&version1={}&version2={}&search=true",
|
||||||
|
USER_BENCHMARK_WEBSITE_URL, user.nickname, encoded_os, git_hash, git_hash
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
|
@ -14,3 +14,11 @@ const USER_BENCHMARK_SERVER_URL: &str = if cfg!(debug_assertions) {
|
||||||
// production
|
// production
|
||||||
"https://user-benchmark-server-gvtbw64teq-nn.a.run.app/"
|
"https://user-benchmark-server-gvtbw64teq-nn.a.run.app/"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const USER_BENCHMARK_WEBSITE_URL: &str = if cfg!(debug_assertions) {
|
||||||
|
// development
|
||||||
|
"http://localhost:4321/"
|
||||||
|
} else {
|
||||||
|
// production
|
||||||
|
"https://burn.dev/"
|
||||||
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
mod base;
|
mod base;
|
||||||
mod system_info;
|
pub mod system_info;
|
||||||
|
|
||||||
pub use base::*;
|
pub use base::*;
|
||||||
|
|
|
@ -8,12 +8,12 @@ use wgpu;
|
||||||
pub struct BenchmarkSystemInfo {
|
pub struct BenchmarkSystemInfo {
|
||||||
cpus: Vec<String>,
|
cpus: Vec<String>,
|
||||||
gpus: Vec<String>,
|
gpus: Vec<String>,
|
||||||
os: BenchmarkOSInfo,
|
pub os: BenchmarkOSInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Clone, Serialize, Deserialize)]
|
#[derive(Default, Clone, Serialize, Deserialize)]
|
||||||
pub(crate) struct BenchmarkOSInfo {
|
pub struct BenchmarkOSInfo {
|
||||||
name: String,
|
pub name: String,
|
||||||
#[serde(rename = "wsl")]
|
#[serde(rename = "wsl")]
|
||||||
windows_linux_subsystem: bool,
|
windows_linux_subsystem: bool,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue