Skip to content

Commit 68ade91

Browse files
committed
feat: optional network turbo.
1 parent 8909be9 commit 68ade91

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/app.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ AppCliArgs AppCliArgs::parse(int argc, char* *argv, bool requireMode) {
4141
args.seed = (unsigned long long)time(nullptr);
4242
args.chatTemplateType = TEMPLATE_UNKNOWN;
4343
args.maxSeqLen = 0;
44+
args.netTurbo = true;
4445
args.gpuIndex = -1;
4546
int i = 1;
4647
if (requireMode && argc > 1) {
@@ -108,6 +109,8 @@ AppCliArgs AppCliArgs::parse(int argc, char* *argv, bool requireMode) {
108109
args.maxSeqLen = (unsigned int)atoi(value);
109110
} else if (std::strcmp(name, "--gpu-index") == 0) {
110111
args.gpuIndex = atoi(value);
112+
} else if (std::strcmp(name, "--net-turbo") == 0) {
113+
args.netTurbo = atoi(value) == 1;
111114
} else {
112115
throw std::runtime_error("Unknown option: " + std::string(name));
113116
}
@@ -252,7 +255,10 @@ void runInferenceApp(AppCliArgs *args, void (*handler)(AppInferenceContext *cont
252255

253256
if (network != nullptr) {
254257
network->resetStats();
255-
network->setTurbo(true);
258+
if (args->netTurbo) {
259+
network->setTurbo(true);
260+
printf("🚁 Network is in non-blocking mode\n");
261+
}
256262
}
257263

258264
AppInferenceContext context;
@@ -313,7 +319,7 @@ void runWorkerApp(AppCliArgs *args) {
313319
if (inference.isFinished)
314320
break;
315321

316-
if (!isTurboEnabled) {
322+
if (args->netTurbo && !isTurboEnabled) {
317323
network->setTurbo(true);
318324
isTurboEnabled = true;
319325
printf("🚁 Network is in non-blocking mode\n");

src/app.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class AppCliArgs {
2929
unsigned long long seed;
3030
ChatTemplateType chatTemplateType;
3131
NnUint maxSeqLen;
32+
bool netTurbo;
3233
int gpuIndex;
3334

3435
// worker

0 commit comments

Comments
 (0)