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() {
|
||||
if (num_threads == kDefaultNumThreads) {
|
||||
// This is a rough heuristic, replace with something better in the future.
|
||||
num_threads = static_cast<size_t>(std::clamp(
|
||||
static_cast<int>(std::thread::hardware_concurrency()) - 2, 1, 18));
|
||||
num_threads = GetSupportedThreadCount();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -91,6 +90,11 @@ class AppArgs : public ArgsBase<AppArgs> {
|
|||
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
|
||||
int verbosity;
|
||||
size_t num_threads;
|
||||
|
|
|
|||
Loading…
Reference in New Issue