Skip to content

Commit a30c3d8

Browse files
threadpool: enable --cpu-mask and other threadpool related options only if threadpool is enabled
1 parent daf7281 commit a30c3d8

File tree

1 file changed

+28
-29
lines changed

1 file changed

+28
-29
lines changed

common/common.cpp

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,39 +1700,38 @@ void gpt_params_print_usage(int /*argc*/, char ** argv, const gpt_params & param
17001700
options.push_back({ "*", "-co, --color", "colorise output to distinguish prompt and user input from generations (default: %s)", params.use_color ? "true" : "false" });
17011701
options.push_back({ "*", "-s, --seed SEED", "RNG seed (default: %d, use random seed for < 0)", params.seed });
17021702
options.push_back({ "*", "-t, --threads N", "number of threads to use during generation (default: %d)", params.cpuparams.n_threads });
1703-
options.push_back({ "*", "-C, --cpu-mask M", "CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"});
1704-
options.push_back({ "*", "-Cr, --cpu-range lo-hi", "range of CPUs for affinity. Complements --cpu-mask"});
1705-
options.push_back({ "*", " --cpu-strict <0|1>", "use strict CPU placement (default: %u)\n", (unsigned) params.cpuparams.strict_cpu});
1706-
options.push_back({ "*", " --priority N", "set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: %d)\n", params.cpuparams.priority});
1707-
options.push_back({ "*", " --poll <0...100>", "use polling level to wait for work (0 - no polling, default: %u)\n", (unsigned) params.cpuparams.poll});
17081703
options.push_back({ "*", "-tb, --threads-batch N", "number of threads to use during batch and prompt processing (default: same as --threads)" });
1709-
options.push_back({ "*", "-Cb, --cpu-mask-batch M", "CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"});
1710-
options.push_back({ "*", "-Crb, --cpu-range-batch lo-hi",
1711-
"ranges of CPUs for affinity. Complements --cpu-mask-batch"});
1712-
options.push_back({ "*", " --cpu-strict-batch <0|1>",
1713-
"use strict CPU placement (default: same as --cpu-strict)"});
1714-
options.push_back({ "*", " --priority-batch N", "set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: --priority)"});
1715-
options.push_back({ "*", " --poll-batch <0|1>", "use polling to wait for work (default: same as --poll"});
17161704
options.push_back({ "speculative", "-td, --threads-draft N", "number of threads to use during generation (default: same as --threads)" });
1717-
options.push_back({ "speculative", "-Cd, --cpu-mask-draft M", "Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask)"});
1718-
options.push_back({ "speculative", "-Crd, --cpu-range-draft lo-hi",
1719-
"Ranges of CPUs for affinity. Complements --cpu-mask-draft"});
1720-
options.push_back({ "speculative", " --cpu-strict-draft <0|1>",
1721-
"Use strict CPU placement for draft model (default: same as --cpu-strict)"});
1722-
options.push_back({ "speculative", " --priority-draft N", "Set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: same as --priority)"});
1723-
options.push_back({ "speculative", " --poll-draft <0|1>", "Use polling to wait for draft model work (default: same as --poll])"});
1724-
options.push_back({ "speculative", "-tbd, --threads-batch-draft N",
1725-
"number of threads to use during batch and prompt processing (default: same as --threads-draft)" });
1726-
options.push_back({ "speculative", "-Cbd, --cpu-mask-batch-draft M",
1727-
"Draft model CPU affinity mask. Complements cpu-range-draft-batch (default: same as --cpu-mask-draft)"});
1705+
options.push_back({ "speculative", "-tbd, --threads-batch-draft N","number of threads to use during batch and prompt processing (default: same as --threads-draft)" });
1706+
1707+
#ifndef GGML_USE_OPENMP
1708+
// these options are available only with the internal threadpool
1709+
options.push_back({ "*", "-C, --cpu-mask M", "CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"});
1710+
options.push_back({ "*", "-Cr, --cpu-range lo-hi", "range of CPUs for affinity. Complements --cpu-mask"});
1711+
options.push_back({ "*", " --cpu-strict <0|1>", "use strict CPU placement (default: %u)\n", (unsigned) params.cpuparams.strict_cpu});
1712+
options.push_back({ "*", " --priority N", "set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: %d)\n", params.cpuparams.priority});
1713+
options.push_back({ "*", " --poll <0...100>", "use polling level to wait for work (0 - no polling, default: %u)\n", (unsigned) params.cpuparams.poll});
1714+
1715+
options.push_back({ "*", "-Cb, --cpu-mask-batch M", "CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"});
1716+
options.push_back({ "*", "-Crb, --cpu-range-batch lo-hi", "ranges of CPUs for affinity. Complements --cpu-mask-batch"});
1717+
options.push_back({ "*", " --cpu-strict-batch <0|1>","use strict CPU placement (default: same as --cpu-strict)"});
1718+
options.push_back({ "*", " --priority-batch N", "set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: --priority)"});
1719+
options.push_back({ "*", " --poll-batch <0|1>", "use polling to wait for work (default: same as --poll"});
1720+
1721+
options.push_back({ "speculative", "-Cd, --cpu-mask-draft M", "Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask)"});
1722+
options.push_back({ "speculative", "-Crd, --cpu-range-draft lo-hi", "Ranges of CPUs for affinity. Complements --cpu-mask-draft"});
1723+
options.push_back({ "speculative", " --cpu-strict-draft <0|1>","Use strict CPU placement for draft model (default: same as --cpu-strict)"});
1724+
options.push_back({ "speculative", " --priority-draft N", "Set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: same as --priority)"});
1725+
options.push_back({ "speculative", " --poll-draft <0|1>", "Use polling to wait for draft model work (default: same as --poll])"});
1726+
1727+
options.push_back({ "speculative", "-Cbd, --cpu-mask-batch-draft M","Draft model CPU affinity mask. Complements cpu-range-draft-batch (default: same as --cpu-mask-draft)"});
17281728
options.push_back({ "speculative", "-Crbd, --cpu-range-batch-draft lo-hi",
1729-
"Ranges of CPUs for affinity. Complements --cpu-mask-draft-batch)"});
1729+
"Ranges of CPUs for affinity. Complements --cpu-mask-draft-batch)"});
17301730
options.push_back({ "speculative", " --cpu-strict-batch-draft <0|1>",
1731-
"Use strict CPU placement for draft model (default: --cpu-strict-draft)"});
1732-
options.push_back({ "speculative", " --priority-batch-draft N",
1733-
"Set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: --priority-draft)"});
1734-
options.push_back({ "speculative", " --poll-batch-draft <0|1>",
1735-
"Use polling to wait for draft model work (default: --poll-draft)"});
1731+
"Use strict CPU placement for draft model (default: --cpu-strict-draft)"});
1732+
options.push_back({ "speculative", " --priority-batch-draft N","Set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: --priority-draft)"});
1733+
options.push_back({ "speculative", " --poll-batch-draft <0|1>","Use polling to wait for draft model work (default: --poll-draft)"});
1734+
#endif // GGML_USE_OPENMP
17361735

17371736
options.push_back({ "speculative", " --draft N", "number of tokens to draft for speculative decoding (default: %d)", params.n_draft });
17381737
options.push_back({ "speculative", "-ps, --p-split N", "speculative decoding split probability (default: %.1f)", (double)params.p_split });

0 commit comments

Comments
 (0)