mirror of https://github.com/google/gemma.cpp.git
Update Clif wrapper to work with latest gemma.cpp and add simple example
PiperOrigin-RevId: 628134201
This commit is contained in:
parent
2d4de6b08b
commit
9e0ac5de34
|
|
@ -80,8 +80,7 @@ class AppArgs : public ArgsBase<AppArgs> {
|
||||||
void ChooseNumThreads() {
|
void ChooseNumThreads() {
|
||||||
if (num_threads == kDefaultNumThreads) {
|
if (num_threads == kDefaultNumThreads) {
|
||||||
// This is a rough heuristic, replace with something better in the future.
|
// This is a rough heuristic, replace with something better in the future.
|
||||||
num_threads = static_cast<size_t>(std::clamp(
|
num_threads = GetSupportedThreadCount();
|
||||||
static_cast<int>(std::thread::hardware_concurrency()) - 2, 1, 18));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,6 +90,11 @@ class AppArgs : public ArgsBase<AppArgs> {
|
||||||
ChooseNumThreads();
|
ChooseNumThreads();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline size_t GetSupportedThreadCount() {
|
||||||
|
return static_cast<size_t>(std::clamp(
|
||||||
|
static_cast<int>(std::thread::hardware_concurrency()) - 2, 1, 18));
|
||||||
|
}
|
||||||
|
|
||||||
Path log; // output
|
Path log; // output
|
||||||
int verbosity;
|
int verbosity;
|
||||||
size_t num_threads;
|
size_t num_threads;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue