diff --git a/miner/src/cacluate.rs b/miner/src/cacluate.rs index 574a962..11be004 100644 --- a/miner/src/cacluate.rs +++ b/miner/src/cacluate.rs @@ -7,7 +7,7 @@ use std::{io::Write, path::PathBuf}; use base16384::Base16384Utf8; use colored::Colorize; -use tracing::{debug, info, warn}; +use tracing::{info, warn}; /// 根据 u64 生成对应的 name /// 转换成 base 16384 @@ -58,7 +58,7 @@ pub fn cacl(config: CacluateConfig, id: u64, outfile: &PathBuf) { let team_namer = TeamNamer::new(&config.team).unwrap(); for i in (config.start + id..config.end).step_by(config.thread_count as usize) { - let name = gen_name(i as u64); + let name = gen_name(i); let mut namer = Namer::new_from_team_namer_unchecked(&team_namer, name.as_str()); let prop = namer.get_property(); diff --git a/miner/src/evaluate/xuping.rs b/miner/src/evaluate/xuping.rs index 5166312..3e0e04f 100644 --- a/miner/src/evaluate/xuping.rs +++ b/miner/src/evaluate/xuping.rs @@ -1,23 +1,18 @@ mod eval; mod model13; +#[allow(clippy::excessive_precision)] mod model20; use crate::evaluate::NamerEvaluater; use crate::name::Namer; -pub struct XuPing1_3_1 { - pub limit: f64, -} - -impl XuPing1_3_1 { - pub fn new(limit: f64) -> Self { Self { limit } } -} +pub struct XuPing1_3_1; impl NamerEvaluater for XuPing1_3_1 { const NAME: &'static str = "虚评"; const VERSION: &'static str = "1.3.1"; fn evaluate(name: &Namer) -> f64 { eval::predict_13(name) } - fn check(&self, name: &Namer) -> bool { eval::predict_13(name) > self.limit } + fn check(&self, name: &Namer) -> bool { eval::predict_13(name) > 0.0 } } pub struct XuPing2_0_1015; diff --git a/miner/src/evaluate/xuping/eval.rs b/miner/src/evaluate/xuping/eval.rs index e37da78..e75159c 100644 --- a/miner/src/evaluate/xuping/eval.rs +++ b/miner/src/evaluate/xuping/eval.rs @@ -5,8 +5,6 @@ use std::simd::f64x64; #[cfg(feature = "simd")] use std::simd::num::SimdFloat; -use tracing::{debug, info}; - use crate::evaluate::xuping::{model13 as xuping13, model20 as xuping20}; use crate::name::Namer; @@ -281,12 +279,6 @@ mod test { assert_eq!(predict_13(&namer), 5799.586821819176); } - fn xp_20(name: &str) -> f64 { - let mut namer = Namer::new(&name.to_string()).unwrap(); - namer.update_skill(); - predict_20(&namer) - } - #[test] fn xuping_20_1015_test() { // let mut namer = Namer::new(&"pi31uXx?shadow@魔".to_string()).unwrap(); @@ -295,7 +287,6 @@ mod test { namer.update_skill(); println!("{:?}", namer.get_info()); - // println!("{:?}", xp_20("一一七啺埀㴁@shenjack")); assert_eq!(predict_20(&namer), 3603.4389333619297); } } diff --git a/miner/src/main.rs b/miner/src/main.rs index 0677a5e..ff2023d 100644 --- a/miner/src/main.rs +++ b/miner/src/main.rs @@ -55,7 +55,7 @@ impl Command { team: self.team.clone(), report_interval: self.report_interval, core_affinity: if self.bench { - Some(0001 << self.bench_core) + Some(1 << self.bench_core) } else { None }, @@ -75,7 +75,7 @@ pub fn set_thread2core(core: usize) { x => info!("设置线程亲和性成功 {}", x), } } - #[cfg(linux)] + #[cfg(unix)] { warn!("Linux 下不支持设置线程亲和性 (未实现) {}", core) } @@ -92,7 +92,7 @@ pub fn set_process_cores(cores: usize) { x => info!("设置进程亲和性成功 {}", x), } } - #[cfg(linux)] + #[cfg(unix)] { warn!("Linux 下不支持设置进程亲和性 (未实现) {}", cores) } @@ -114,7 +114,7 @@ fn main() { let out_path = PathBuf::from(format!("./namerena/{}", output_filename)); info!("输出文件: {:?}", out_path); // 先创建文件夹 - if let Err(e) = std::fs::create_dir_all(&out_path.parent().unwrap()) { + if let Err(e) = std::fs::create_dir_all(out_path.parent().unwrap()) { warn!("创建文件夹失败: {}", e); } @@ -129,7 +129,7 @@ fn main() { if cli_arg.bench { info!("开始 benchmark"); let mut config = cli_arg.as_cacl_config(); - config.core_affinity = Some(0001 << cli_arg.bench_core); + config.core_affinity = Some(1 << cli_arg.bench_core); set_process_cores(cli_arg.bench_core); cacluate::cacl(config, 1, &out_path); } else { @@ -139,8 +139,8 @@ fn main() { n += 1; let mut config = cli_arg.as_cacl_config(); // 核心亲和性: n, n+1 - config.core_affinity = Some((0001 << i) + (0001 << (i + 1))); - cores |= (0001 << i) + (0001 << (i + 1)); + config.core_affinity = Some((1 << i) + (1 << (i + 1))); + cores |= (1 << i) + (1 << (i + 1)); let out_path = out_path.clone(); let thread_name = format!("thread_{}", n); threads.push(std::thread::spawn(move || {