build settings

This commit is contained in:
Henri Vasserman 2023-06-11 16:32:53 +03:00
parent 9612d12fbf
commit 6518f9c482
No known key found for this signature in database
GPG key ID: 2995FC0F58B1A986
4 changed files with 12 additions and 2 deletions

1
.gitignore vendored
View file

@ -34,6 +34,7 @@ models/*
/embedding
/benchmark-matmult
/vdot
/server
/Pipfile
/libllama.so

View file

@ -3,6 +3,8 @@ BUILD_TARGETS = main quantize quantize-stats perplexity embedding vdot
ifdef LLAMA_BUILD_SERVER
BUILD_TARGETS += server
LLAMA_SERVER_VERBOSE ?= 1
server: CXXFLAGS += -DSERVER_VERBOSE=$(LLAMA_SERVER_VERBOSE)
endif
default: $(BUILD_TARGETS)

View file

@ -1,4 +1,5 @@
set(TARGET server)
option(LLAMA_SERVER_VERBOSE "Build verbose logging option for Server" ON)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(${TARGET} server.cpp json.hpp httplib.h)
target_compile_definitions(${TARGET} PRIVATE
@ -8,6 +9,8 @@ target_compile_definitions(${TARGET} PRIVATE
$<$<CONFIG:Debug>:
CPPHTTPLIB_NO_EXCEPTIONS=1
>
SERVER_VERBOSE=$<BOOL:${LLAMA_SERVER_VERBOSE}>
)
target_link_libraries(${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT})
target_compile_features(${TARGET} PRIVATE cxx_std_11)

View file

@ -5,6 +5,10 @@
#include "httplib.h"
#include "json.hpp"
#ifndef SERVER_VERBOSE
#define SERVER_VERBOSE 1
#endif
using namespace httplib;
using json = nlohmann::json;
@ -553,7 +557,7 @@ void server_params_parse(int argc, char ** argv, server_params & sparams,
params.lora_base = argv[i];
} else if (arg == "-v" || arg == "--verbose") {
sparams.verbose = true;
#ifndef SERVER_VERBOSE
#if SERVER_VERBOSE != 1
LOG_WARNING("server.cpp is not built with verbose logging.", {});
#endif
} else if (arg == "--mlock") {
@ -743,7 +747,7 @@ int main(int argc, char ** argv) {
server_params_parse(argc, argv, sparams, params);
#ifdef SERVER_VERBOSE
#if SERVER_VERBOSE == 1
server_verbose = sparams.verbose;
#endif