KBaba7/llama.cpp
0
1# SRPM for building from source and packaging an RPM for RPM-based distros.2# https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages3# Built and maintained by John Boero - boeroboy@gmail.com4# In honor of Seth Vidal https://www.redhat.com/it/blog/thank-you-seth-vidal5 6# Notes for llama.cpp:7# 1. Tags are currently based on hash - which will not sort asciibetically.8# We need to declare standard versioning if people want to sort latest releases.9# 2. Builds for CUDA/OpenCL support are separate, with different depenedencies.10# 3. NVidia's developer repo must be enabled with nvcc, cublas, clblas, etc installed.11# Example: https://developer.download.nvidia.com/compute/cuda/repos/fedora37/x86_64/cuda-fedora37.repo12# 4. OpenCL/CLBLAST support simply requires the ICD loader and basic opencl libraries.13# It is up to the user to install the correct vendor-specific support.14 15Name: llama.cpp-cuda16Version: %( date "+%%Y%%m%%d" )17Release: 1%{?dist}18Summary: CPU Inference of LLaMA model in pure C/C++ (no CUDA/OpenCL)19License: MIT20Source0: https://github.com/ggerganov/llama.cpp/archive/refs/heads/master.tar.gz21BuildRequires: coreutils make gcc-c++ git cuda-toolkit22Requires: cuda-toolkit23URL: https://github.com/ggerganov/llama.cpp24 25%define debug_package %{nil}26%define source_date_epoch_from_changelog 027 28%description29CPU inference for Meta's Lllama2 models using default options.30 31%prep32%setup -n llama.cpp-master33 34%build35make -j GGML_CUDA=136 37%install38mkdir -p %{buildroot}%{_bindir}/39cp -p llama-cli %{buildroot}%{_bindir}/llama-cuda-cli40cp -p llama-server %{buildroot}%{_bindir}/llama-cuda-server41cp -p llama-simple %{buildroot}%{_bindir}/llama-cuda-simple42 43mkdir -p %{buildroot}/usr/lib/systemd/system44%{__cat} <<EOF > %{buildroot}/usr/lib/systemd/system/llamacuda.service45[Unit]46Description=Llama.cpp server, CPU only (no GPU support in this build).47After=syslog.target network.target local-fs.target remote-fs.target nss-lookup.target48 49[Service]50Type=simple51EnvironmentFile=/etc/sysconfig/llama52ExecStart=/usr/bin/llama-cuda-server $LLAMA_ARGS53ExecReload=/bin/kill -s HUP $MAINPID54Restart=never55 56[Install]57WantedBy=default.target58EOF59 60mkdir -p %{buildroot}/etc/sysconfig61%{__cat} <<EOF > %{buildroot}/etc/sysconfig/llama62LLAMA_ARGS="-m /opt/llama2/ggml-model-f32.bin"63EOF64 65%clean66rm -rf %{buildroot}67rm -rf %{_builddir}/*68 69%files70%{_bindir}/llama-cuda-cli71%{_bindir}/llama-cuda-server72%{_bindir}/llama-cuda-simple73/usr/lib/systemd/system/llamacuda.service74%config /etc/sysconfig/llama75 76%pre77 78%post79 80%preun81%postun82 83%changelog84 