<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Brice Patchou on Medium]]></title>
        <description><![CDATA[Stories by Brice Patchou on Medium]]></description>
        <link>https://medium.com/@legentilrenard2004?source=rss-18495b3a1b0b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*JsXVL7zF8y0E1RIx</url>
            <title>Stories by Brice Patchou on Medium</title>
            <link>https://medium.com/@legentilrenard2004?source=rss-18495b3a1b0b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 21:30:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@legentilrenard2004/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Ollama on IBM Z & LinuxONE (s390x): Enabling Local LLM Inference on the Mainframe]]></title>
            <link>https://medium.com/@legentilrenard2004/ollama-on-ibm-z-linuxone-s390x-enabling-local-llm-inference-on-the-mainframe-a8c8554d2beb?source=rss-18495b3a1b0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8c8554d2beb</guid>
            <category><![CDATA[ollama]]></category>
            <category><![CDATA[ibm-z]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Brice Patchou]]></dc:creator>
            <pubDate>Mon, 17 Aug 2026 14:37:47 GMT</pubDate>
            <atom:updated>2026-08-19T16:24:43.486Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Mainframes already hold some of the world’s most sensitive data. The open question is whether they can also run modern language models — without moving that data to external GPU clouds or specialized appliances.</p><p>For regulated workloads, the answer matters. Shipping financial, healthcare, or government data off-platform creates compliance risk, audit complexity, and latency. IBM Z and LinuxONE already provide isolation, cryptography, and operational controls that few environments match. Local inference is not a novelty feature; it is an extension of the trust boundary enterprises already rely on.</p><p>In summer 2026, at IBM’s Poughkeepsie lab, we made Ollama, a widely used local LLM runtime, work natively on s390x. The hard problem was not packaging. It was correctness at the lowest layer of the stack: reading little-endian model weights on a big-endian machine. Once that was fixed, the rest of the system — API, containers, OpenShift AI, and interactive clients — could be made usable.</p><p>This article is a technical account of that work and a pointer to a public repository that makes it reproducible.</p><h3>Team</h3><ul><li><strong>Brice Patchou</strong> — Master’s student, Applied Data Science, University of Southern California (Runtimes)</li><li><strong>Justin Veltri</strong> — Senior, Computer Science, Monmouth University (Linux on Z)</li><li><strong>Rafael Sadykov</strong> — IBM AI Software Developer; technical lead</li></ul><p>We optimized for three outcomes: correct inference, low-friction installation, and a deployment path other teams could adopt without reverse-engineering our process.</p><h3>Prior Art</h3><p>Ollama sits on llama.cpp. Serious s390x work therefore starts there.</p><p>In 2023, early experiments on IBM Z failed because GGUF, the model format used by llama.cpp, is little-endian by design. Community work introduced big-endian awareness into conversion tooling and loaders, and produced GGUFv3 with explicit byte-order information.</p><p><a href="https://medium.com/@taronaeo/a-year-ago-and-now-progress-of-llama-cpp-on-mainframes-s390x-e99061abc43b">Aaron Teo</a> later advanced the platform substantially: Vector Enhancements Facility (VXE/VXE2) support, better CPU kernels, documented builds, and measured performance across IFL counts and SMT settings. That body of work established that llama.cpp could be a credible inference engine on mainframes.</p><p>Our contribution was narrower and complementary. Given a correct engine path, make the <em>product</em> experience — Ollama’s model management, server, packaging, and OpenShift integration — work on s390x without forcing operators to become endianness experts.</p><h3>Why Ollama</h3><p>We chose Ollama because its constraints match mainframe reality:</p><ul><li><strong>Engine leverage.</strong> Fixes in llama.cpp flow upward immediately.</li><li><strong>API compatibility.</strong> The OpenAI-compatible surface lets existing clients and agents connect with minimal change.</li><li><strong>Data gravity.</strong> Models and computation stay local to the data.</li><li><strong>Operational simplicity.</strong> Pull a model, run a server, call an HTTP endpoint — closer to how mainframe software is actually operated than GPU-centric frameworks with large dependency graphs.</li></ul><h3>The Problem: Endianness</h3><p>The central technical obstacle we faced was <a href="https://www.ibm.com/docs/en/db2-for-zos/13.0.0?topic=data-endianness">endianness</a>. GGUF stores multi-byte values in little-endian order. On s390x, those bytes are interpreted in the opposite order unless explicitly corrected.</p><p>The failure mode is severe. Weights and scale factors are not merely “slow”; they are <em>wrong</em>. Quantized formats such as Q4_K and Q8_0 encode scales as floating-point fields. Misread scales corrupt dequantization, which corrupts every subsequent matrix multiply and attention path. Output becomes incoherent.</p><p><a href="https://man7.org/linux/man-pages/man3/mmap.3p.html">mmap</a> makes the engineering harder. Mapped model pages are typically read-only. You cannot byte-swap in place after mapping. Any correct solution must either avoid mmap on the affected path or copy into a writable buffer before swapping.</p><p>This is not a packaging bug. It is a load-path correctness bug at the foundation of inference.</p><h3>The Fix</h3><p>We changed the load path in llama.cpp so that:</p><ol><li>Host endianness is determined at build time.</li><li>Multi-byte fields are byte-swapped as tensors are loaded into memory.</li><li>mmap is bypassed where a swap is required; data is read into a writable buffer first.</li></ol><p>The patches are wired into the automated build. A normal s390x build of Ollama receives the behavior without manual flags or post-processing.</p><p>With correct tensors, Ollama’s higher layers behaved as designed: model pull, the HTTP server, and the OpenAI-compatible API needed no architecture-specific rewrites. We validated quantized loads (Q4_K, Q5_K, Q8_0), coherent generation, and well-formed API responses.</p><h3>From Correct Binary to Usable Platform</h3><p>A working engine is necessary and insufficient. Adoption depends on install, containers, contracts, and deployment under real cluster constraints.</p><p>We shipped:</p><ul><li>A <strong>one-line installer</strong> that detects s390x, installs the binary, and configures a LinuxONE-appropriate systemd unit (no GPU group assumptions).</li><li><strong>Container images</strong>, including a UBI-based image for OpenShift AI / KServe.</li><li>A <strong>model compatibility matrix</strong>, smoke/stability tests, and an API contract for dependent teams.</li></ul><p>OpenShift exposed the next class of failures: restricted SCCs, non-writable home directories, and storage-initializer assumptions that do not match Ollama’s layout. Two rules mattered more than any other:</p><ol><li><strong>Set </strong><strong>HOME and </strong><strong>OLLAMA_MODELS to the same writable mount.</strong> Ollama resolves its data directory from the process home (os/user.Current().HomeDir), not from a dedicated OLLAMA_HOME.</li><li><strong>Prefer KServe RawDeployment for this workload.</strong> Scale-to-zero cold starts compound s390x load cost, because every cold start may pay a full little-endian → big-endian tensor transform.</li></ol><p>With writable model storage and aligned environment variables, we ran <strong>OpenWebUI</strong> on zCX OpenShift AI against the s390x Ollama endpoint. Upstream OpenWebUI was not directly usable on s390x (missing wheels for parts of its vector stack); we used a dedicated image with the vector database disabled and extended client timeouts to match CPU-bound latency.</p><h3>Operating Constraints on Mainframes</h3><p>LPARs are sized deliberately. Memory and IFL counts are scarce relative to GPU boxes. A quantization-first posture is not optional:</p><ul><li>Prefer Q4_K / Q5_K / Q8_0 for routine serving.</li><li>Treat cold start as a first-class operational cost: endian conversion dominates first load.</li><li>Keep concurrency conservative (OLLAMA_NUM_PARALLEL=1 is often the right default on modest LPARs).</li></ul><p>In validation, small models such as smollm:135m and granite3.3:2b fit in modest memory envelopes and produced coherent results through OpenWebUI and simple agent workflows.</p><h3>Evidence</h3><p>What works today:</p><ul><li>Native Ollama builds on s390x with automatic endian handling</li><li>One-line install and containerized run paths</li><li>OpenAI-compatible serving for external clients</li><li>Interactive chat via OpenWebUI on zCX OpenShift AI</li></ul><p>What remains open:</p><ul><li>Systematic coverage across model families and quants</li><li>Documented performance under realistic IFL/SMT configurations</li><li>Production hardening (storage, scaling, monitoring, runbooks)</li><li>Upstream merge into official Ollama</li><li>Accelerator paths (on-chip NNPA via zDNN; Spyre as a longer-term track)</li></ul><p>We optimized for correctness and reproducibility first. Throughput optimization is the next engineering chapter, not a claim we overstate here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*L_exeWwDGUNrWzU2fSZZhg.gif" /><figcaption>Our custom one-line installer bypasses manual cross-compilation, instantly detecting and configuring Ollama for the s390x architecture.</figcaption></figure><h3>Reproduce It</h3><p>Do you want to deploy local LLMs on your mainframe? We have open-sourced the entire project, including the one-line installer, KServe Dockerfiles, and OpenShift YAML manifests.</p><p>Teams can clone the repository, run the one-line installer to build and configure Ollama on s390x, and follow the included step-by-step procedures to deploy the container images and connect OpenWebUI, without needing prior knowledge of the endianness fixes.</p><p><a href="https://github.com/Brice12347/ollama-s390x/blob/main/docs/thorough-guideline.md"><strong>Access the Ollama-s390x Guide Here</strong></a></p><h3>Practical Demonstration: One-Line Installer and Development Environment</h3><p>The one-line installer is the bridge that makes Ollama accessible on IBM Z (s390x / LinuxONE) hardware without requiring users to build from source or manually wire up binaries. Without it, s390x users would otherwise face a multi-hour process: navigating a cross-compilation toolchain, resolving GLIBC compatibility, and manually handling library paths.</p><p>A single command collapses that into one unattended step:</p><p>Detects the s390x architecture Redirects the download to the s390x-specific GitHub Releases tarball instead of <a href="http://ollama.com/">ollama.com</a> Extracts the pre-built binary to /usr/local/bin/ollama Registers shared libraries with the system linker via ldconfig Configures a systemd service This gives s390x users the same frictionless experience that x86_64 and ARM users already enjoy, and it mirrors the upstream <a href="http://ollama.com/install.sh">ollama.com/install.sh</a> interface closely enough that upstreaming the s390x support — merging it into the official Ollama project — becomes a realistic, low-friction proposition.</p><p>Press enter or click to view image in full size Demonstration of one line installation. Our custom one-line installer bypasses manual cross-compilation, instantly detecting and configuring Ollama for the s390x architecture. Jupyter Notebook, LangChain, OpenClaw demonstrations To create a Jupyter Notebook workbench on Red Hat OpenShift AI that can communicate with an Ollama inference service, start by ensuring your PVC is visible to the RHOAI dashboard. If your PVC was created manually by a cluster admin rather than through the dashboard, label it so the UI can discover it:</p><pre>oc label pvc &lt;pvc-name&gt; opendatahub.io/dashboard=true -n &lt;namespace&gt;</pre><p>Once labelled, navigate to your data science project in the RHOAI dashboard, click Workbenches, then Create workbench. Select your desired notebook image (e.g., Jupyter Minimal CPU Python 3.12), choose a hardware profile, and under Cluster storage click Attach existing storage to select your pre-provisioned PVC. Set the mount path to what you deem appropriate (e.g., /opt/app-root/src/data) and provide a unique sub-path such as jupyter-notebooks to isolate your notebook files from other workloads sharing the same PVC.</p><p>Once the workbench reaches Ready status, open it and install any required Python packages, such as requests. To call your Ollama inference service from within the notebook, use the full Kubernetes internal DNS name as the base URL — http://&lt;inferenceservice-name&gt;-predictor.&lt;namespace&gt;.svc.cluster.local:11434 — rather than a short hostname, since the workbench pod resolves service names using the cluster’s internal DNS.</p><p>From there, use the /api/tags endpoint to confirm which models are loaded, and /api/generate with “stream”: False for a single response, or “stream”: True with a chunk-reading loop for streamed output. For large or complex prompts on CPU-only clusters, cap the output token count using the “options”: {“num_predict”: 512} parameter and set a timeout on the request to prevent indefinite waits.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ncQZwYrHL9-IQNaQ-vkm7A.png" /></figure><h3>Closing</h3><p>Local LLM inference on IBM Z is no longer blocked by a fundamental loader defect. The endianness barrier is removed, the packaging path exists, and interactive serving on OpenShift AI has been demonstrated.</p><p>That does not mean the work is finished. It means the problem has changed shape: from “does this run at all?” to “how do we harden, accelerate, and upstream it?”</p><p>For enterprises that already keep critical data on the mainframe, the strategic implication is straightforward. You do not have to choose between modern generative models and the platform that already satisfies your strongest security and compliance constraints. You can bring the models to the data.</p><p><em>Brice Patchou, Justin Veltri, and Rafael Sadykov</em><br><em>IBM Poughkeepsie · Summer 2026</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8c8554d2beb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>