llama-cpp-cublas.srpm.spec 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # SRPM for building from source and packaging an RPM for RPM-based distros.
  2. # https://fedoraproject.org/wiki/How_to_create_an_RPM_package
  3. # Built and maintained by John Boero - boeroboy@gmail.com
  4. # In honor of Seth Vidal https://www.redhat.com/it/blog/thank-you-seth-vidal
  5. # Notes for llama.cpp:
  6. # 1. Tags are currently based on hash - which will not sort asciibetically.
  7. # We need to declare standard versioning if people want to sort latest releases.
  8. # 2. Builds for CUDA/OpenCL support are separate, with different depenedencies.
  9. # 3. NVidia's developer repo must be enabled with nvcc, cublas, clblas, etc installed.
  10. # Example: https://developer.download.nvidia.com/compute/cuda/repos/fedora37/x86_64/cuda-fedora37.repo
  11. # 4. OpenCL/CLBLAST support simply requires the ICD loader and basic opencl libraries.
  12. # It is up to the user to install the correct vendor-specific support.
  13. Name: llama.cpp-cublas
  14. Version: %( date "+%%Y%%m%%d" )
  15. Release: 1%{?dist}
  16. Summary: CPU Inference of LLaMA model in pure C/C++ (no CUDA/OpenCL)
  17. License: MIT
  18. Source0: https://github.com/ggerganov/llama.cpp/archive/refs/heads/master.tar.gz
  19. BuildRequires: coreutils make gcc-c++ git cuda-toolkit
  20. Requires: cuda-toolkit
  21. URL: https://github.com/ggerganov/llama.cpp
  22. %define debug_package %{nil}
  23. %define source_date_epoch_from_changelog 0
  24. %description
  25. CPU inference for Meta's Lllama2 models using default options.
  26. %prep
  27. %setup -n llama.cpp-master
  28. %build
  29. make -j LLAMA_CUBLAS=1
  30. %install
  31. mkdir -p %{buildroot}%{_bindir}/
  32. cp -p main %{buildroot}%{_bindir}/llamacppcublas
  33. cp -p server %{buildroot}%{_bindir}/llamacppcublasserver
  34. cp -p simple %{buildroot}%{_bindir}/llamacppcublassimple
  35. mkdir -p %{buildroot}/usr/lib/systemd/system
  36. %{__cat} <<EOF > %{buildroot}/usr/lib/systemd/system/llamacublas.service
  37. [Unit]
  38. Description=Llama.cpp server, CPU only (no GPU support in this build).
  39. After=syslog.target network.target local-fs.target remote-fs.target nss-lookup.target
  40. [Service]
  41. Type=simple
  42. EnvironmentFile=/etc/sysconfig/llama
  43. ExecStart=/usr/bin/llamacppcublasserver $LLAMA_ARGS
  44. ExecReload=/bin/kill -s HUP $MAINPID
  45. Restart=never
  46. [Install]
  47. WantedBy=default.target
  48. EOF
  49. mkdir -p %{buildroot}/etc/sysconfig
  50. %{__cat} <<EOF > %{buildroot}/etc/sysconfig/llama
  51. LLAMA_ARGS="-m /opt/llama2/ggml-model-f32.bin"
  52. EOF
  53. %clean
  54. rm -rf %{buildroot}
  55. rm -rf %{_builddir}/*
  56. %files
  57. %{_bindir}/llamacppcublas
  58. %{_bindir}/llamacppcublasserver
  59. %{_bindir}/llamacppcublassimple
  60. /usr/lib/systemd/system/llamacublas.service
  61. %config /etc/sysconfig/llama
  62. %pre
  63. %post
  64. %preun
  65. %postun
  66. %changelog