ollama: add v0.3.9, and cuda variant (#46204)

Signed-off-by: Teague Sterling <teaguesterling@gmail.com>
Co-authored-by: brettviren <brettviren@users.noreply.github.com>
Co-authored-by: Teague Sterling <teaguesterling@gmail.com>
This commit is contained in:
Brett Viren 2024-09-27 04:13:54 -04:00 committed by GitHub
parent a835a0ed31
commit 3637c087c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,41 +7,44 @@
from spack.package import *
class Ollama(GoPackage):
class Ollama(GoPackage, CudaPackage):
"""Run Llama 2, Code Llama, and other models. Customize and create your own."""
homepage = "https://ollama.com"
git = "https://github.com/ollama/ollama.git"
maintainers("teaguesterling")
maintainers("teaguesterling", "brettviren")
# We're using commit IDs because the `go generate` process will fail for some
# dependencies that expect to be within a git repo. This is also an issue with
# cached downloads, but I don't know how to fix that yet
version("0.1.31", commit="dc011d16b9ff160c0be3829fc39a43054f0315d0", submodules=True)
# This is the last verified non-preview version as of 20240413
version(
"0.1.30",
commit="756c2575535641f1b96d94b4214941b90f4c30c7",
submodules=True,
preferred=True,
)
# A shell script is run by `go generate` which assumes source is in a git
# repo. So we must use git VCS and not tarballs and defeat source caching.
with default_args(submodules=True, no_cache=True):
version("0.3.9", commit="a1cef4d0a5f31280ea82b350605775931a6163cb")
version("0.1.31", commit="dc011d16b9ff160c0be3829fc39a43054f0315d0")
# This is the last verified non-preview version as of 20240413
version("0.1.30", commit="756c2575535641f1b96d94b4214941b90f4c30c7")
depends_on("c", type="build") # generated
depends_on("cxx", type="build") # generated
license("MIT", checked_by="teaguesterling")
depends_on("cmake", type="build")
depends_on("go", type="build")
depends_on("gcc", type="build")
depends_on("cmake@3.24:", type="build")
depends_on("go@1.4.0:", type="build")
depends_on("git", type="build")
depends_on("ccache", type="build")
class GoBuilder(spack.build_systems.go.GoBuilder):
phases = ("generate", "build", "install")
def setup_build_environment(self, env):
if self.spec.satisfies("+cuda"):
# These variables are consumed by gen_linux.sh which is called by
# "go generate".
cuda_prefix = self.spec["cuda"].prefix
env.set("CUDACXX", cuda_prefix.bin.nvcc)
env.set("CUDA_LIB_DIR", cuda_prefix.lib)
env.set("CMAKE_CUDA_ARCHITECTURES", spec.variants["cuda_arch"].value)
@property
def generate_args(self):
"""Arguments for ``go generate``."""