summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Viren <brett.viren@gmail.com>2024-09-27 04:13:54 -0400
committerGitHub <noreply@github.com>2024-09-27 10:13:54 +0200
commit3637c087c5f50b1cc6cdf7ac1fb04662016a4b04 (patch)
treed8295ac8f172d4e81fac116599dd399d749289d7
parenta835a0ed3146f433afcae8f34dfad1e92c391bfe (diff)
downloadspack-3637c087c5f50b1cc6cdf7ac1fb04662016a4b04.tar.gz
spack-3637c087c5f50b1cc6cdf7ac1fb04662016a4b04.tar.bz2
spack-3637c087c5f50b1cc6cdf7ac1fb04662016a4b04.tar.xz
spack-3637c087c5f50b1cc6cdf7ac1fb04662016a4b04.zip
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>
-rw-r--r--var/spack/repos/builtin/packages/ollama/package.py37
1 files changed, 20 insertions, 17 deletions
diff --git a/var/spack/repos/builtin/packages/ollama/package.py b/var/spack/repos/builtin/packages/ollama/package.py
index 98a171998f..7de54a4ce8 100644
--- a/var/spack/repos/builtin/packages/ollama/package.py
+++ b/var/spack/repos/builtin/packages/ollama/package.py
@@ -7,41 +7,44 @@ import spack.build_systems.go
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``."""