Skip to content

Bugfix: -t thread count ignored in correct_round1 #13

Open
qiyuanhuakai wants to merge 1 commit intoLuoGroup2023:masterfrom
qiyuanhuakai:qiyuanhuakai-fix-correct-round1-threads
Open

Bugfix: -t thread count ignored in correct_round1 #13
qiyuanhuakai wants to merge 1 commit intoLuoGroup2023:masterfrom
qiyuanhuakai:qiyuanhuakai-fix-correct-round1-threads

Conversation

@qiyuanhuakai
Copy link

@qiyuanhuakai qiyuanhuakai commented Dec 26, 2025

Summary / 概述

correct_round1 ignores the user-specified -t value when generating recorrected.fa and uses all available CPU cores.
correct_round1 在生成 recorrected.fa 时没有使用用户通过 -t 指定的线程数,而是占用所有可用 CPU 核心。

Reproduction / 复现方式

  1. Run DeChat with -t 16

  2. Check CPU usage during the first polish stage (correct_round1)

  3. It uses all cores instead of 16 threads

  4. 使用 -t 16 运行 DeChat

  5. 观察第一次 polish(correct_round1)阶段的 CPU 使用情况

  6. 实际会使用全部核心,而不是 16 线程

屏幕截图 2025-12-26 223153

Root cause / 原因

Dispatcher(threads) uses a global threads (default 0), and 0 means "use all cores" in GATB Dispatcher. chat_opt->thread_num was not applied.
Dispatcher(threads) 实际使用了全局 threads(默认 0),而 0 在 GATB Dispatcher 中表示“自动使用全部核心”。chat_opt->thread_num 没有被用于设置线程数。

Fix / 修复

Define a local threads in correct_round1(chat_opt_t *chat_opt) and set it to chat_opt->thread_num, so Dispatcher respects -t/.
correct_round1(chat_opt_t *chat_opt) 内新增局部变量 threads = chat_opt->thread_num,使 Dispatcher-t 运行。

After fix / 修复后

屏幕截图 2025-12-26 222520

Fixed:When users specify the thread count via -t, the correct_round1 stage does not honor the user-provided value while generating recorrected.fa. Instead, it uses all available CPU cores, making the thread setting ineffective.
修复:当用户通过 -t指定线程数时,correct_round1 阶段在生成/写入 recorrected.fa 的过程中没有按用户设置的线程数运行,而是会占用机器所有可用 CPU 核心,导致线程参数实际失效。
@qiyuanhuakai qiyuanhuakai changed the title Update correct_round1.h Bugfix: -t thread count ignored in correct_round1 Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant