Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ramalama container: Make it possible to build basic container on all RHEL architectures #722

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions container-images/scripts/build_llama_and_whisper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dnf_install() {
"procps-ng" "git" "dnf-plugins-core" "libcurl-devel")
local vulkan_rpms=("vulkan-headers" "vulkan-loader-devel" "vulkan-tools" \
"spirv-tools" "glslc" "glslang")
local blas_rpms=("openblas-devel")
local intel_rpms=("intel-oneapi-mkl-sycl-devel" "intel-oneapi-dnnl-devel" \
"intel-oneapi-compiler-dpcpp-cpp" "intel-level-zero" \
"oneapi-level-zero" "oneapi-level-zero-devel" "intel-compute-runtime")
Expand All @@ -17,16 +18,19 @@ dnf_install() {
dnf install -y "$url"
crb enable # this is in epel-release, can only install epel-release via url
dnf --enablerepo=ubi-9-appstream-rpms install -y "${rpm_list[@]}"
local uname_m
uname_m="$(uname -m)"
dnf copr enable -y slp/mesa-krunkit "epel-9-$uname_m"
url="https://mirror.stream.centos.org/9-stream/AppStream/$uname_m/os/"
dnf config-manager --add-repo "$url"
url="http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-Official"
curl --retry 8 --retry-all-errors -o \
/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Official "$url"
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Official
dnf install -y mesa-vulkan-drivers "${vulkan_rpms[@]}"
# x86_64 and aarch64 means kompute
if [ "$uname_m" = "x86_64" ] || [ "$uname_m" = "aarch64" ] ;then
dnf copr enable -y slp/mesa-krunkit "epel-9-$uname_m"
url="https://mirror.stream.centos.org/9-stream/AppStream/$uname_m/os/"
dnf config-manager --add-repo "$url"
url="http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-Official"
curl --retry 8 --retry-all-errors -o \
/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Official "$url"
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Official
dnf install -y mesa-vulkan-drivers "${vulkan_rpms[@]}"
else
dnf install -y "${blas_rpms[@]}"
fi
fi

if [ "$containerfile" = "asahi" ]; then
Expand Down Expand Up @@ -116,6 +120,7 @@ main() {

local containerfile="$1"
local install_prefix
local uname_m="$(uname -m)"
set_install_prefix
local common_flags
configure_common_flags
Expand All @@ -125,7 +130,11 @@ main() {
common_flags+=("-DLLAMA_CURL=ON")
case "$containerfile" in
ramalama)
common_flags+=("-DGGML_KOMPUTE=ON" "-DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON")
if [ "$uname_m" = "x86_64" ] || [ "$uname_m" = "aarch64" ] ;then
common_flags+=("-DGGML_KOMPUTE=ON" "-DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON")
else
common_flags+=("-DGGML_BLAS=ON" "-DGGML_BLAS_VENDOR=OpenBLAS")
fi
;;
esac

Expand Down
9 changes: 8 additions & 1 deletion container_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ build() {
}

determine_platform() {
local platform="linux/amd64"
case $conman_bin in
podman)
local platform="$(podman info --format '{{ .Version.OsArch }}' 2>/dev/null)"
;;
docker)
local platform="$(docker info --format '{{ .ClientInfo.Os }}/{{ .ClientInfo.Arch }}' 2>/dev/null)"
;;
esac
if [ "$(uname -m)" = "aarch64" ] || { [ "$(uname -s)" = "Darwin" ] && [ "$(uname -m)" = "arm64" ]; }; then
platform="linux/arm64"
fi
Expand Down
Loading