From 542aba050fc1e24acaa1653ac17d4ee2b2a929bf Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Mon, 24 Jun 2024 00:28:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=90=E5=91=90=E5=91=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miner/src/cacluate.rs | 64 ------------------------------------------- 1 file changed, 64 deletions(-) diff --git a/miner/src/cacluate.rs b/miner/src/cacluate.rs index c28290f..6250699 100644 --- a/miner/src/cacluate.rs +++ b/miner/src/cacluate.rs @@ -124,12 +124,6 @@ pub type ThreadId = u32; /// 3.ended 为 true 的时候, 再发送消息的时候直接发送 None /// - 如果是 动态大小 的 batch pub fn schdule_threads(cli_arg: Command, out_path: PathBuf) { - // if cli_arg.batch_in_time() { - // schdule_count_batch(cli_arg, out_path); - // } else { - // schdule_time_batch(cli_arg, out_path); - // } - let mut cores = 0; let mut thread = vec![]; let mut shared_status = ComputeStatus::new(&cli_arg); let (work_sender, work_receiver) = bounded::(0); @@ -297,64 +291,6 @@ pub fn cacl( // } } -// /// 简单的部分 -// /// -// /// 固定大小的 batch 的分发函数 -// pub fn schdule_count_batch(cli_arg: Command, out_path: PathBuf) { -// let mut n = 0; -// let mut cores = 0; -// let mut threads = vec![]; -// let mut shared_status = ComputeStatus::new(&cli_arg); -// let (sender, receiver) = bounded::(0); -// for i in 0..cli_arg.thread_count { -// n += 1; -// let mut config = cli_arg.as_cacl_config(&out_path); -// // 核心亲和性: n -// config.core_affinity = Some(1 << i); -// cores |= 1 << i; -// let thread_name = format!("thread_{}", n); -// threads.push(std::thread::spawn(move || { -// info!("线程 {} 开始计算", thread_name); -// count_batch_cacl(config, &shared_status, receiver.clone()); -// info!("线程 {} 结束计算", thread_name); -// })); -// } -// crate::set_process_cores(cores); -// for t in threads { -// t.join().unwrap(); -// } -// } - -// /// 麻烦的要死的部分 -// /// -// /// 动态大小的 batch 的分发函数 -// pub fn schdule_time_batch(cli_arg: Command, out_path: PathBuf) { -// todo!("动态大小的 batch 的分发函数"); -// let mut n = 0; -// let mut cores = 0; -// let mut threads = vec![]; -// let mut shared_status = ComputeStatus::new(&cli_arg); -// let mut sended = vec![false; cli_arg.thread_count as usize]; -// let (sender, receiver) = bounded::>>(0); -// for i in 0..cli_arg.thread_count { -// n += 1; -// let mut config = cli_arg.as_cacl_config(&out_path); -// // 核心亲和性: n -// config.core_affinity = Some(1 << i); -// cores |= 1 << i; -// let thread_name = format!("thread_{}", n); -// threads.push(std::thread::spawn(move || { -// info!("线程 {} 开始计算", thread_name); -// cacl(config, &shared_status, receiver.clone()); -// info!("线程 {} 结束计算", thread_name); -// })); -// } -// crate::set_process_cores(cores); -// for t in threads { -// t.join().unwrap(); -// } -// } - /// 固定 batch 的计算函数 pub fn count_batch_cacl(config: CacluateConfig, status: &ComputeStatus, receiver: Receiver) { // 初始猜测的时间间隔