mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-31 15:00:28 +00:00
Fix small matters and improve sysconf()
- Fix mkdeps.com out of memory error - Remove static memory from __get_cpu_count() - Add support for passing hyphen to cat in cocmd - Change more ZipOS errors from ENOTSUP to EROFS - Specify mem_unit in sysinfo() output on BSD OSes
This commit is contained in:
parent
eebc24b9cd
commit
3a9cac4892
55 changed files with 411 additions and 262 deletions
2
third_party/ggml/common.cc
vendored
2
third_party/ggml/common.cc
vendored
|
@ -88,7 +88,7 @@ static bool append_file_to_prompt(const char *path, gpt_params & params) {
|
|||
}
|
||||
|
||||
bool gpt_params_parse(int argc, char ** argv, gpt_params & params) {
|
||||
params.n_threads = std::min(20, std::max(1, _getcpucount() >> 1));
|
||||
params.n_threads = std::min(20., (unsigned)__get_cpu_count() * .75);
|
||||
|
||||
bool invalid_param = false;
|
||||
std::string arg;
|
||||
|
|
2
third_party/ggml/common.h
vendored
2
third_party/ggml/common.h
vendored
|
@ -21,7 +21,7 @@
|
|||
struct gpt_params {
|
||||
int32_t seed = -1; // RNG seed
|
||||
int32_t verbose = 0; // Logging verbosity
|
||||
int32_t n_threads = std::max(1, _getcpucount() >> 1);
|
||||
int32_t n_threads = std::max(20., (unsigned)__get_cpu_count() * .75);
|
||||
int32_t n_predict = -1; // new tokens to predict
|
||||
int32_t n_parts = -1; // amount of model parts (-1 = determine from model dimensions)
|
||||
int32_t n_ctx = 512; // context size
|
||||
|
|
2
third_party/ggml/quantize.cc
vendored
2
third_party/ggml/quantize.cc
vendored
|
@ -92,7 +92,7 @@ int main(int argc, char ** argv) {
|
|||
ftype = (enum llama_ftype)atoi(argv[3]);
|
||||
}
|
||||
|
||||
int nthread = argc > 4 ? atoi(argv[4]) : std::min(20, std::max(1, _getcpucount() >> 1));
|
||||
int nthread = argc > 4 ? atoi(argv[4]) : std::min(20, std::max(1, __get_cpu_count() >> 1));
|
||||
|
||||
const int64_t t_main_start_us = ggml_time_us();
|
||||
|
||||
|
|
2
third_party/lua/lunix.c
vendored
2
third_party/lua/lunix.c
vendored
|
@ -3532,7 +3532,7 @@ int LuaUnix(lua_State *L) {
|
|||
LuaSetIntField(L, "RUSAGE_CHILDREN", RUSAGE_CHILDREN);
|
||||
LuaSetIntField(L, "RUSAGE_BOTH", RUSAGE_BOTH);
|
||||
|
||||
LuaSetIntField(L, "ARG_MAX", __arg_max());
|
||||
LuaSetIntField(L, "ARG_MAX", __get_arg_max());
|
||||
LuaSetIntField(L, "BUFSIZ", BUFSIZ);
|
||||
LuaSetIntField(L, "CLK_TCK", CLK_TCK);
|
||||
LuaSetIntField(L, "NAME_MAX", _NAME_MAX);
|
||||
|
|
2
third_party/python/Modules/posixmodule.c
vendored
2
third_party/python/Modules/posixmodule.c
vendored
|
@ -10509,7 +10509,7 @@ os_cpu_count_impl(PyObject *module)
|
|||
/*[clinic end generated code: output=5fc29463c3936a9c input=e7c8f4ba6dbbadd3]*/
|
||||
{
|
||||
int ncpu;
|
||||
ncpu = _getcpucount();
|
||||
ncpu = __get_cpu_count();
|
||||
if (ncpu >= 1)
|
||||
return PyLong_FromLong(ncpu);
|
||||
else
|
||||
|
|
2
third_party/radpajama/common-gptneox.cc
vendored
2
third_party/radpajama/common-gptneox.cc
vendored
|
@ -39,7 +39,7 @@
|
|||
// clang-format off
|
||||
|
||||
bool gpt_params_parse(int argc, char ** argv, gpt_params & params) {
|
||||
params.n_threads = std::min(20, std::max(1, (int)(_getcpucount() * 0.75)));
|
||||
params.n_threads = std::min(20., (unsigned)__get_cpu_count() * 0.75);
|
||||
|
||||
bool invalid_param = false;
|
||||
std::string arg;
|
||||
|
|
2
third_party/radpajama/common-gptneox.h
vendored
2
third_party/radpajama/common-gptneox.h
vendored
|
@ -19,7 +19,7 @@
|
|||
|
||||
struct gpt_params {
|
||||
int32_t seed = -1; // RNG seed
|
||||
int32_t n_threads = MIN(4, (int32_t) _getcpucount() * 0.75);
|
||||
int32_t n_threads = MIN(20., (unsigned) __get_cpu_count() * 0.75);
|
||||
int32_t n_predict = 128; // new tokens to predict
|
||||
int32_t n_parts = -1; // amount of model parts (-1 = determine from model dimensions)
|
||||
int32_t n_ctx = 512; // context size
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue