# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import cmakeparser as cp
import copy import datetime import os import re import subprocess
LLAMA_DIR = '.'
# This program runs after pulling a new version of the llama.cpp library, # including all its CMakeLists.txt files, and runs the a cmake file parser, to # generate a source file list.
def deduplicate_into(input_dict, common_key):
sets = [set(input_dict[key]) for key in input_dict]
common_values = set.intersection(*sets)
input_dict[common_key] = list(common_values) for key in input_dict: if key != common_key:
input_dict[key] = [item for item in input_dict[key] if item notin common_values]
# llama.cpp only cares about x86 and arm if"arm"in cpu:
variables["GGML_SYSTEM_ARCH"] = "ARM" elif"x86"in cpu:
variables["GGML_SYSTEM_ARCH"] = "x86" else:
print("CPU not x86 or arm, falling back on C paths")
if system == "mac":
variables["APPLE"] = 1
variables["GGML_ACCELERATE"] = 1
all_sources = deduplicate_into(all_sources, "COMMON")
rename_rules = [
("ggml.c", "ggml-c.c"),
("ggml-cpu.c", "ggml-cpu-c.c"),
("x86/quants.c", "x86/quants-x86.c"),
("arm/quants.c", "arm/quants-arm.c"),
("x86/repack.cpp", "x86/repack-x86.cpp"),
("arm/repack.cpp", "arm/repack-arm.cpp"),
("x86/cpu-feats.c", "x86/cpu-feats-x86.c"),
("arm/cpu-feats.c", "arm/cpu-feats-x86.c"),
] for old, new in rename_rules: for source_class in all_sources: for file in all_sources[source_class]: if file.endswith(old): # rename the file in the dict, and move on disk if not already done
renamed_path = file[:-len(old)] + new
all_sources[source_class].remove(file)
all_sources[source_class].append(renamed_path) ifnot os.path.exists(renamed_path):
os.rename(file, renamed_path)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.