[PR #14653] [MERGED] build: smarter docker parallelism #46016

Closed
opened 2026-04-25 01:35:14 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14653
Author: @dhiltgen
Created: 3/5/2026
Status: Merged
Merged: 3/7/2026
Merged by: @dhiltgen

Base: mainHead: docker_ninja


📝 Commits (1)

  • 2e5c900 build: smarter docker parallelism

📊 Changes

2 files changed (+49 additions, -43 deletions)

View changed files

📝 Dockerfile (+49 -42)
📝 scripts/env.sh (+0 -1)

📄 Description

Our Dockerfile leverages parallel stages for more efficient builds. However, our old parallel settings were naive and lead to under/over utilization depending on the capabilities of your build system.

This change switches to using Ninja for all our docker cmake builds to leverage its smarter parallel logic. We tell Ninja to target a load of nproc so each of the build stages will share the load on the system aiming for full CPU use without oversaturation.

The GPU parallelism settings are also adjusted to 4 to avoid a long-tail for the last few GPU targets as they work through the long list of GPU architectures.

This also fixes the Dockerfile to move Vulkan install to just the stage that needs it instead of blocking most other GPU installs. This should speed up CI which always has a clean build cache.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/14653 **Author:** [@dhiltgen](https://github.com/dhiltgen) **Created:** 3/5/2026 **Status:** ✅ Merged **Merged:** 3/7/2026 **Merged by:** [@dhiltgen](https://github.com/dhiltgen) **Base:** `main` ← **Head:** `docker_ninja` --- ### 📝 Commits (1) - [`2e5c900`](https://github.com/ollama/ollama/commit/2e5c900c26aaf63977d25ce9a0d323598fdb115e) build: smarter docker parallelism ### 📊 Changes **2 files changed** (+49 additions, -43 deletions) <details> <summary>View changed files</summary> 📝 `Dockerfile` (+49 -42) 📝 `scripts/env.sh` (+0 -1) </details> ### 📄 Description Our Dockerfile leverages parallel stages for more efficient builds. However, our old parallel settings were naive and lead to under/over utilization depending on the capabilities of your build system. This change switches to using Ninja for all our docker cmake builds to leverage its smarter parallel logic. We tell Ninja to target a load of nproc so each of the build stages will share the load on the system aiming for full CPU use without oversaturation. The GPU parallelism settings are also adjusted to 4 to avoid a long-tail for the last few GPU targets as they work through the long list of GPU architectures. This also fixes the Dockerfile to move Vulkan install to just the stage that needs it instead of blocking most other GPU installs. This should speed up CI which always has a clean build cache. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-25 01:35:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#46016