Skip to content

Commit c506d7f

Browse files
max-krasnyanskyfmz
authored andcommitted
threadpool: enable --cpu-mask and other threadpool related options only if threadpool is enabled
1 parent f64c975 commit c506d7f

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
@@ -1707,39 +1707,38 @@ void gpt_params_print_usage(int /*argc*/, char ** argv, const gpt_params & param
17071707
options.push_back({ "*", "-co, --color", "colorise output to distinguish prompt and user input from generations (default: %s)", params.use_color ? "true" : "false" });
17081708
options.push_back({ "*", "-s, --seed SEED", "RNG seed (default: %d, use random seed for < 0)", params.seed });
17091709
options.push_back({ "*", "-t, --threads N", "number of threads to use during generation (default: %d)", params.cpuparams.n_threads });
1710-
options.push_back({ "*", "-C, --cpu-mask M", "CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"});
1711-
options.push_back({ "*", "-Cr, --cpu-range lo-hi", "range of CPUs for affinity. Complements --cpu-mask"});
1712-
options.push_back({ "*", " --cpu-strict <0|1>", "use strict CPU placement (default: %u)\n", (unsigned) params.cpuparams.strict_cpu});
1713-
options.push_back({ "*", " --priority N", "set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: %d)\n", params.cpuparams.priority});
1714-
options.push_back({ "*", " --poll <0...100>", "use polling level to wait for work (0 - no polling, default: %u)\n", (unsigned) params.cpuparams.poll});
17151710
options.push_back({ "*", "-tb, --threads-batch N", "number of threads to use during batch and prompt processing (default: same as --threads)" });
1716-
options.push_back({ "*", "-Cb, --cpu-mask-batch M", "CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"});
1717-
options.push_back({ "*", "-Crb, --cpu-range-batch lo-hi",
1718-
"ranges of CPUs for affinity. Complements --cpu-mask-batch"});
1719-
options.push_back({ "*", " --cpu-strict-batch <0|1>",
1720-
"use strict CPU placement (default: same as --cpu-strict)"});
1721-
options.push_back({ "*", " --priority-batch N", "set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: --priority)"});
1722-
options.push_back({ "*", " --poll-batch <0|1>", "use polling to wait for work (default: same as --poll"});
17231711
options.push_back({ "speculative", "-td, --threads-draft N", "number of threads to use during generation (default: same as --threads)" });
1724-
options.push_back({ "speculative", "-Cd, --cpu-mask-draft M", "Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask)"});
1725-
options.push_back({ "speculative", "-Crd, --cpu-range-draft lo-hi",
1726-
"Ranges of CPUs for affinity. Complements --cpu-mask-draft"});
1727-
options.push_back({ "speculative", " --cpu-strict-draft <0|1>",
1728-
"Use strict CPU placement for draft model (default: same as --cpu-strict)"});
1729-
options.push_back({ "speculative", " --priority-draft N", "Set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: same as --priority)"});
1730-
options.push_back({ "speculative", " --poll-draft <0|1>", "Use polling to wait for draft model work (default: same as --poll])"});
1731-
options.push_back({ "speculative", "-tbd, --threads-batch-draft N",
1732-
"number of threads to use during batch and prompt processing (default: same as --threads-draft)" });
1733-
options.push_back({ "speculative", "-Cbd, --cpu-mask-batch-draft M",
1734-
"Draft model CPU affinity mask. Complements cpu-range-draft-batch (default: same as --cpu-mask-draft)"});
1712+
options.push_back({ "speculative", "-tbd, --threads-batch-draft N","number of threads to use during batch and prompt processing (default: same as --threads-draft)" });
1713+
1714+
#ifndef GGML_USE_OPENMP
1715+
// these options are available only with the internal threadpool
1716+
options.push_back({ "*", "-C, --cpu-mask M", "CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: \"\")"});
1717+
options.push_back({ "*", "-Cr, --cpu-range lo-hi", "range of CPUs for affinity. Complements --cpu-mask"});
1718+
options.push_back({ "*", " --cpu-strict <0|1>", "use strict CPU placement (default: %u)\n", (unsigned) params.cpuparams.strict_cpu});
1719+
options.push_back({ "*", " --priority N", "set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: %d)\n", params.cpuparams.priority});
1720+
options.push_back({ "*", " --poll <0...100>", "use polling level to wait for work (0 - no polling, default: %u)\n", (unsigned) params.cpuparams.poll});
1721+
1722+
options.push_back({ "*", "-Cb, --cpu-mask-batch M", "CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)"});
1723+
options.push_back({ "*", "-Crb, --cpu-range-batch lo-hi", "ranges of CPUs for affinity. Complements --cpu-mask-batch"});
1724+
options.push_back({ "*", " --cpu-strict-batch <0|1>","use strict CPU placement (default: same as --cpu-strict)"});
1725+
options.push_back({ "*", " --priority-batch N", "set process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: --priority)"});
1726+
options.push_back({ "*", " --poll-batch <0|1>", "use polling to wait for work (default: same as --poll"});
1727+
1728+
options.push_back({ "speculative", "-Cd, --cpu-mask-draft M", "Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask)"});
1729+
options.push_back({ "speculative", "-Crd, --cpu-range-draft lo-hi", "Ranges of CPUs for affinity. Complements --cpu-mask-draft"});
1730+
options.push_back({ "speculative", " --cpu-strict-draft <0|1>","Use strict CPU placement for draft model (default: same as --cpu-strict)"});
1731+
options.push_back({ "speculative", " --priority-draft N", "Set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: same as --priority)"});
1732+
options.push_back({ "speculative", " --poll-draft <0|1>", "Use polling to wait for draft model work (default: same as --poll])"});
1733+
1734+
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)"});
17351735
options.push_back({ "speculative", "-Crbd, --cpu-range-batch-draft lo-hi",
1736-
"Ranges of CPUs for affinity. Complements --cpu-mask-draft-batch)"});
1736+
"Ranges of CPUs for affinity. Complements --cpu-mask-draft-batch)"});
17371737
options.push_back({ "speculative", " --cpu-strict-batch-draft <0|1>",
1738-
"Use strict CPU placement for draft model (default: --cpu-strict-draft)"});
1739-
options.push_back({ "speculative", " --priority-batch-draft N",
1740-
"Set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: --priority-draft)"});
1741-
options.push_back({ "speculative", " --poll-batch-draft <0|1>",
1742-
"Use polling to wait for draft model work (default: --poll-draft)"});
1738+
"Use strict CPU placement for draft model (default: --cpu-strict-draft)"});
1739+
options.push_back({ "speculative", " --priority-batch-draft N","Set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: --priority-draft)"});
1740+
options.push_back({ "speculative", " --poll-batch-draft <0|1>","Use polling to wait for draft model work (default: --poll-draft)"});
1741+
#endif // GGML_USE_OPENMP
17431742

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

0 commit comments

Comments
 (0)