|
-
- <!doctype html>
- <html lang="en" class="no-js">
- <head>
-
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1">
-
-
-
- <link rel="canonical" href="https://openblas.net/docs/install/">
-
-
- <link rel="prev" href="..">
-
-
- <link rel="next" href="../user_manual/">
-
-
- <link rel="icon" href="../logo.svg">
- <meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.6.14">
-
-
-
- <title>Install OpenBLAS - OpenBLAS</title>
-
-
-
- <link rel="stylesheet" href="../assets/stylesheets/main.342714a4.min.css">
-
-
- <link rel="stylesheet" href="../assets/stylesheets/palette.06af60db.min.css">
-
-
-
-
-
-
-
-
-
-
-
-
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
- <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
-
-
-
- <script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
-
-
-
-
-
-
- </head>
-
-
-
-
-
-
-
-
-
- <body dir="ltr" data-md-color-scheme="slate" data-md-color-primary="blue-grey" data-md-color-accent="indigo">
-
-
- <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
- <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
- <label class="md-overlay" for="__drawer"></label>
- <div data-md-component="skip">
-
-
- <a href="#install-openblas" class="md-skip">
- Skip to content
- </a>
-
- </div>
- <div data-md-component="announce">
-
- </div>
-
-
-
-
-
-
- <header class="md-header md-header--shadow" data-md-component="header">
- <nav class="md-header__inner md-grid" aria-label="Header">
- <a href=".." title="OpenBLAS" class="md-header__button md-logo" aria-label="OpenBLAS" data-md-component="logo">
-
- <img src="../logo.svg" alt="logo">
-
- </a>
- <label class="md-header__button md-icon" for="__drawer">
-
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
- </label>
- <div class="md-header__title" data-md-component="header-title">
- <div class="md-header__ellipsis">
- <div class="md-header__topic">
- <span class="md-ellipsis">
- OpenBLAS
- </span>
- </div>
- <div class="md-header__topic" data-md-component="header-topic">
- <span class="md-ellipsis">
-
- Install OpenBLAS
-
- </span>
- </div>
- </div>
- </div>
-
-
- <form class="md-header__option" data-md-component="palette">
-
-
-
-
- <input class="md-option" data-md-color-media="" data-md-color-scheme="slate" data-md-color-primary="blue-grey" data-md-color-accent="indigo" aria-label="Switch to light mode" type="radio" name="__palette" id="__palette_0">
-
- <label class="md-header__button md-icon" title="Switch to light mode" for="__palette_1" hidden>
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12s-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6a6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12z"/></svg>
- </label>
-
-
-
-
-
- <input class="md-option" data-md-color-media="" data-md-color-scheme="default" data-md-color-primary="blue-grey" data-md-color-accent="indigo" aria-label="Switch to dark mode" type="radio" name="__palette" id="__palette_1">
-
- <label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_0" hidden>
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a4 4 0 0 0-4 4 4 4 0 0 0 4 4 4 4 0 0 0 4-4 4 4 0 0 0-4-4m0 10a6 6 0 0 1-6-6 6 6 0 0 1 6-6 6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12z"/></svg>
- </label>
-
-
- </form>
-
-
-
- <script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
-
-
-
-
-
- <label class="md-header__button md-icon" for="__search">
-
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
- </label>
- <div class="md-search" data-md-component="search" role="dialog">
- <label class="md-search__overlay" for="__search"></label>
- <div class="md-search__inner" role="search">
- <form class="md-search__form" name="search">
- <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
- <label class="md-search__icon md-icon" for="__search">
-
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
-
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
- </label>
- <nav class="md-search__options" aria-label="Search">
-
- <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
-
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
- </button>
- </nav>
-
- </form>
- <div class="md-search__output">
- <div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
- <div class="md-search-result" data-md-component="search-result">
- <div class="md-search-result__meta">
- Initializing search
- </div>
- <ol class="md-search-result__list" role="presentation"></ol>
- </div>
- </div>
- </div>
- </div>
- </div>
-
-
-
- <div class="md-header__source">
- <a href="https://github.com/OpenMathLib/OpenBLAS" title="Go to repository" class="md-source" data-md-component="source">
- <div class="md-source__icon md-icon">
-
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81"/></svg>
- </div>
- <div class="md-source__repository">
- GitHub
- </div>
- </a>
- </div>
-
- </nav>
-
- </header>
-
- <div class="md-container" data-md-component="container">
-
-
-
-
-
-
- <main class="md-main" data-md-component="main">
- <div class="md-main__inner md-grid">
-
-
-
- <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
- <div class="md-sidebar__scrollwrap">
- <div class="md-sidebar__inner">
-
-
-
-
- <nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
- <label class="md-nav__title" for="__drawer">
- <a href=".." title="OpenBLAS" class="md-nav__button md-logo" aria-label="OpenBLAS" data-md-component="logo">
-
- <img src="../logo.svg" alt="logo">
-
- </a>
- OpenBLAS
- </label>
-
- <div class="md-nav__source">
- <a href="https://github.com/OpenMathLib/OpenBLAS" title="Go to repository" class="md-source" data-md-component="source">
- <div class="md-source__icon md-icon">
-
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81"/></svg>
- </div>
- <div class="md-source__repository">
- GitHub
- </div>
- </a>
- </div>
-
- <ul class="md-nav__list" data-md-scrollfix>
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href=".." class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Home
-
- </span>
-
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item md-nav__item--active">
-
- <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
-
-
-
-
-
- <label class="md-nav__link md-nav__link--active" for="__toc">
-
-
-
- <span class="md-ellipsis">
- Install OpenBLAS
-
- </span>
-
-
- <span class="md-nav__icon md-icon"></span>
- </label>
-
- <a href="./" class="md-nav__link md-nav__link--active">
-
-
-
- <span class="md-ellipsis">
- Install OpenBLAS
-
- </span>
-
-
- </a>
-
-
-
- <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
-
-
-
-
-
-
- <label class="md-nav__title" for="__toc">
- <span class="md-nav__icon md-icon"></span>
- Table of contents
- </label>
- <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
-
- <li class="md-nav__item">
- <a href="#installing-with-a-package-manager" class="md-nav__link">
- <span class="md-ellipsis">
- Installing with a package manager
- </span>
- </a>
-
- <nav class="md-nav" aria-label="Installing with a package manager">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#linux" class="md-nav__link">
- <span class="md-ellipsis">
- Linux
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#windows" class="md-nav__link">
- <span class="md-ellipsis">
- Windows
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#macos" class="md-nav__link">
- <span class="md-ellipsis">
- macOS
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#freebsd" class="md-nav__link">
- <span class="md-ellipsis">
- FreeBSD
- </span>
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#building-from-source" class="md-nav__link">
- <span class="md-ellipsis">
- Building from source
- </span>
- </a>
-
- <nav class="md-nav" aria-label="Building from source">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#linux-and-macos" class="md-nav__link">
- <span class="md-ellipsis">
- Linux and macOS
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#windows_1" class="md-nav__link">
- <span class="md-ellipsis">
- Windows
- </span>
- </a>
-
- <nav class="md-nav" aria-label="Windows">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#visual-studio-native-windows-abi" class="md-nav__link">
- <span class="md-ellipsis">
- Visual Studio & native Windows ABI
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#mingw-gnu-abi" class="md-nav__link">
- <span class="md-ellipsis">
- MinGW & GNU ABI
- </span>
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#windows-on-arm" class="md-nav__link">
- <span class="md-ellipsis">
- Windows on Arm
- </span>
- </a>
-
- <nav class="md-nav" aria-label="Windows on Arm">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#generating-an-import-library" class="md-nav__link">
- <span class="md-ellipsis">
- Generating an import library
- </span>
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#android" class="md-nav__link">
- <span class="md-ellipsis">
- Android
- </span>
- </a>
-
- <nav class="md-nav" aria-label="Android">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#building-for-armv7" class="md-nav__link">
- <span class="md-ellipsis">
- Building for ARMV7
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#building-for-armv8" class="md-nav__link">
- <span class="md-ellipsis">
- Building for ARMV8
- </span>
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#iphoneios" class="md-nav__link">
- <span class="md-ellipsis">
- iPhone/iOS
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#harmonyos" class="md-nav__link">
- <span class="md-ellipsis">
- HarmonyOS
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#mips" class="md-nav__link">
- <span class="md-ellipsis">
- MIPS
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#freebsd_1" class="md-nav__link">
- <span class="md-ellipsis">
- FreeBSD
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#cortex-m" class="md-nav__link">
- <span class="md-ellipsis">
- Cortex-M
- </span>
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- </ul>
-
- </nav>
-
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../user_manual/" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- User manual
-
- </span>
-
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../extensions/" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Extensions
-
- </span>
-
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../developers/" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Developer manual
-
- </span>
-
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../build_system/" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Build system
-
- </span>
-
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../runtime_variables/" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Runtime variables
-
- </span>
-
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../distributing/" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- Redistributing OpenBLAS
-
- </span>
-
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../ci/" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- CI jobs
-
- </span>
-
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../about/" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- About
-
- </span>
-
-
- </a>
- </li>
-
-
-
-
-
-
-
-
-
- <li class="md-nav__item">
- <a href="../faq/" class="md-nav__link">
-
-
-
- <span class="md-ellipsis">
- FAQ
-
- </span>
-
-
- </a>
- </li>
-
-
-
- </ul>
- </nav>
- </div>
- </div>
- </div>
-
-
-
- <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
- <div class="md-sidebar__scrollwrap">
- <div class="md-sidebar__inner">
-
-
- <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
-
-
-
-
-
-
- <label class="md-nav__title" for="__toc">
- <span class="md-nav__icon md-icon"></span>
- Table of contents
- </label>
- <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
-
- <li class="md-nav__item">
- <a href="#installing-with-a-package-manager" class="md-nav__link">
- <span class="md-ellipsis">
- Installing with a package manager
- </span>
- </a>
-
- <nav class="md-nav" aria-label="Installing with a package manager">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#linux" class="md-nav__link">
- <span class="md-ellipsis">
- Linux
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#windows" class="md-nav__link">
- <span class="md-ellipsis">
- Windows
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#macos" class="md-nav__link">
- <span class="md-ellipsis">
- macOS
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#freebsd" class="md-nav__link">
- <span class="md-ellipsis">
- FreeBSD
- </span>
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#building-from-source" class="md-nav__link">
- <span class="md-ellipsis">
- Building from source
- </span>
- </a>
-
- <nav class="md-nav" aria-label="Building from source">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#linux-and-macos" class="md-nav__link">
- <span class="md-ellipsis">
- Linux and macOS
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#windows_1" class="md-nav__link">
- <span class="md-ellipsis">
- Windows
- </span>
- </a>
-
- <nav class="md-nav" aria-label="Windows">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#visual-studio-native-windows-abi" class="md-nav__link">
- <span class="md-ellipsis">
- Visual Studio & native Windows ABI
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#mingw-gnu-abi" class="md-nav__link">
- <span class="md-ellipsis">
- MinGW & GNU ABI
- </span>
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#windows-on-arm" class="md-nav__link">
- <span class="md-ellipsis">
- Windows on Arm
- </span>
- </a>
-
- <nav class="md-nav" aria-label="Windows on Arm">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#generating-an-import-library" class="md-nav__link">
- <span class="md-ellipsis">
- Generating an import library
- </span>
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#android" class="md-nav__link">
- <span class="md-ellipsis">
- Android
- </span>
- </a>
-
- <nav class="md-nav" aria-label="Android">
- <ul class="md-nav__list">
-
- <li class="md-nav__item">
- <a href="#building-for-armv7" class="md-nav__link">
- <span class="md-ellipsis">
- Building for ARMV7
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#building-for-armv8" class="md-nav__link">
- <span class="md-ellipsis">
- Building for ARMV8
- </span>
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#iphoneios" class="md-nav__link">
- <span class="md-ellipsis">
- iPhone/iOS
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#harmonyos" class="md-nav__link">
- <span class="md-ellipsis">
- HarmonyOS
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#mips" class="md-nav__link">
- <span class="md-ellipsis">
- MIPS
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#freebsd_1" class="md-nav__link">
- <span class="md-ellipsis">
- FreeBSD
- </span>
- </a>
-
- </li>
-
- <li class="md-nav__item">
- <a href="#cortex-m" class="md-nav__link">
- <span class="md-ellipsis">
- Cortex-M
- </span>
- </a>
-
- </li>
-
- </ul>
- </nav>
-
- </li>
-
- </ul>
-
- </nav>
- </div>
- </div>
- </div>
-
-
-
- <div class="md-content" data-md-component="content">
- <article class="md-content__inner md-typeset">
-
-
-
-
-
-
-
-
- <h1 id="install-openblas">Install OpenBLAS</h1>
- <p>OpenBLAS can be installed through package managers or from source. If you only
- want to use OpenBLAS rather than make changes to it, we recommend installing a
- pre-built binary package with your package manager of choice.</p>
- <p>This page contains an overview of installing with package managers as well as
- from source. For the latter, see <a href="#building-from-source">further down on this page</a>.</p>
- <h2 id="installing-with-a-package-manager">Installing with a package manager</h2>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>Almost every package manager provides OpenBLAS packages; the list on this
- page is not comprehensive. If your package manager of choice isn't shown
- here, please search its package database for <code>openblas</code> or <code>libopenblas</code>.</p>
- </div>
- <h3 id="linux">Linux</h3>
- <p>On Linux, OpenBLAS can be installed with the system package manager, or with a
- package manager like <a href="https://docs.conda.io/en/latest/">Conda</a>
- (or alternative package managers for the conda-forge ecosystem, like
- <a href="https://mamba.readthedocs.io/en/latest/">Mamba</a>,
- <a href="https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html">Micromamba</a>,
- or <a href="https://pixi.sh/latest/#windows-installer">Pixi</a>),
- <a href="https://spack.io/">Spack</a>, or <a href="https://nixos.org/">Nix</a>. For the latter set of
- tools, the package name in all cases is <code>openblas</code>. Since package management in
- quite a few of these tools is declarative (i.e., managed by adding <code>openblas</code>
- to a metadata file describing the dependencies for your project or
- environment), we won't attempt to give detailed instructions for these tools here.</p>
- <p>Linux distributions typically split OpenBLAS up in two packages: one containing
- the library itself (typically named <code>openblas</code> or <code>libopenblas</code>), and one containing headers,
- pkg-config and CMake files (typically named the same as the package for the
- library with <code>-dev</code> or <code>-devel</code> appended; e.g., <code>openblas-devel</code>). Please keep
- in mind that if you want to install OpenBLAS in order to use it directly in
- your own project, you will need to install both of those packages.</p>
- <p>Distro-specific installation commands:</p>
- <div class="tabbed-set tabbed-alternate" data-tabs="1:4"><input checked="checked" id="__tabbed_1_1" name="__tabbed_1" type="radio" /><input id="__tabbed_1_2" name="__tabbed_1" type="radio" /><input id="__tabbed_1_3" name="__tabbed_1" type="radio" /><input id="__tabbed_1_4" name="__tabbed_1" type="radio" /><div class="tabbed-labels"><label for="__tabbed_1_1">Debian/Ubuntu/Mint/Kali</label><label for="__tabbed_1_2">openSUSE/SLE</label><label for="__tabbed_1_3">Fedora/CentOS/RHEL</label><label for="__tabbed_1_4">Arch/Manjaro/Antergos</label></div>
- <div class="tabbed-content">
- <div class="tabbed-block">
- <p><div class="highlight"><pre><span></span><code>$<span class="w"> </span>sudo<span class="w"> </span>apt<span class="w"> </span>update
- $<span class="w"> </span>sudo<span class="w"> </span>apt<span class="w"> </span>install<span class="w"> </span>libopenblas-dev
- </code></pre></div>
- OpenBLAS can be configured as the default BLAS through the <code>update-alternatives</code> mechanism:</p>
- <div class="highlight"><pre><span></span><code>$<span class="w"> </span>sudo<span class="w"> </span>update-alternatives<span class="w"> </span>--config<span class="w"> </span>libblas.so.3
- </code></pre></div>
- </div>
- <div class="tabbed-block">
- <div class="highlight"><pre><span></span><code>$<span class="w"> </span>sudo<span class="w"> </span>zypper<span class="w"> </span>refresh
- $<span class="w"> </span>sudo<span class="w"> </span>zypper<span class="w"> </span>install<span class="w"> </span>openblas-devel
- </code></pre></div>
- <p>OpenBLAS can be configured as the default BLAS through the <code>update-alternatives</code> mechanism:
- <div class="highlight"><pre><span></span><code>$<span class="w"> </span>sudo<span class="w"> </span>update-alternatives<span class="w"> </span>--config<span class="w"> </span>libblas.so.3
- </code></pre></div></p>
- </div>
- <div class="tabbed-block">
- <div class="highlight"><pre><span></span><code>$<span class="w"> </span>dnf<span class="w"> </span>check-update
- $<span class="w"> </span>dnf<span class="w"> </span>install<span class="w"> </span>openblas-devel
- </code></pre></div>
- <div class="admonition warning">
- <p class="admonition-title">Warning</p>
- <p>Fedora does not ship the pkg-config files for OpenBLAS. Instead, it wants you to
- link against <a href="https://www.mpi-magdeburg.mpg.de/projects/flexiblas">FlexiBLAS</a> (which
- uses OpenBLAS by default as its backend on Fedora), which you can install with:</p>
- <div class="highlight"><pre><span></span><code>$<span class="w"> </span>dnf<span class="w"> </span>install<span class="w"> </span>flexiblas-devel
- </code></pre></div>
- </div>
- <p>For CentOS and RHEL, OpenBLAS packages are provided via the <a href="https://fedoraproject.org/wiki/EPEL">Fedora EPEL repository</a>.
- After adding that repository and its repository keys, you can install
- <code>openblas-devel</code> with either <code>dnf</code> or <code>yum</code>.</p>
- </div>
- <div class="tabbed-block">
- <div class="highlight"><pre><span></span><code>$<span class="w"> </span>sudo<span class="w"> </span>pacman<span class="w"> </span>-S<span class="w"> </span>openblas
- </code></pre></div>
- </div>
- </div>
- </div>
- <h3 id="windows">Windows</h3>
- <div class="tabbed-set tabbed-alternate" data-tabs="2:3"><input checked="checked" id="__tabbed_2_1" name="__tabbed_2" type="radio" /><input id="__tabbed_2_2" name="__tabbed_2" type="radio" /><input id="__tabbed_2_3" name="__tabbed_2" type="radio" /><div class="tabbed-labels"><label for="__tabbed_2_1">Conda-forge</label><label for="__tabbed_2_2">vcpkg</label><label for="__tabbed_2_3">OpenBLAS releases</label></div>
- <div class="tabbed-content">
- <div class="tabbed-block">
- <p>OpenBLAS can be installed with <code>conda</code> (or <code>mamba</code>, <code>micromamba</code>, or
- <code>pixi</code>) from conda-forge:
- <div class="highlight"><pre><span></span><code>conda install openblas
- </code></pre></div></p>
- <p>Conda-forge provides a method for switching the default BLAS implementation
- used by all packages. To use that for OpenBLAS, install <code>libblas=*=*openblas</code>
- (see <a href="https://conda-forge.org/docs/maintainer/knowledge_base/#switching-blas-implementation">the docs on this mechanism</a>
- for more details).</p>
- </div>
- <div class="tabbed-block">
- <p>OpenBLAS can be installed with vcpkg:
- <div class="highlight"><pre><span></span><code># In classic mode:
- vcpkg install openblas
-
- # Or in manifest mode:
- vcpkg add port openblas
- </code></pre></div></p>
- </div>
- <div class="tabbed-block">
- <p>Windows is the only platform for which binaries are made available by the
- OpenBLAS project itself. They can be downloaded from the GitHub
- Releases](https://github.com/OpenMathLib/OpenBLAS/releases) page. These
- binaries are built with MinGW, using the following build options:
- <div class="highlight"><pre><span></span><code>NUM_THREADS=64 TARGET=GENERIC DYNAMIC_ARCH=1 DYNAMIC_OLDER=1 CONSISTENT_FPCSR=1 INTERFACE=0
- </code></pre></div>
- There are separate packages for x86-64 and x86. The zip archive contains
- the include files, static and shared libraries, as well as configuration
- files for getting them found via CMake or pkg-config. To use these
- binaries, create a suitable folder for your OpenBLAS installation and unzip
- the <code>.zip</code> bundle there (note that you will need to edit the provided
- <code>openblas.pc</code> and <code>OpenBLASConfig.cmake</code> to reflect the installation path
- on your computer, as distributed they have "win" or "win64" reflecting the
- local paths on the system they were built on).</p>
- <p>Note that the same binaries can be downloaded
- <a href="http://sourceforge.net/projects/openblas/files">from SourceForge</a>; this is
- mostly of historical interest.</p>
- </div>
- </div>
- </div>
- <h3 id="macos">macOS</h3>
- <p>To install OpenBLAS with a package manager on macOS, run:</p>
- <div class="tabbed-set tabbed-alternate" data-tabs="3:3"><input checked="checked" id="__tabbed_3_1" name="__tabbed_3" type="radio" /><input id="__tabbed_3_2" name="__tabbed_3" type="radio" /><input id="__tabbed_3_3" name="__tabbed_3" type="radio" /><div class="tabbed-labels"><label for="__tabbed_3_1">Homebrew</label><label for="__tabbed_3_2">MacPorts</label><label for="__tabbed_3_3">Conda-forge</label></div>
- <div class="tabbed-content">
- <div class="tabbed-block">
- <div class="highlight"><pre><span></span><code>%<span class="w"> </span>brew<span class="w"> </span>install<span class="w"> </span>openblas
- </code></pre></div>
- </div>
- <div class="tabbed-block">
- <div class="highlight"><pre><span></span><code>%<span class="w"> </span>sudo<span class="w"> </span>port<span class="w"> </span>install<span class="w"> </span>OpenBLAS-devel
- </code></pre></div>
- </div>
- <div class="tabbed-block">
- <div class="highlight"><pre><span></span><code>%<span class="w"> </span>conda<span class="w"> </span>install<span class="w"> </span>openblas
- </code></pre></div>
- <p>Conda-forge provides a method for switching the default BLAS implementation
- used by all packages. To use that for OpenBLAS, install <code>libblas=*=*openblas</code>
- (see <a href="https://conda-forge.org/docs/maintainer/knowledge_base/#switching-blas-implementation">the docs on this mechanism</a>
- for more details).</p>
- </div>
- </div>
- </div>
- <h3 id="freebsd">FreeBSD</h3>
- <p>You can install OpenBLAS from the FreeBSD <a href="https://www.freebsd.org/ports/index.html">Ports collection</a>:
- <div class="highlight"><pre><span></span><code>pkg install openblas
- </code></pre></div></p>
- <h2 id="building-from-source">Building from source</h2>
- <p>We recommend download the latest <a href="https://github.com/OpenMathLib/OpenBLAS/releases">stable version</a>
- from the GitHub Releases page, or checking it out from a git tag, rather than a
- dev version from the <code>develop</code> branch.</p>
- <div class="admonition tip">
- <p class="admonition-title">Tip</p>
- <p>The User manual contains <a href="../user_manual/#compiling-openblas">a section with detailed information on compiling OpenBLAS</a>,
- including how to customize builds and how to cross-compile. Please read
- that documentation first. This page contains only platform-specific build
- information, and assumes you already understand the general build system
- invocations to build OpenBLAS, with the specific build options you want to
- control multi-threading and other non-platform-specific behavior).</p>
- </div>
- <h3 id="linux-and-macos">Linux and macOS</h3>
- <p>Ensure you have C and Fortran compilers installed, then simply type <code>make</code> to compile the library.
- There are no other build dependencies, nor unusual platform-specific
- environment variables to set or other system setup to do.</p>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>When building in an emulator (KVM, QEMU, etc.), please make sure that the combination of CPU features exposed to
- the virtual environment matches that of an existing CPU to allow detection of the CPU model to succeed.
- (With <code>qemu</code>, this can be done by passing <code>-cpu host</code> or a supported model name at invocation).</p>
- </div>
- <h3 id="windows_1">Windows</h3>
- <p>We support building OpenBLAS with either MinGW or Visual Studio on Windows.
- Using MSVC will yield an OpenBLAS build with the Windows platform-native ABI.
- Using MinGW will yield a different ABI. We'll describe both methods in detail
- in this section, since the process for each is quite different.</p>
- <h4 id="visual-studio-native-windows-abi">Visual Studio & native Windows ABI</h4>
- <p>For Visual Studio, you can use CMake to generate Visual Studio solution files;
- note that you will need at least CMake 3.11 for linking to work correctly).</p>
- <p>Note that you need a Fortran compiler if you plan to build and use the LAPACK
- functions included with OpenBLAS. The sections below describe using either
- <code>flang</code> as an add-on to clang/LLVM or <code>gfortran</code> as part of MinGW for this
- purpose. If you want to use the Intel Fortran compiler (<code>ifort</code> or <code>ifx</code>) for
- this, be sure to also use the Intel C compiler (<code>icc</code> or <code>icx</code>) for building
- the C parts, as the ABI imposed by <code>ifort</code> is incompatible with MSVC</p>
- <p>A fully-optimized OpenBLAS that can be statically or dynamically linked to your
- application can currently be built for the 64-bit architecture with the LLVM
- compiler infrastructure. We're going to use <a href="https://docs.anaconda.com/miniconda/">Miniconda3</a>
- to grab all of the tools we need, since some of them are in an experimental
- status. Before you begin, you'll need to have Microsoft Visual Studio 2015 or
- newer installed.</p>
- <ol>
- <li>Install Miniconda3 for 64-bit Windows using <code>winget install --id Anaconda.Miniconda3</code>,
- or easily download from <a href="https://docs.conda.io/en/latest/miniconda.html">conda.io</a>.</li>
- <li>Open the "Anaconda Command Prompt" now available in the Start Menu, or at <code>%USERPROFILE%\miniconda3\shell\condabin\conda-hook.ps1</code>.</li>
- <li>In that command prompt window, use <code>cd</code> to change to the directory where you want to build OpenBLAS.</li>
- <li>Now install all of the tools we need:
- <div class="highlight"><pre><span></span><code>conda update -n base conda
- conda config --add channels conda-forge
- conda install -y cmake flang clangdev perl libflang ninja
- </code></pre></div></li>
- <li>
- <p>Still in the Anaconda Command Prompt window, activate the 64-bit MSVC environment with <code>vcvarsall x64</code>.
- On Windows 11 with Visual Studio 2022, this would be done by invoking:</p>
- <div class="highlight"><pre><span></span><code><span class="s2">"c:\Program Files\Microsoft Visual Studio\2022\Community\vc\Auxiliary\Build\vcvars64.bat"</span>
- </code></pre></div>
- <p>With VS2019, the command should be the same (except for the year number of course).
- For other versions of MSVC, please check the Visual Studio documentation for
- exactly how to invoke the <code>vcvars64.bat</code> script.</p>
- <p>Confirm that the environment is active by typing <code>link</code>. This should return
- a long list of possible options for the <code>link</code> command. If it just returns
- <em>"command not found"</em> or similar, review and retype the call to <code>vcvars64.bat</code>.</p>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>if you are working from a Visual Studio command prompt window instead
- (so that you do not have to do the <code>vcvars</code> call), you need to invoke
- <code>conda activate</code> so that <code>CONDA_PREFIX</code> etc. get set up correctly before
- proceeding to step 6. Failing to do so will lead to link errors like
- <code>libflangmain.lib</code> not getting found later in the build.</p>
- </div>
- </li>
- <li>
- <p>Now configure the project with CMake. Starting in the project directory, execute the following:
- <div class="highlight"><pre><span></span><code>set "LIB=%CONDA_PREFIX%\Library\lib;%LIB%"
- set "CPATH=%CONDA_PREFIX%\Library\include;%CPATH%"
- mkdir build
- cd build
- cmake .. -G "Ninja" -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_Fortran_COMPILER=flang -DCMAKE_MT=mt -DBUILD_WITHOUT_LAPACK=no -DNOFORTRAN=0 -DDYNAMIC_ARCH=ON -DCMAKE_BUILD_TYPE=Release
- </code></pre></div></p>
- <p>You may want to add further options in the <code>cmake</code> command here. For
- instance, the default only produces a static <code>.lib</code> version of the library.
- If you would rather have a DLL, add <code>-DBUILD_SHARED_LIBS=ON</code> above. Note that
- this step only creates some command files and directories, the actual build
- happens next.</p>
- </li>
- <li>
- <p>Build the project:</p>
- <p><div class="highlight"><pre><span></span><code>cmake --build . --config Release
- </code></pre></div>
- This step will create the OpenBLAS library in the <code>lib</code> directory, and
- various build-time tests in the <code>test</code>, <code>ctest</code> and <code>openblas_utest</code>
- directories. However it will not separate the header files you might need
- for building your own programs from those used internally. To put all
- relevant files in a more convenient arrangement, run the next step.</p>
- </li>
- <li>
- <p>Install all relevant files created by the build:</p>
- <p><div class="highlight"><pre><span></span><code>cmake --install . --prefix c:\opt -v
- </code></pre></div>
- This will copy all files that are needed for building and running your own
- programs with OpenBLAS to the given location, creating appropriate
- subdirectories for the individual kinds of files. In the case of <code>C:\opt</code> as
- given above, this would be:</p>
- <ul>
- <li><code>C:\opt\include\openblas</code> for the header files, </li>
- <li><code>C:\opt\bin</code> for the <code>libopenblas.dll</code> shared library,</li>
- <li><code>C:\opt\lib</code> for the static library, and</li>
- <li><code>C:\opt\share</code> holds various support files that enable other cmake-based
- build scripts to find OpenBLAS automatically.</li>
- </ul>
- </li>
- </ol>
- <div class="admonition tip">
- <p class="admonition-title">Change in complex types for Visual Studio 2017 and up</p>
- <p>In newer Visual Studio versions, Microsoft has changed
- <a href="https://docs.microsoft.com/en-us/cpp/c-runtime-library/complex-math-support?view=msvc-170#types-used-in-complex-math">how it handles complex types</a>.
- Even when using a precompiled version of OpenBLAS, you might need to define
- <code>LAPACK_COMPLEX_CUSTOM</code> in order to define complex types properly for MSVC.
- For example, some variant of the following might help:</p>
- <div class="highlight"><pre><span></span><code><span class="cp">#if defined(_MSC_VER)</span>
- <span class="w"> </span><span class="cp">#include</span><span class="w"> </span><span class="cpf"><complex.h></span>
- <span class="w"> </span><span class="cp">#define LAPACK_COMPLEX_CUSTOM</span>
- <span class="w"> </span><span class="cp">#define lapack_complex_float _Fcomplex</span>
- <span class="w"> </span><span class="cp">#define lapack_complex_double _Dcomplex</span>
- <span class="cp">#endif</span>
- </code></pre></div>
- <p>For reference, see
- <a href="https://github.com/OpenMathLib/OpenBLAS/issues/3661">openblas#3661</a>,
- <a href="https://github.com/Reference-LAPACK/lapack/issues/683">lapack#683</a>, and
- <a href="https://stackoverflow.com/questions/47520244/using-openblas-lapacke-in-visual-studio">this Stack Overflow question</a>.</p>
- </div>
- <div class="admonition warning">
- <p class="admonition-title">Building 32-bit binaries with MSVC</p>
- <p>This method may produce binaries which demonstrate significantly lower
- performance than those built with the other methods. The Visual Studio
- compiler does not support the dialect of assembly used in the cpu-specific
- optimized files, so only the "generic" <code>TARGET</code> which is written in pure C
- will get built. For the same reason it is not possible (and not necessary)
- to use <code>-DDYNAMIC_ARCH=ON</code> in a Visual Studio build. You may consider
- building for the 32-bit architecture using the GNU (MinGW) ABI instead.</p>
- </div>
- <h5 id="cmake-visual-studio-integration">CMake & Visual Studio integration</h5>
- <p>To generate Visual Studio solution files, ensure CMake is installed and then run:
- <div class="highlight"><pre><span></span><code># Do this from Powershell so cmake can find visual studio
- cmake -G "Visual Studio 14 Win64" -DCMAKE_BUILD_TYPE=Release .
- </code></pre></div></p>
- <p>To then build OpenBLAS using those solution files from within Visual Studio, we
- also need Perl. Please install it and ensure it's on the <code>PATH</code> (see, e.g.,
- <a href="http://stackoverflow.com/questions/3051049/active-perl-installation-on-windows-operating-system">this Stack Overflow question for how</a>).</p>
- <p>If you build from within Visual Studio, the dependencies may not be
- automatically configured: if you try to build <code>libopenblas</code> directly, it may
- fail with a message saying that some <code>.obj</code> files aren't found. If this
- happens, you can work around the problem by building the projects that
- <code>libopenblas</code> depends on before building <code>libopenblas</code> itself.</p>
- <h6 id="build-openblas-for-universal-windows-platform">Build OpenBLAS for Universal Windows Platform</h6>
- <p>OpenBLAS can be built targeting <a href="https://en.wikipedia.org/wiki/Universal_Windows_Platform">Universal Windows Platform</a>
- (UWP) like this:</p>
- <ol>
- <li>Follow the steps above to build the Visual Studio solution files for
- Windows. This builds the helper executables which are required when building
- the OpenBLAS Visual Studio solution files for UWP in step 2.</li>
- <li>
- <p>Remove the generated <code>CMakeCache.txt</code> and the <code>CMakeFiles</code> directory from
- the OpenBLAS source directory, then re-run CMake with the following options:</p>
- <p><div class="highlight"><pre><span></span><code># do this to build UWP compatible solution files
- cmake -G "Visual Studio 14 Win64" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DCMAKE_SYSTEM_PROCESSOR=AMD64 -DVS_WINRT_COMPONENT=TRUE -DCMAKE_BUILD_TYPE=Release .
- </code></pre></div>
- 3. Now build the solution with Visual Studio.</p>
- </li>
- </ol>
- <h4 id="mingw-gnu-abi">MinGW & GNU ABI</h4>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>The resulting library from building with MinGW as described below can be
- used in Visual Studio, but it can only be linked dynamically. This
- configuration has not been thoroughly tested and should be considered
- experimental.</p>
- </div>
- <p>To build OpenBLAS on Windows with MinGW:</p>
- <ol>
- <li>Install the MinGW (GCC) compiler suite, either the 32-bit
- [MinGW]((http://www.mingw.org/) or the 64-bit
- <a href="http://mingw-w64.sourceforge.net/">MinGW-w64</a> toolchain. Be sure to install
- its <code>gfortran</code> package as well (unless you really want to build the BLAS part
- of OpenBLAS only) and check that <code>gcc</code> and <code>gfortran</code> are the same version.
- In addition, please install MSYS2 with MinGW.</li>
- <li>Build OpenBLAS in the MSYS2 shell. Usually, you can just type <code>make</code>.
- OpenBLAS will detect the compiler and CPU automatically. </li>
- <li>After the build is complete, OpenBLAS will generate the static library
- <code>libopenblas.a</code> and the shared library <code>libopenblas.dll</code> in the folder. You
- can type <code>make PREFIX=/your/installation/path install</code> to install the
- library to a certain location.</li>
- </ol>
- <p>Note that OpenBLAS will generate the import library <code>libopenblas.dll.a</code> for
- <code>libopenblas.dll</code> by default.</p>
- <p>If you want to generate Windows-native PDB files from a MinGW build, you can
- use the <a href="https://github.com/rainers/cv2pdb">cv2pdb</a> tool to do so.</p>
- <p>To then use the built OpenBLAS shared library in Visual Studio:</p>
- <ol>
- <li>Copy the import library (<code>OPENBLAS_TOP_DIR/libopenblas.dll.a</code>) and the
- shared library (<code>libopenblas.dll</code>) into the same folder (this must be the
- folder of your project that is going to use the BLAS library. You may need
- to add <code>libopenblas.dll.a</code> to the linker input list: <code>properties->Linker->Input</code>).</li>
- <li>Please follow the Visual Studio documentation about using third-party .dll
- libraries, and make sure to link against a library for the correct
- architecture.<sup id="fnref:1"><a class="footnote-ref" href="#fn:1">1</a></sup></li>
- <li>If you need CBLAS, you should include <code>cblas.h</code> in
- <code>/your/installation/path/include</code> in Visual Studio. Please see
- <a href="http://github.com/OpenMathLib/OpenBLAS/issues/95">openblas#95</a> for more details.</li>
- </ol>
- <div class="admonition info">
- <p class="admonition-title">Limitations of using the MinGW build within Visual Studio</p>
- <ul>
- <li>Both static and dynamic linking are supported with MinGW. With Visual
- Studio, however, only dynamic linking is supported and so you should use
- the import library.</li>
- <li>Debugging from Visual Studio does not work because MinGW and Visual
- Studio have incompatible formats for debug information (PDB vs.
- DWARF/STABS). You should either debug with GDB on the command line or
- with a visual frontend, for instance <a href="http://www.eclipse.org/cdt/">Eclipse</a> or
- <a href="http://qt.nokia.com/products/developer-tools/">Qt Creator</a>.</li>
- </ul>
- </div>
- <h3 id="windows-on-arm">Windows on Arm</h3>
- <p>A fully functional native OpenBLAS for WoA that can be built as both a static and dynamic library using LLVM toolchain and Visual Studio 2022. Before starting to build, make sure that you have installed Visual Studio 2022 on your ARM device, including the "Desktop Development with C++" component (that contains the cmake tool).
- (Note that you can use the free "Visual Studio 2022 Community Edition" for this task. In principle it would be possible to build with VisualStudio alone, but using
- the LLVM toolchain enables native compilation of the Fortran sources of LAPACK and of all the optimized assembly files, which VisualStudio cannot handle on its own)</p>
- <ol>
- <li>
- <p>Clone OpenBLAS to your local machine and checkout to latest release of
- OpenBLAS (unless you want to build the latest development snapshot - here we
- are using the 0.3.28 release as the example, of course this exact version
- may be outdated by the time you read this)</p>
- <div class="highlight"><pre><span></span><code>git clone https://github.com/OpenMathLib/OpenBLAS.git
- cd OpenBLAS
- git checkout v0.3.28
- </code></pre></div>
- </li>
- <li>
- <p>Install Latest LLVM toolchain for WoA:</p>
- <p>Download the Latest LLVM toolchain for WoA from <a href="https://github.com/llvm/llvm-project/releases/tag/llvmorg-19.1.5">the Release
- page</a>. At
- the time of writing, this is version 19.1.5 - be sure to select the
- latest release for which you can find a precompiled package whose name ends
- in "-woa64.exe" (precompiled packages usually lag a week or two behind their
- corresponding source release). Make sure to enable the option
- <em>“Add LLVM to the system PATH for all the users”</em>.</p>
- <p>Note: Make sure that the path of LLVM toolchain is at the top of Environment
- Variables section to avoid conflicts between the set of compilers available
- in the system path</p>
- </li>
- <li>
- <p>Launch the Native Command Prompt for Windows ARM64:</p>
- <p>From the start menu search for <em>"ARM64 Native Tools Command Prompt for Visual
- Studio 2022"</em>. Alternatively open command prompt, run the following command to
- activate the environment:</p>
- <div class="highlight"><pre><span></span><code>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsarm64.bat
- </code></pre></div>
- </li>
- <li>
- <p>Navigate to the OpenBLAS source code directory and start building OpenBLAS
- by invoking Ninja:</p>
- <div class="highlight"><pre><span></span><code>cd OpenBLAS
- mkdir build
- cd build
-
- cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DTARGET=ARMV8 -DBINARY=64 -DCMAKE_C_COMPILER=clang-cl -DCMAKE_Fortran_COMPILER=flang-new
-
- ninja -j16
- </code></pre></div>
- <p>Note: You might want to include additional options in the cmake command
- here. For example, the default configuration only generates a
- <code>static.lib</code> version of the library. If you prefer a DLL, you can add
- <code>-DBUILD_SHARED_LIBS=ON</code>.</p>
- <p>Note that it is also possible to use the same setup to build OpenBLAS
- with Make, if you prefer Makefiles over the CMake build for some
- reason:</p>
- <div class="highlight"><pre><span></span><code>$ make CC=clang-cl FC=flang-new AR="llvm-ar" TARGET=ARMV8 ARCH=arm64 RANLIB="llvm-ranlib" MAKE=make
- </code></pre></div>
- </li>
- </ol>
- <h4 id="generating-an-import-library">Generating an import library</h4>
- <p>Microsoft Windows has this thing called "import libraries". You need it for
- MSVC; you don't need it for MinGW because the <code>ld</code> linker is smart enough -
- however, you may still want it for some reason, so we'll describe the process
- for both MSVC and MinGW.</p>
- <p>Import libraries are compiled from a list of what symbols to use, which are
- contained in a <code>.def</code> file. A <code>.def</code> file should be already be present in the
- <code>exports</code> directory under the top-level OpenBLAS directory after you've run a build.
- In your shell, move to this directory: <code>cd exports</code>.</p>
- <div class="tabbed-set tabbed-alternate" data-tabs="4:2"><input checked="checked" id="__tabbed_4_1" name="__tabbed_4" type="radio" /><input id="__tabbed_4_2" name="__tabbed_4" type="radio" /><div class="tabbed-labels"><label for="__tabbed_4_1">MSVC</label><label for="__tabbed_4_2">MinGW</label></div>
- <div class="tabbed-content">
- <div class="tabbed-block">
- <p>Unlike MinGW, MSVC absolutely requires an import library. Now the C ABI of
- MSVC and MinGW are actually identical, so linking is actually okay (any
- incompatibility in the C ABI would be a bug).</p>
- <p>The import libraries of MSVC have the suffix <code>.lib</code>. They are generated
- from a <code>.def</code> file using MSVC's <code>lib.exe</code>.</p>
- </div>
- <div class="tabbed-block">
- <p>MinGW import libraries have the suffix <code>.a</code>, just like static libraries.
- Our goal is to produce the file <code>libopenblas.dll.a</code>.</p>
- <p>You need to first insert a line <code>LIBRARY libopenblas.dll</code> in <code>libopenblas.def</code>:
- <div class="highlight"><pre><span></span><code>cat <(echo "LIBRARY libopenblas.dll") libopenblas.def > libopenblas.def.1
- mv libopenblas.def.1 libopenblas.def
- </code></pre></div></p>
- <p>Now the <code>.def</code> file probably looks like:
- <div class="highlight"><pre><span></span><code>LIBRARY libopenblas.dll
- EXPORTS
- caxpy=caxpy_ @1
- caxpy_=caxpy_ @2
- ...
- </code></pre></div>
- Then, generate the import library: <code>dlltool -d libopenblas.def -l libopenblas.dll.a</code></p>
- <p><em>Again, there is basically <strong>no point</strong> in making an import library for use in MinGW. It actually slows down linking.</em></p>
- </div>
- </div>
- </div>
- <h3 id="android">Android</h3>
- <p>To build OpenBLAS for Android, you will need the following tools installed on your machine:</p>
- <ul>
- <li><a href="https://developer.android.com/ndk/">The Android NDK</a></li>
- <li>Clang compiler on the build machine</li>
- </ul>
- <p>The next two sections below describe how to build with Clang for ARMV7 and
- ARMV8 targets, respectively. The same basic principles as described below for
- ARMV8 should also apply to building an x86 or x86-64 version (substitute
- something like <code>NEHALEM</code> for the target instead of <code>ARMV8</code>, and replace all the
- <code>aarch64</code> in the toolchain paths with <code>x86</code> or <code>x96_64</code> as appropriate).</p>
- <div class="admonition info">
- <p class="admonition-title">Historic note</p>
- <p>Since NDK version 19, the default toolchain is provided as a standalone
- toolchain, so building one yourself following
- <a href="http://developer.android.com/ndk/guides/standalone_toolchain.html">building a standalone toolchain</a>
- should no longer be necessary.</p>
- </div>
- <h4 id="building-for-armv7">Building for ARMV7</h4>
- <div class="highlight"><pre><span></span><code><span class="c1"># Set path to ndk-bundle</span>
- <span class="nb">export</span><span class="w"> </span><span class="nv">NDK_BUNDLE_DIR</span><span class="o">=</span>/path/to/ndk-bundle
-
- <span class="c1"># Set the PATH to contain paths to clang and arm-linux-androideabi-* utilities</span>
- <span class="nb">export</span><span class="w"> </span><span class="nv">PATH</span><span class="o">=</span><span class="si">${</span><span class="nv">NDK_BUNDLE_DIR</span><span class="si">}</span>/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:<span class="si">${</span><span class="nv">NDK_BUNDLE_DIR</span><span class="si">}</span>/toolchains/llvm/prebuilt/linux-x86_64/bin:<span class="nv">$PATH</span>
-
- <span class="c1"># Set LDFLAGS so that the linker finds the appropriate libgcc</span>
- <span class="nb">export</span><span class="w"> </span><span class="nv">LDFLAGS</span><span class="o">=</span><span class="s2">"-L</span><span class="si">${</span><span class="nv">NDK_BUNDLE_DIR</span><span class="si">}</span><span class="s2">/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x"</span>
-
- <span class="c1"># Set the clang cross compile flags</span>
- <span class="nb">export</span><span class="w"> </span><span class="nv">CLANG_FLAGS</span><span class="o">=</span><span class="s2">"-target arm-linux-androideabi -marm -mfpu=vfp -mfloat-abi=softfp --sysroot </span><span class="si">${</span><span class="nv">NDK_BUNDLE_DIR</span><span class="si">}</span><span class="s2">/platforms/android-23/arch-arm -gcc-toolchain </span><span class="si">${</span><span class="nv">NDK_BUNDLE_DIR</span><span class="si">}</span><span class="s2">/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/"</span>
-
- <span class="c1">#OpenBLAS Compile</span>
- make<span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>ARMV7<span class="w"> </span><span class="nv">ONLY_CBLAS</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="nv">AR</span><span class="o">=</span>ar<span class="w"> </span><span class="nv">CC</span><span class="o">=</span><span class="s2">"clang </span><span class="si">${</span><span class="nv">CLANG_FLAGS</span><span class="si">}</span><span class="s2">"</span><span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="nv">ARM_SOFTFP_ABI</span><span class="o">=</span><span class="m">1</span><span class="w"> </span>-j4
- </code></pre></div>
- <p>On macOS, it may also be necessary to give the complete path to the <code>ar</code>
- utility in the make command above, like so:
- <div class="highlight"><pre><span></span><code><span class="nv">AR</span><span class="o">=</span><span class="si">${</span><span class="nv">NDK_BUNDLE_DIR</span><span class="si">}</span>/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc-ar
- </code></pre></div>
- otherwise you may get a linker error complaining like <code>malformed archive header
- name at 8</code> when the native macOS <code>ar</code> command was invoked instead. Note that
- with recent NDK versions, the AR tool may be named <code>llvm-ar</code> rather than what
- is assumed above.</p>
- <h4 id="building-for-armv8">Building for ARMV8</h4>
- <p><div class="highlight"><pre><span></span><code><span class="c1"># Set path to ndk-bundle</span>
- <span class="nb">export</span><span class="w"> </span><span class="nv">NDK_BUNDLE_DIR</span><span class="o">=</span>/path/to/ndk-bundle/
-
- <span class="c1"># Export PATH to contain directories of clang and aarch64-linux-android-* utilities</span>
- <span class="nb">export</span><span class="w"> </span><span class="nv">PATH</span><span class="o">=</span><span class="si">${</span><span class="nv">NDK_BUNDLE_DIR</span><span class="si">}</span>/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/:<span class="si">${</span><span class="nv">NDK_BUNDLE_DIR</span><span class="si">}</span>/toolchains/llvm/prebuilt/linux-x86_64/bin:<span class="nv">$PATH</span>
-
- <span class="c1"># Setup LDFLAGS so that loader can find libgcc and pass -lm for sqrt</span>
- <span class="nb">export</span><span class="w"> </span><span class="nv">LDFLAGS</span><span class="o">=</span><span class="s2">"-L</span><span class="si">${</span><span class="nv">NDK_BUNDLE_DIR</span><span class="si">}</span><span class="s2">/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x -lm"</span>
-
- <span class="c1"># Setup the clang cross compile options</span>
- <span class="nb">export</span><span class="w"> </span><span class="nv">CLANG_FLAGS</span><span class="o">=</span><span class="s2">"-target aarch64-linux-android --sysroot </span><span class="si">${</span><span class="nv">NDK_BUNDLE_DIR</span><span class="si">}</span><span class="s2">/platforms/android-23/arch-arm64 -gcc-toolchain </span><span class="si">${</span><span class="nv">NDK_BUNDLE_DIR</span><span class="si">}</span><span class="s2">/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/"</span>
-
- <span class="c1"># Compile</span>
- make<span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>ARMV8<span class="w"> </span><span class="nv">ONLY_CBLAS</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="nv">AR</span><span class="o">=</span>ar<span class="w"> </span><span class="nv">CC</span><span class="o">=</span><span class="s2">"clang </span><span class="si">${</span><span class="nv">CLANG_FLAGS</span><span class="si">}</span><span class="s2">"</span><span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span>-j4
- </code></pre></div>
- Note: using <code>TARGET=CORTEXA57</code> in place of <code>ARMV8</code> will pick up better
- optimized routines. Implementations for the <code>CORTEXA57</code> target are compatible
- with all other <code>ARMV8</code> targets.</p>
- <p>Note: for NDK 23b, something as simple as:
- <div class="highlight"><pre><span></span><code><span class="nb">export</span><span class="w"> </span><span class="nv">PATH</span><span class="o">=</span>/opt/android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/:<span class="nv">$PATH</span>
- make<span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="nv">CC</span><span class="o">=</span>/opt/android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android31-clang<span class="w"> </span><span class="nv">ONLY_CBLAS</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>ARMV8
- </code></pre></div>
- appears to be sufficient on Linux. On OSX, setting AR to the ar provided in the
- "bin" path of the NDK (probably <code>llvm-ar</code>) is also necessary.</p>
- <details class="note">
- <summary>Alternative build script for 3 architectures</summary>
- <p>This script will build OpenBLAS for 3 architecture (<code>ARMV7</code>, <code>ARMV8</code>,
- <code>X86</code>) and install them to <code>/opt/OpenBLAS/lib</code>. Of course you can also copy
- only the section that is of interest to you - also notice that the <code>AR=</code>
- line may need adapting to the name of the ar tool provided in your
- <code>$TOOLCHAIN/bin</code> - for example <code>llvm-ar</code> in some recent NDK versions.
- It was tested on macOS with NDK version 21.3.6528147.</p>
- <p><div class="highlight"><pre><span></span><code><span class="nb">export</span><span class="w"> </span><span class="nv">NDK</span><span class="o">=</span>YOUR_PATH_TO_SDK/Android/sdk/ndk/21.3.6528147
- <span class="nb">export</span><span class="w"> </span><span class="nv">TOOLCHAIN</span><span class="o">=</span><span class="nv">$NDK</span>/toolchains/llvm/prebuilt/darwin-x86_64
-
- make<span class="w"> </span>clean
- make<span class="w"> </span><span class="se">\</span>
- <span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>ARMV7<span class="w"> </span><span class="se">\</span>
- <span class="w"> </span><span class="nv">ONLY_CBLAS</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="se">\</span>
- <span class="w"> </span><span class="nv">CC</span><span class="o">=</span><span class="s2">"</span><span class="nv">$TOOLCHAIN</span><span class="s2">"</span>/bin/armv7a-linux-androideabi21-clang<span class="w"> </span><span class="se">\</span>
- <span class="w"> </span><span class="nv">AR</span><span class="o">=</span><span class="s2">"</span><span class="nv">$TOOLCHAIN</span><span class="s2">"</span>/bin/arm-linux-androideabi-ar<span class="w"> </span><span class="se">\</span>
- <span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="se">\</span>
- <span class="w"> </span><span class="nv">ARM_SOFTFP_ABI</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="se">\</span>
- <span class="w"> </span>-j4
- sudo<span class="w"> </span>make<span class="w"> </span>install
-
- make<span class="w"> </span>clean
- make<span class="w"> </span><span class="se">\</span>
- <span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>CORTEXA57<span class="w"> </span><span class="se">\</span>
- <span class="w"> </span><span class="nv">ONLY_CBLAS</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="se">\</span>
- <span class="w"> </span><span class="nv">CC</span><span class="o">=</span><span class="nv">$TOOLCHAIN</span>/bin/aarch64-linux-android21-clang<span class="w"> </span><span class="se">\</span>
- <span class="w"> </span><span class="nv">AR</span><span class="o">=</span><span class="nv">$TOOLCHAIN</span>/bin/aarch64-linux-android-ar<span class="w"> </span><span class="se">\</span>
- <span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="se">\</span>
- -j4
- sudo<span class="w"> </span>make<span class="w"> </span>install
-
- make<span class="w"> </span>clean
- make<span class="w"> </span><span class="se">\</span>
- <span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>ATOM<span class="w"> </span><span class="se">\</span>
- <span class="w"> </span><span class="nv">ONLY_CBLAS</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="se">\</span>
- <span class="nv">CC</span><span class="o">=</span><span class="s2">"</span><span class="nv">$TOOLCHAIN</span><span class="s2">"</span>/bin/i686-linux-android21-clang<span class="w"> </span><span class="se">\</span>
- <span class="nv">AR</span><span class="o">=</span><span class="s2">"</span><span class="nv">$TOOLCHAIN</span><span class="s2">"</span>/bin/i686-linux-android-ar<span class="w"> </span><span class="se">\</span>
- <span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="se">\</span>
- <span class="nv">ARM_SOFTFP_ABI</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="se">\</span>
- -j4
- sudo<span class="w"> </span>make<span class="w"> </span>install
-
- <span class="c1">## This will build for x86_64 </span>
- make<span class="w"> </span>clean
- make<span class="w"> </span><span class="se">\</span>
- <span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>ATOM<span class="w"> </span><span class="nv">BINARY</span><span class="o">=</span><span class="m">64</span><span class="se">\</span>
- <span class="nv">ONLY_CBLAS</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="se">\</span>
- <span class="nv">CC</span><span class="o">=</span><span class="s2">"</span><span class="nv">$TOOLCHAIN</span><span class="s2">"</span>/bin/x86_64-linux-android21-clang<span class="w"> </span><span class="se">\</span>
- <span class="nv">AR</span><span class="o">=</span><span class="s2">"</span><span class="nv">$TOOLCHAIN</span><span class="s2">"</span>/bin/x86_64-linux-android-ar<span class="w"> </span><span class="se">\</span>
- <span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="se">\</span>
- <span class="nv">ARM_SOFTFP_ABI</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="se">\</span>
- -j4
- sudo<span class="w"> </span>make<span class="w"> </span>install
- </code></pre></div>
- You can find full list of target architectures in <a href="https://github.com/OpenMathLib/OpenBLAS/blob/develop/TargetList.txt">TargetList.txt</a></p>
- </details>
- <h3 id="iphoneios">iPhone/iOS</h3>
- <p>As none of the current developers uses iOS, the following instructions are what
- was found to work in our Azure CI setup, but as far as we know this builds a
- fully working OpenBLAS for this platform.</p>
- <p>Go to the directory where you unpacked OpenBLAS,and enter the following commands:
- <div class="highlight"><pre><span></span><code><span class="nv">CC</span><span class="o">=</span>/Applications/Xcode_12.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-
- <span class="nv">CFLAGS</span><span class="o">=</span><span class="w"> </span>-O2<span class="w"> </span>-Wno-macro-redefined<span class="w"> </span>-isysroot<span class="w"> </span>/Applications/Xcode_12.4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk<span class="w"> </span>-arch<span class="w"> </span>arm64<span class="w"> </span>-miphoneos-version-min<span class="o">=</span><span class="m">10</span>.0
-
- make<span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>ARMV8<span class="w"> </span><span class="nv">DYNAMIC_ARCH</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="nv">NUM_THREADS</span><span class="o">=</span><span class="m">32</span><span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span>clang<span class="w"> </span><span class="nv">NOFORTRAN</span><span class="o">=</span><span class="m">1</span>
- </code></pre></div>
- Adjust <code>MIN_IOS_VERSION</code> as necessary for your installation. E.g., change the version number
- to the minimum iOS version you want to target and execute this file to build the library.</p>
- <h3 id="harmonyos">HarmonyOS</h3>
- <p>For this target you will need the cross-compiler toolchain package by Huawei,
- which contains solutions for both Windows and Linux. Only the Linux-based
- toolchain has been tested so far, but the following instructions may apply
- similarly to Windows:</p>
- <p>Download <a href="https://repo.huaweicloud.com/harmonyos/os/4.1.1-Release/ohos-sdk-windows_linux-public.tar.gz">this HarmonyOS 4.1.1 SDK</a>,
- or whatever newer version may be available in the future). Use <code>tar -xvf
- ohos-sdk-windows_linux_public.tar.gz</code> to unpack it somewhere on your system.
- This will create a folder named "ohos-sdk" with subfolders "linux" and
- "windows". In the linux one you will find a ZIP archive named
- <code>native-linux-x64-4.1.7.8-Release.zip</code> - you need to unzip this where you want
- to install the cross-compiler, for example in <code>/opt/ohos-sdk</code>.</p>
- <p>In the directory where you unpacked OpenBLAS, create a build directory for cmake, and change into it :
- <div class="highlight"><pre><span></span><code>mkdir<span class="w"> </span>build
- <span class="nb">cd</span><span class="w"> </span>build
- </code></pre></div>
- Use the version of <code>cmake</code> that came with the SDK, and specify the location of
- its toolchain file as a cmake option. Also set the build target for OpenBLAS to
- <code>ARMV8</code> and specify <code>NOFORTRAN=1</code> (at least as of version 4.1.1, the SDK
- contains no Fortran compiler):
- <div class="highlight"><pre><span></span><code>/opt/ohos-sdk/linux/native/build-tools/cmake/bin/cmake<span class="w"> </span><span class="se">\</span>
- <span class="w"> </span>-DCMAKE_TOOLCHAIN_FILE<span class="o">=</span>/opt/ohos-sdk/linux/native/build/cmake/ohos.toolchain.cmake<span class="w"> </span><span class="se">\</span>
- <span class="w"> </span>-DOHOS_ARCH<span class="o">=</span><span class="s2">"arm64-v8a"</span><span class="w"> </span>-DTARGET<span class="o">=</span>ARMV8<span class="w"> </span>-DNOFORTRAN<span class="o">=</span><span class="m">1</span><span class="w"> </span>..
- </code></pre></div>
- Additional other OpenBLAS build options like <code>USE_OPENMP=1</code> or <code>DYNAMIC_ARCH=1</code>
- will probably work too. Finally do the build:
- <div class="highlight"><pre><span></span><code>/opt/ohos-sdk/linux/native/build-tools/cmake/bin/cmake<span class="w"> </span>--build<span class="w"> </span>.
- </code></pre></div></p>
- <h3 id="mips">MIPS</h3>
- <p>For MIPS targets you will need latest toolchains:</p>
- <ul>
- <li>P5600 - MTI GNU/Linux Toolchain</li>
- <li>I6400, P6600 - IMG GNU/Linux Toolchain</li>
- </ul>
- <p>You can use following commandlines for builds:</p>
- <div class="highlight"><pre><span></span><code><span class="nv">IMG_TOOLCHAIN_DIR</span><span class="o">={</span>full<span class="w"> </span>IMG<span class="w"> </span>GNU/Linux<span class="w"> </span>Toolchain<span class="w"> </span>path<span class="w"> </span>including<span class="w"> </span><span class="s2">"bin"</span><span class="w"> </span>directory<span class="w"> </span>--<span class="w"> </span><span class="k">for</span><span class="w"> </span>example,<span class="w"> </span>/opt/linux_toolchain/bin<span class="o">}</span>
- <span class="nv">IMG_GCC_PREFIX</span><span class="o">=</span>mips-img-linux-gnu
- <span class="nv">IMG_TOOLCHAIN</span><span class="o">=</span><span class="si">${</span><span class="nv">IMG_TOOLCHAIN_DIR</span><span class="si">}</span>/<span class="si">${</span><span class="nv">IMG_GCC_PREFIX</span><span class="si">}</span>
-
- <span class="c1"># I6400 Build (n32):</span>
- make<span class="w"> </span><span class="nv">BINARY</span><span class="o">=</span><span class="m">32</span><span class="w"> </span><span class="nv">BINARY32</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="nv">CC</span><span class="o">=</span><span class="nv">$IMG_TOOLCHAIN</span>-gcc<span class="w"> </span><span class="nv">AR</span><span class="o">=</span><span class="nv">$IMG_TOOLCHAIN</span>-ar<span class="w"> </span><span class="nv">FC</span><span class="o">=</span><span class="s2">"</span><span class="nv">$IMG_TOOLCHAIN</span><span class="s2">-gfortran -EL -mabi=n32"</span><span class="w"> </span><span class="nv">RANLIB</span><span class="o">=</span><span class="nv">$IMG_TOOLCHAIN</span>-ranlib<span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="nv">CFLAGS</span><span class="o">=</span><span class="s2">"-EL"</span><span class="w"> </span><span class="nv">FFLAGS</span><span class="o">=</span><span class="nv">$CFLAGS</span><span class="w"> </span><span class="nv">LDFLAGS</span><span class="o">=</span><span class="nv">$CFLAGS</span><span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>I6400
-
- <span class="c1"># I6400 Build (n64):</span>
- make<span class="w"> </span><span class="nv">BINARY</span><span class="o">=</span><span class="m">64</span><span class="w"> </span><span class="nv">BINARY64</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="nv">CC</span><span class="o">=</span><span class="nv">$IMG_TOOLCHAIN</span>-gcc<span class="w"> </span><span class="nv">AR</span><span class="o">=</span><span class="nv">$IMG_TOOLCHAIN</span>-ar<span class="w"> </span><span class="nv">FC</span><span class="o">=</span><span class="s2">"</span><span class="nv">$IMG_TOOLCHAIN</span><span class="s2">-gfortran -EL"</span><span class="w"> </span><span class="nv">RANLIB</span><span class="o">=</span><span class="nv">$IMG_TOOLCHAIN</span>-ranlib<span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="nv">CFLAGS</span><span class="o">=</span><span class="s2">"-EL"</span><span class="w"> </span><span class="nv">FFLAGS</span><span class="o">=</span><span class="nv">$CFLAGS</span><span class="w"> </span><span class="nv">LDFLAGS</span><span class="o">=</span><span class="nv">$CFLAGS</span><span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>I6400
-
- <span class="c1"># P6600 Build (n32):</span>
- make<span class="w"> </span><span class="nv">BINARY</span><span class="o">=</span><span class="m">32</span><span class="w"> </span><span class="nv">BINARY32</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="nv">CC</span><span class="o">=</span><span class="nv">$IMG_TOOLCHAIN</span>-gcc<span class="w"> </span><span class="nv">AR</span><span class="o">=</span><span class="nv">$IMG_TOOLCHAIN</span>-ar<span class="w"> </span><span class="nv">FC</span><span class="o">=</span><span class="s2">"</span><span class="nv">$IMG_TOOLCHAIN</span><span class="s2">-gfortran -EL -mabi=n32"</span><span class="w"> </span><span class="nv">RANLIB</span><span class="o">=</span><span class="nv">$IMG_TOOLCHAIN</span>-ranlib<span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="nv">CFLAGS</span><span class="o">=</span><span class="s2">"-EL"</span><span class="w"> </span><span class="nv">FFLAGS</span><span class="o">=</span><span class="nv">$CFLAGS</span><span class="w"> </span><span class="nv">LDFLAGS</span><span class="o">=</span><span class="nv">$CFLAGS</span><span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>P6600
-
- <span class="c1"># P6600 Build (n64):</span>
- make<span class="w"> </span><span class="nv">BINARY</span><span class="o">=</span><span class="m">64</span><span class="w"> </span><span class="nv">BINARY64</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="nv">CC</span><span class="o">=</span><span class="nv">$IMG_TOOLCHAIN</span>-gcc<span class="w"> </span><span class="nv">AR</span><span class="o">=</span><span class="nv">$IMG_TOOLCHAIN</span>-ar<span class="w"> </span><span class="nv">FC</span><span class="o">=</span><span class="s2">"</span><span class="nv">$IMG_TOOLCHAIN</span><span class="s2">-gfortran -EL"</span><span class="w"> </span><span class="nv">RANLIB</span><span class="o">=</span><span class="nv">$IMG_TOOLCHAIN</span>-ranlib<span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="nv">CFLAGS</span><span class="o">=</span><span class="s2">"-EL"</span><span class="w"> </span><span class="nv">FFLAGS</span><span class="o">=</span><span class="s2">"</span><span class="nv">$CFLAGS</span><span class="s2">"</span><span class="w"> </span><span class="nv">LDFLAGS</span><span class="o">=</span><span class="s2">"</span><span class="nv">$CFLAGS</span><span class="s2">"</span><span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>P6600
-
- <span class="nv">MTI_TOOLCHAIN_DIR</span><span class="o">={</span>full<span class="w"> </span>MTI<span class="w"> </span>GNU/Linux<span class="w"> </span>Toolchain<span class="w"> </span>path<span class="w"> </span>including<span class="w"> </span><span class="s2">"bin"</span><span class="w"> </span>directory<span class="w"> </span>--<span class="w"> </span><span class="k">for</span><span class="w"> </span>example,<span class="w"> </span>/opt/linux_toolchain/bin<span class="o">}</span>
- <span class="nv">MTI_GCC_PREFIX</span><span class="o">=</span>mips-mti-linux-gnu
- <span class="nv">MTI_TOOLCHAIN</span><span class="o">=</span><span class="si">${</span><span class="nv">IMG_TOOLCHAIN_DIR</span><span class="si">}</span>/<span class="si">${</span><span class="nv">IMG_GCC_PREFIX</span><span class="si">}</span>
-
- <span class="c1"># P5600 Build:</span>
-
- make<span class="w"> </span><span class="nv">BINARY</span><span class="o">=</span><span class="m">32</span><span class="w"> </span><span class="nv">BINARY32</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="nv">CC</span><span class="o">=</span><span class="nv">$MTI_TOOLCHAIN</span>-gcc<span class="w"> </span><span class="nv">AR</span><span class="o">=</span><span class="nv">$MTI_TOOLCHAIN</span>-ar<span class="w"> </span><span class="nv">FC</span><span class="o">=</span><span class="s2">"</span><span class="nv">$MTI_TOOLCHAIN</span><span class="s2">-gfortran -EL"</span><span class="w"> </span><span class="nv">RANLIB</span><span class="o">=</span><span class="nv">$MTI_TOOLCHAIN</span>-ranlib<span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="nv">CFLAGS</span><span class="o">=</span><span class="s2">"-EL"</span><span class="w"> </span><span class="nv">FFLAGS</span><span class="o">=</span><span class="nv">$CFLAGS</span><span class="w"> </span><span class="nv">LDFLAGS</span><span class="o">=</span><span class="nv">$CFLAGS</span><span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>P5600
- </code></pre></div>
- <h3 id="freebsd_1">FreeBSD</h3>
- <p>You will need to install the following tools from the FreeBSD ports tree:</p>
- <ul>
- <li>lang/gcc</li>
- <li>lang/perl5.12</li>
- <li>ftp/curl</li>
- <li>devel/gmake</li>
- <li>devel/patch</li>
- </ul>
- <p>To compile run the command:
- <div class="highlight"><pre><span></span><code>$<span class="w"> </span>gmake<span class="w"> </span><span class="nv">CC</span><span class="o">=</span>gcc<span class="w"> </span><span class="nv">FC</span><span class="o">=</span>gfortran
- </code></pre></div></p>
- <h3 id="cortex-m">Cortex-M</h3>
- <p>Cortex-M is a widely used microcontroller that is present in a variety of
- industrial and consumer electronics. A common variant of the Cortex-M is the
- <code>STM32F4xx</code> series. Here, we will give instructions for building for that
- series.</p>
- <p>First, install the embedded Arm GCC compiler from the Arm website. Then, create
- the following <code>toolchain.cmake</code> file:</p>
- <div class="highlight"><pre><span></span><code><span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_SYSTEM_NAME</span><span class="w"> </span><span class="s">Generic</span><span class="p">)</span>
- <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_SYSTEM_PROCESSOR</span><span class="w"> </span><span class="s">arm</span><span class="p">)</span>
-
- <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_C_COMPILER</span><span class="w"> </span><span class="s2">"arm-none-eabi-gcc.exe"</span><span class="p">)</span>
- <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_CXX_COMPILER</span><span class="w"> </span><span class="s2">"arm-none-eabi-g++.exe"</span><span class="p">)</span>
-
- <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_EXE_LINKER_FLAGS</span><span class="w"> </span><span class="s2">"--specs=nosys.specs"</span><span class="w"> </span><span class="s">CACHE</span><span class="w"> </span><span class="s">INTERNAL</span><span class="w"> </span><span class="s2">""</span><span class="p">)</span>
-
- <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_FIND_ROOT_PATH_MODE_PROGRAM</span><span class="w"> </span><span class="s">NEVER</span><span class="p">)</span>
- <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_FIND_ROOT_PATH_MODE_LIBRARY</span><span class="w"> </span><span class="s">ONLY</span><span class="p">)</span>
- <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_FIND_ROOT_PATH_MODE_INCLUDE</span><span class="w"> </span><span class="s">ONLY</span><span class="p">)</span>
- <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_FIND_ROOT_PATH_MODE_PACKAGE</span><span class="w"> </span><span class="s">ONLY</span><span class="p">)</span>
- </code></pre></div>
- <p>Then build OpenBLAS with:
- <div class="highlight"><pre><span></span><code>$<span class="w"> </span>cmake<span class="w"> </span>..<span class="w"> </span>-G<span class="w"> </span>Ninja<span class="w"> </span>-DCMAKE_C_COMPILER<span class="o">=</span>arm-none-eabi-gcc<span class="w"> </span>-DCMAKE_TOOLCHAIN_FILE:PATH<span class="o">=</span><span class="s2">"toolchain.cmake"</span><span class="w"> </span>-DNOFORTRAN<span class="o">=</span><span class="m">1</span><span class="w"> </span>-DTARGET<span class="o">=</span>ARMV5<span class="w"> </span>-DEMBEDDED<span class="o">=</span><span class="m">1</span>
- </code></pre></div></p>
- <p>In your embedded application, the following functions need to be provided for OpenBLAS to work correctly:
- <div class="highlight"><pre><span></span><code><span class="kt">void</span><span class="w"> </span><span class="nf">free</span><span class="p">(</span><span class="kt">void</span><span class="o">*</span><span class="w"> </span><span class="n">ptr</span><span class="p">);</span>
- <span class="kt">void</span><span class="o">*</span><span class="w"> </span><span class="nf">malloc</span><span class="p">(</span><span class="kt">size_t</span><span class="w"> </span><span class="n">size</span><span class="p">);</span>
- </code></pre></div></p>
- <div class="admonition note">
- <p class="admonition-title">Note</p>
- <p>If you are developing for an embedded platform, it is your responsibility
- to make sure that the device has sufficient memory for <code>malloc</code> calls.
- <a href="https://github.com/embeddedartistry/libmemory">Libmemory</a>
- provides one implementation of <code>malloc</code> for embedded platforms.</p>
- </div>
- <div class="footnote">
- <hr />
- <ol>
- <li id="fn:1">
- <p>If the OpenBLAS DLLs are not linked correctly, you may see an error like
- <em>"The application was unable to start correctly (0xc000007b)"</em>, which typically
- indicates a mismatch between 32-bit and 64-bit libraries. <a class="footnote-backref" href="#fnref:1" title="Jump back to footnote 1 in the text">↩</a></p>
- </li>
- </ol>
- </div>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <aside class="md-source-file">
-
-
- <span class="md-source-file__fact">
- <span class="md-icon" title="Last update">
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 13.1c-.1 0-.3.1-.4.2l-1 1 2.1 2.1 1-1c.2-.2.2-.6 0-.8l-1.3-1.3c-.1-.1-.2-.2-.4-.2m-1.9 1.8-6.1 6V23h2.1l6.1-6.1zM12.5 7v5.2l4 2.4-1 1L11 13V7zM11 21.9c-5.1-.5-9-4.8-9-9.9C2 6.5 6.5 2 12 2c5.3 0 9.6 4.1 10 9.3-.3-.1-.6-.2-1-.2s-.7.1-1 .2C19.6 7.2 16.2 4 12 4c-4.4 0-8 3.6-8 8 0 4.1 3.1 7.5 7.1 7.9l-.1.2z"/></svg>
- </span>
- <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date" title="January 26, 2025 17:36:58 UTC">January 26, 2025</span>
- </span>
-
-
-
-
- <span class="md-source-file__fact">
- <span class="md-icon" title="Created">
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14.47 15.08 11 13V7h1.5v5.25l3.08 1.83c-.41.28-.79.62-1.11 1m-1.39 4.84c-.36.05-.71.08-1.08.08-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8c0 .37-.03.72-.08 1.08.69.1 1.33.32 1.92.64.1-.56.16-1.13.16-1.72 0-5.5-4.5-10-10-10S2 6.5 2 12s4.47 10 10 10c.59 0 1.16-.06 1.72-.16-.32-.59-.54-1.23-.64-1.92M18 15v3h-3v2h3v3h2v-3h3v-2h-3v-3z"/></svg>
- </span>
- <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date" title="August 4, 2023 07:21:01 UTC">August 4, 2023</span>
- </span>
-
-
-
-
- </aside>
-
-
-
-
-
-
- </article>
- </div>
-
-
- <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
- </div>
-
- </main>
-
- <footer class="md-footer">
-
- <div class="md-footer-meta md-typeset">
- <div class="md-footer-meta__inner md-grid">
- <div class="md-copyright">
-
- <div class="md-copyright__highlight">
- Copyright © 2012- OpenBLAS contributors
- </div>
-
-
- Made with
- <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
- Material for MkDocs
- </a>
-
- </div>
-
- <div class="md-social">
-
-
-
-
-
-
-
-
- <a href="https://github.com/OpenMathLib/OpenBLAS" target="_blank" rel="noopener" title="github.com" class="md-social__link">
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6m-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3m44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9M244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8M97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1m-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7m32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1m-11.4-14.7c-1.6 1-1.6 3.6 0 5.9s4.3 3.3 5.6 2.3c1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2"/></svg>
- </a>
-
-
-
-
-
-
-
-
- <a href="https://github.com/OpenMathLib/OpenBLAS/LICENSE" target="_blank" rel="noopener" title="github.com" class="md-social__link">
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9 10a3.04 3.04 0 0 1 3-3 3.04 3.04 0 0 1 3 3 3.04 3.04 0 0 1-3 3 3.04 3.04 0 0 1-3-3m3 9 4 1v-3.08A7.54 7.54 0 0 1 12 18a7.54 7.54 0 0 1-4-1.08V20m4-16a5.78 5.78 0 0 0-4.24 1.74A5.78 5.78 0 0 0 6 10a5.78 5.78 0 0 0 1.76 4.23A5.78 5.78 0 0 0 12 16a5.78 5.78 0 0 0 4.24-1.77A5.78 5.78 0 0 0 18 10a5.78 5.78 0 0 0-1.76-4.26A5.78 5.78 0 0 0 12 4m8 6a8 8 0 0 1-.57 2.8A7.8 7.8 0 0 1 18 15.28V23l-6-2-6 2v-7.72A7.9 7.9 0 0 1 4 10a7.68 7.68 0 0 1 2.33-5.64A7.73 7.73 0 0 1 12 2a7.73 7.73 0 0 1 5.67 2.36A7.68 7.68 0 0 1 20 10"/></svg>
- </a>
-
- </div>
-
- </div>
- </div>
- </footer>
-
- </div>
- <div class="md-dialog" data-md-component="dialog">
- <div class="md-dialog__inner md-typeset"></div>
- </div>
-
-
-
-
- <script id="__config" type="application/json">{"base": "..", "features": ["header.autohide"], "search": "../assets/javascripts/workers/search.d50fe291.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
-
-
- <script src="../assets/javascripts/bundle.13a4f30d.min.js"></script>
-
-
- </body>
- </html>
|