Skip to content

Distribute and run LLMs with a single file.

Make some quick fixes

Justine Tunneybffd3938855b
diff --git a/llama.cpp/common.cc b/llama.cpp/common.cc
index 673a3721..b5d19c7c 100644
--- a/llama.cpp/common.cc
+++ b/llama.cpp/common.cc
@@ -841,7 +841,6 @@ void gpt_print_usage(int /*argc*/, char ** argv, const gpt_params & params) {
printf(" --numa attempt optimizations that help on some NUMA systems\n");
printf(" if run without this previously, it is recommended to drop the system page cache before using this\n");
printf(" see https://github.com/ggerganov/llama.cpp/issues/1437\n");
- if (ggml_metal_supported() || ggml_cuda_supported()) {
printf(" -ngl N, --n-gpu-layers N\n");
printf(" number of layers to store in VRAM\n");
printf(" -ngld N, --n-gpu-layers-draft N\n");
@@ -849,12 +848,9 @@ void gpt_print_usage(int /*argc*/, char ** argv, const gpt_params & params) {
printf(" -ts SPLIT --tensor-split SPLIT\n");
printf(" how to split tensors across multiple GPUs, comma-separated list of proportions, e.g. 3,1\n");
printf(" -mg i, --main-gpu i the GPU to use for scratch and small tensors\n");
- if (ggml_cuda_supported()) {
printf(" -nommq, --no-mul-mat-q\n");
printf(" use " GGML_CUBLAS_NAME " instead of custom mul_mat_q " GGML_CUDA_NAME " kernels.\n");
printf(" Not recommended since this is both slower and uses more VRAM.\n");
- }
- }
printf(" --verbose-prompt print prompt before generation\n");
printf(" --simple-io use basic IO for better compatibility in subprocesses and limited consoles\n");
printf(" --lora FNAME apply LoRA adapter (implies --no-mmap)\n");
diff --git a/llama.cpp/llama.cc b/llama.cpp/llama.cc
index 76a13276..19f4b93a 100644
--- a/llama.cpp/llama.cc
+++ b/llama.cpp/llama.cc
@@ -902,14 +902,14 @@ struct llama_mlock {
return (size_t) sysconf(_SC_PAGESIZE);
}
- #ifdef __APPLE__
- #define MLOCK_SUGGESTION \
- "Try increasing the sysctl values 'vm.user_wire_limit' and 'vm.global_user_wire_limit' and/or " \
- "decreasing 'vm.global_no_user_wire_amount'. Also try increasing RLIMIT_MLOCK (ulimit -l).\n"
- #else
- #define MLOCK_SUGGESTION \
- "Try increasing RLIMIT_MLOCK ('ulimit -l' as root).\n"
- #endif
+ static const char *get_mlock_suggestion() {
+ if (IsXnu()) {
+ return "Try increasing the sysctl values 'vm.user_wire_limit' and 'vm.global_user_wire_limit' and/or "
+ "decreasing 'vm.global_no_user_wire_amount'. Also try increasing RLIMIT_MLOCK (ulimit -l).\n";
+ } else {
+ return "Try increasing RLIMIT_MLOCK ('ulimit -l' as root).\n";
+ }
+ }
bool raw_lock(const void * addr, size_t size) const {
if (!mlock(addr, size)) {
@@ -929,12 +929,10 @@ struct llama_mlock {
}
fprintf(stderr, "warning: failed to mlock %zu-byte buffer (after previously locking %zu bytes): %s\n%s",
- size, this->size, errmsg, suggest ? MLOCK_SUGGESTION : "");
+ size, this->size, errmsg, suggest ? get_mlock_suggestion() : "");
return false;
}
- #undef MLOCK_SUGGESTION
-
static void raw_unlock(void * addr, size_t size) {
if (munlock(addr, size)) {
fprintf(stderr, "warning: failed to munlock buffer: %s\n", std::strerror(errno));