![]() |
LlamaLib
v2.0.2
Cross-platform library for local LLMs
|
Runtime loading and management of LLM libraries. More...
#include <fstream>#include <sstream>#include <vector>#include <iostream>#include <setjmp.h>#include <type_traits>#include <algorithm>#include <cstdlib>#include "defs.h"#include "error_handling.h"#include "LLM.h"#include <dlfcn.h>#include <unistd.h>#include <limits.h>Go to the source code of this file.
Classes | |
| class | LLMService |
| Runtime loader for LLM libraries. More... | |
Macros | |
| #define | LOAD_LIB(path) dlopen(path, RTLD_LAZY) |
| Load library macro for Unix. | |
| #define | GET_SYM(handle, name) dlsym(handle, name) |
| Get symbol macro for Unix. | |
| #define | CLOSE_LIB(handle) dlclose(handle) |
| Close library macro for Unix. | |
| #define | LLM_FUNCTIONS_LIST(M) |
| Macro defining the list of dynamically loaded LLM functions. | |
| #define | DECLARE_FN(name, ret, ...) ret (*name)(__VA_ARGS__) = nullptr; |
| Declare function pointers for dynamically loaded functions. | |
Typedefs | |
| using | LibHandle = void * |
| Unix library handle type. | |
Functions | |
| const std::string | os_library_dir () |
| Get OS-specific library directory. | |
| const std::vector< std::string > | available_architectures (bool gpu) |
| Get available architectures for the platform. | |
| std::vector< std::string > | get_default_library_env_vars () |
| Get default environment variables for library paths. | |
| const char * | Available_Architectures (bool gpu) |
| Get available architectures (C API) | |
Runtime loading and management of LLM libraries.
Provides dynamic library loading capabilities for LLM backends, architecture detection, and cross-platform library management
Definition in file LLM_runtime.h.
| #define CLOSE_LIB | ( | handle | ) | dlclose(handle) |
Close library macro for Unix.
Definition at line 45 of file LLM_runtime.h.
| #define DECLARE_FN | ( | name, | |
| ret, | |||
| ... ) ret (*name)(__VA_ARGS__) = nullptr; |
Declare function pointers for dynamically loaded functions.
Uses the LLM_FUNCTIONS_LIST macro to declare all required function pointers
Definition at line 213 of file LLM_runtime.h.
| #define GET_SYM | ( | handle, | |
| name ) dlsym(handle, name) |
Get symbol macro for Unix.
Definition at line 44 of file LLM_runtime.h.
| #define LLM_FUNCTIONS_LIST | ( | M | ) |
Macro defining the list of dynamically loaded LLM functions.
| M | Macro to apply to each function signature |
This macro is used to generate function pointer declarations and loading code
Definition at line 53 of file LLM_runtime.h.
| #define LOAD_LIB | ( | path | ) | dlopen(path, RTLD_LAZY) |
Load library macro for Unix.
Definition at line 43 of file LLM_runtime.h.
| using LibHandle = void * |
Unix library handle type.
Definition at line 42 of file LLM_runtime.h.
| const std::vector< std::string > available_architectures | ( | bool | gpu | ) |
Get available architectures for the platform.
| gpu | Whether to include GPU-enabled architectures |
Detects available CPU/GPU architectures for library selection
Definition at line 23 of file LLM_runtime.cpp.
| std::vector< std::string > get_default_library_env_vars | ( | ) |
Get default environment variables for library paths.
Returns platform-specific environment variables used for library loading
Definition at line 108 of file LLM_runtime.cpp.
| const std::string os_library_dir | ( | ) |
Get OS-specific library directory.
Returns the appropriate library directory for the current operating system