You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.html 90 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829
  1. <!doctype html>
  2. <html lang="en" class="no-js">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1">
  6. <link rel="canonical" href="https://openblas.net/docs/install/">
  7. <link rel="prev" href="..">
  8. <link rel="next" href="../user_manual/">
  9. <link rel="icon" href="../logo.svg">
  10. <meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.6.14">
  11. <title>Install OpenBLAS - OpenBLAS</title>
  12. <link rel="stylesheet" href="../assets/stylesheets/main.342714a4.min.css">
  13. <link rel="stylesheet" href="../assets/stylesheets/palette.06af60db.min.css">
  14. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  15. <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">
  16. <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
  17. <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>
  18. </head>
  19. <body dir="ltr" data-md-color-scheme="slate" data-md-color-primary="blue-grey" data-md-color-accent="indigo">
  20. <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
  21. <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
  22. <label class="md-overlay" for="__drawer"></label>
  23. <div data-md-component="skip">
  24. <a href="#install-openblas" class="md-skip">
  25. Skip to content
  26. </a>
  27. </div>
  28. <div data-md-component="announce">
  29. </div>
  30. <header class="md-header md-header--shadow" data-md-component="header">
  31. <nav class="md-header__inner md-grid" aria-label="Header">
  32. <a href=".." title="OpenBLAS" class="md-header__button md-logo" aria-label="OpenBLAS" data-md-component="logo">
  33. <img src="../logo.svg" alt="logo">
  34. </a>
  35. <label class="md-header__button md-icon" for="__drawer">
  36. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
  37. </label>
  38. <div class="md-header__title" data-md-component="header-title">
  39. <div class="md-header__ellipsis">
  40. <div class="md-header__topic">
  41. <span class="md-ellipsis">
  42. OpenBLAS
  43. </span>
  44. </div>
  45. <div class="md-header__topic" data-md-component="header-topic">
  46. <span class="md-ellipsis">
  47. Install OpenBLAS
  48. </span>
  49. </div>
  50. </div>
  51. </div>
  52. <form class="md-header__option" data-md-component="palette">
  53. <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">
  54. <label class="md-header__button md-icon" title="Switch to light mode" for="__palette_1" hidden>
  55. <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>
  56. </label>
  57. <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">
  58. <label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_0" hidden>
  59. <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>
  60. </label>
  61. </form>
  62. <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>
  63. <label class="md-header__button md-icon" for="__search">
  64. <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>
  65. </label>
  66. <div class="md-search" data-md-component="search" role="dialog">
  67. <label class="md-search__overlay" for="__search"></label>
  68. <div class="md-search__inner" role="search">
  69. <form class="md-search__form" name="search">
  70. <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>
  71. <label class="md-search__icon md-icon" for="__search">
  72. <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>
  73. <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>
  74. </label>
  75. <nav class="md-search__options" aria-label="Search">
  76. <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
  77. <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>
  78. </button>
  79. </nav>
  80. </form>
  81. <div class="md-search__output">
  82. <div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
  83. <div class="md-search-result" data-md-component="search-result">
  84. <div class="md-search-result__meta">
  85. Initializing search
  86. </div>
  87. <ol class="md-search-result__list" role="presentation"></ol>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. <div class="md-header__source">
  94. <a href="https://github.com/OpenMathLib/OpenBLAS" title="Go to repository" class="md-source" data-md-component="source">
  95. <div class="md-source__icon md-icon">
  96. <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>
  97. </div>
  98. <div class="md-source__repository">
  99. GitHub
  100. </div>
  101. </a>
  102. </div>
  103. </nav>
  104. </header>
  105. <div class="md-container" data-md-component="container">
  106. <main class="md-main" data-md-component="main">
  107. <div class="md-main__inner md-grid">
  108. <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
  109. <div class="md-sidebar__scrollwrap">
  110. <div class="md-sidebar__inner">
  111. <nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
  112. <label class="md-nav__title" for="__drawer">
  113. <a href=".." title="OpenBLAS" class="md-nav__button md-logo" aria-label="OpenBLAS" data-md-component="logo">
  114. <img src="../logo.svg" alt="logo">
  115. </a>
  116. OpenBLAS
  117. </label>
  118. <div class="md-nav__source">
  119. <a href="https://github.com/OpenMathLib/OpenBLAS" title="Go to repository" class="md-source" data-md-component="source">
  120. <div class="md-source__icon md-icon">
  121. <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>
  122. </div>
  123. <div class="md-source__repository">
  124. GitHub
  125. </div>
  126. </a>
  127. </div>
  128. <ul class="md-nav__list" data-md-scrollfix>
  129. <li class="md-nav__item">
  130. <a href=".." class="md-nav__link">
  131. <span class="md-ellipsis">
  132. Home
  133. </span>
  134. </a>
  135. </li>
  136. <li class="md-nav__item md-nav__item--active">
  137. <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
  138. <label class="md-nav__link md-nav__link--active" for="__toc">
  139. <span class="md-ellipsis">
  140. Install OpenBLAS
  141. </span>
  142. <span class="md-nav__icon md-icon"></span>
  143. </label>
  144. <a href="./" class="md-nav__link md-nav__link--active">
  145. <span class="md-ellipsis">
  146. Install OpenBLAS
  147. </span>
  148. </a>
  149. <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  150. <label class="md-nav__title" for="__toc">
  151. <span class="md-nav__icon md-icon"></span>
  152. Table of contents
  153. </label>
  154. <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
  155. <li class="md-nav__item">
  156. <a href="#installing-with-a-package-manager" class="md-nav__link">
  157. <span class="md-ellipsis">
  158. Installing with a package manager
  159. </span>
  160. </a>
  161. <nav class="md-nav" aria-label="Installing with a package manager">
  162. <ul class="md-nav__list">
  163. <li class="md-nav__item">
  164. <a href="#linux" class="md-nav__link">
  165. <span class="md-ellipsis">
  166. Linux
  167. </span>
  168. </a>
  169. </li>
  170. <li class="md-nav__item">
  171. <a href="#windows" class="md-nav__link">
  172. <span class="md-ellipsis">
  173. Windows
  174. </span>
  175. </a>
  176. </li>
  177. <li class="md-nav__item">
  178. <a href="#macos" class="md-nav__link">
  179. <span class="md-ellipsis">
  180. macOS
  181. </span>
  182. </a>
  183. </li>
  184. <li class="md-nav__item">
  185. <a href="#freebsd" class="md-nav__link">
  186. <span class="md-ellipsis">
  187. FreeBSD
  188. </span>
  189. </a>
  190. </li>
  191. </ul>
  192. </nav>
  193. </li>
  194. <li class="md-nav__item">
  195. <a href="#building-from-source" class="md-nav__link">
  196. <span class="md-ellipsis">
  197. Building from source
  198. </span>
  199. </a>
  200. <nav class="md-nav" aria-label="Building from source">
  201. <ul class="md-nav__list">
  202. <li class="md-nav__item">
  203. <a href="#linux-and-macos" class="md-nav__link">
  204. <span class="md-ellipsis">
  205. Linux and macOS
  206. </span>
  207. </a>
  208. </li>
  209. <li class="md-nav__item">
  210. <a href="#windows_1" class="md-nav__link">
  211. <span class="md-ellipsis">
  212. Windows
  213. </span>
  214. </a>
  215. <nav class="md-nav" aria-label="Windows">
  216. <ul class="md-nav__list">
  217. <li class="md-nav__item">
  218. <a href="#visual-studio-native-windows-abi" class="md-nav__link">
  219. <span class="md-ellipsis">
  220. Visual Studio &amp; native Windows ABI
  221. </span>
  222. </a>
  223. </li>
  224. <li class="md-nav__item">
  225. <a href="#mingw-gnu-abi" class="md-nav__link">
  226. <span class="md-ellipsis">
  227. MinGW &amp; GNU ABI
  228. </span>
  229. </a>
  230. </li>
  231. </ul>
  232. </nav>
  233. </li>
  234. <li class="md-nav__item">
  235. <a href="#windows-on-arm" class="md-nav__link">
  236. <span class="md-ellipsis">
  237. Windows on Arm
  238. </span>
  239. </a>
  240. <nav class="md-nav" aria-label="Windows on Arm">
  241. <ul class="md-nav__list">
  242. <li class="md-nav__item">
  243. <a href="#generating-an-import-library" class="md-nav__link">
  244. <span class="md-ellipsis">
  245. Generating an import library
  246. </span>
  247. </a>
  248. </li>
  249. </ul>
  250. </nav>
  251. </li>
  252. <li class="md-nav__item">
  253. <a href="#android" class="md-nav__link">
  254. <span class="md-ellipsis">
  255. Android
  256. </span>
  257. </a>
  258. <nav class="md-nav" aria-label="Android">
  259. <ul class="md-nav__list">
  260. <li class="md-nav__item">
  261. <a href="#building-for-armv7" class="md-nav__link">
  262. <span class="md-ellipsis">
  263. Building for ARMV7
  264. </span>
  265. </a>
  266. </li>
  267. <li class="md-nav__item">
  268. <a href="#building-for-armv8" class="md-nav__link">
  269. <span class="md-ellipsis">
  270. Building for ARMV8
  271. </span>
  272. </a>
  273. </li>
  274. </ul>
  275. </nav>
  276. </li>
  277. <li class="md-nav__item">
  278. <a href="#iphoneios" class="md-nav__link">
  279. <span class="md-ellipsis">
  280. iPhone/iOS
  281. </span>
  282. </a>
  283. </li>
  284. <li class="md-nav__item">
  285. <a href="#harmonyos" class="md-nav__link">
  286. <span class="md-ellipsis">
  287. HarmonyOS
  288. </span>
  289. </a>
  290. </li>
  291. <li class="md-nav__item">
  292. <a href="#mips" class="md-nav__link">
  293. <span class="md-ellipsis">
  294. MIPS
  295. </span>
  296. </a>
  297. </li>
  298. <li class="md-nav__item">
  299. <a href="#freebsd_1" class="md-nav__link">
  300. <span class="md-ellipsis">
  301. FreeBSD
  302. </span>
  303. </a>
  304. </li>
  305. <li class="md-nav__item">
  306. <a href="#cortex-m" class="md-nav__link">
  307. <span class="md-ellipsis">
  308. Cortex-M
  309. </span>
  310. </a>
  311. </li>
  312. </ul>
  313. </nav>
  314. </li>
  315. </ul>
  316. </nav>
  317. </li>
  318. <li class="md-nav__item">
  319. <a href="../user_manual/" class="md-nav__link">
  320. <span class="md-ellipsis">
  321. User manual
  322. </span>
  323. </a>
  324. </li>
  325. <li class="md-nav__item">
  326. <a href="../extensions/" class="md-nav__link">
  327. <span class="md-ellipsis">
  328. Extensions
  329. </span>
  330. </a>
  331. </li>
  332. <li class="md-nav__item">
  333. <a href="../developers/" class="md-nav__link">
  334. <span class="md-ellipsis">
  335. Developer manual
  336. </span>
  337. </a>
  338. </li>
  339. <li class="md-nav__item">
  340. <a href="../build_system/" class="md-nav__link">
  341. <span class="md-ellipsis">
  342. Build system
  343. </span>
  344. </a>
  345. </li>
  346. <li class="md-nav__item">
  347. <a href="../runtime_variables/" class="md-nav__link">
  348. <span class="md-ellipsis">
  349. Runtime variables
  350. </span>
  351. </a>
  352. </li>
  353. <li class="md-nav__item">
  354. <a href="../distributing/" class="md-nav__link">
  355. <span class="md-ellipsis">
  356. Redistributing OpenBLAS
  357. </span>
  358. </a>
  359. </li>
  360. <li class="md-nav__item">
  361. <a href="../ci/" class="md-nav__link">
  362. <span class="md-ellipsis">
  363. CI jobs
  364. </span>
  365. </a>
  366. </li>
  367. <li class="md-nav__item">
  368. <a href="../about/" class="md-nav__link">
  369. <span class="md-ellipsis">
  370. About
  371. </span>
  372. </a>
  373. </li>
  374. <li class="md-nav__item">
  375. <a href="../faq/" class="md-nav__link">
  376. <span class="md-ellipsis">
  377. FAQ
  378. </span>
  379. </a>
  380. </li>
  381. </ul>
  382. </nav>
  383. </div>
  384. </div>
  385. </div>
  386. <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
  387. <div class="md-sidebar__scrollwrap">
  388. <div class="md-sidebar__inner">
  389. <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  390. <label class="md-nav__title" for="__toc">
  391. <span class="md-nav__icon md-icon"></span>
  392. Table of contents
  393. </label>
  394. <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
  395. <li class="md-nav__item">
  396. <a href="#installing-with-a-package-manager" class="md-nav__link">
  397. <span class="md-ellipsis">
  398. Installing with a package manager
  399. </span>
  400. </a>
  401. <nav class="md-nav" aria-label="Installing with a package manager">
  402. <ul class="md-nav__list">
  403. <li class="md-nav__item">
  404. <a href="#linux" class="md-nav__link">
  405. <span class="md-ellipsis">
  406. Linux
  407. </span>
  408. </a>
  409. </li>
  410. <li class="md-nav__item">
  411. <a href="#windows" class="md-nav__link">
  412. <span class="md-ellipsis">
  413. Windows
  414. </span>
  415. </a>
  416. </li>
  417. <li class="md-nav__item">
  418. <a href="#macos" class="md-nav__link">
  419. <span class="md-ellipsis">
  420. macOS
  421. </span>
  422. </a>
  423. </li>
  424. <li class="md-nav__item">
  425. <a href="#freebsd" class="md-nav__link">
  426. <span class="md-ellipsis">
  427. FreeBSD
  428. </span>
  429. </a>
  430. </li>
  431. </ul>
  432. </nav>
  433. </li>
  434. <li class="md-nav__item">
  435. <a href="#building-from-source" class="md-nav__link">
  436. <span class="md-ellipsis">
  437. Building from source
  438. </span>
  439. </a>
  440. <nav class="md-nav" aria-label="Building from source">
  441. <ul class="md-nav__list">
  442. <li class="md-nav__item">
  443. <a href="#linux-and-macos" class="md-nav__link">
  444. <span class="md-ellipsis">
  445. Linux and macOS
  446. </span>
  447. </a>
  448. </li>
  449. <li class="md-nav__item">
  450. <a href="#windows_1" class="md-nav__link">
  451. <span class="md-ellipsis">
  452. Windows
  453. </span>
  454. </a>
  455. <nav class="md-nav" aria-label="Windows">
  456. <ul class="md-nav__list">
  457. <li class="md-nav__item">
  458. <a href="#visual-studio-native-windows-abi" class="md-nav__link">
  459. <span class="md-ellipsis">
  460. Visual Studio &amp; native Windows ABI
  461. </span>
  462. </a>
  463. </li>
  464. <li class="md-nav__item">
  465. <a href="#mingw-gnu-abi" class="md-nav__link">
  466. <span class="md-ellipsis">
  467. MinGW &amp; GNU ABI
  468. </span>
  469. </a>
  470. </li>
  471. </ul>
  472. </nav>
  473. </li>
  474. <li class="md-nav__item">
  475. <a href="#windows-on-arm" class="md-nav__link">
  476. <span class="md-ellipsis">
  477. Windows on Arm
  478. </span>
  479. </a>
  480. <nav class="md-nav" aria-label="Windows on Arm">
  481. <ul class="md-nav__list">
  482. <li class="md-nav__item">
  483. <a href="#generating-an-import-library" class="md-nav__link">
  484. <span class="md-ellipsis">
  485. Generating an import library
  486. </span>
  487. </a>
  488. </li>
  489. </ul>
  490. </nav>
  491. </li>
  492. <li class="md-nav__item">
  493. <a href="#android" class="md-nav__link">
  494. <span class="md-ellipsis">
  495. Android
  496. </span>
  497. </a>
  498. <nav class="md-nav" aria-label="Android">
  499. <ul class="md-nav__list">
  500. <li class="md-nav__item">
  501. <a href="#building-for-armv7" class="md-nav__link">
  502. <span class="md-ellipsis">
  503. Building for ARMV7
  504. </span>
  505. </a>
  506. </li>
  507. <li class="md-nav__item">
  508. <a href="#building-for-armv8" class="md-nav__link">
  509. <span class="md-ellipsis">
  510. Building for ARMV8
  511. </span>
  512. </a>
  513. </li>
  514. </ul>
  515. </nav>
  516. </li>
  517. <li class="md-nav__item">
  518. <a href="#iphoneios" class="md-nav__link">
  519. <span class="md-ellipsis">
  520. iPhone/iOS
  521. </span>
  522. </a>
  523. </li>
  524. <li class="md-nav__item">
  525. <a href="#harmonyos" class="md-nav__link">
  526. <span class="md-ellipsis">
  527. HarmonyOS
  528. </span>
  529. </a>
  530. </li>
  531. <li class="md-nav__item">
  532. <a href="#mips" class="md-nav__link">
  533. <span class="md-ellipsis">
  534. MIPS
  535. </span>
  536. </a>
  537. </li>
  538. <li class="md-nav__item">
  539. <a href="#freebsd_1" class="md-nav__link">
  540. <span class="md-ellipsis">
  541. FreeBSD
  542. </span>
  543. </a>
  544. </li>
  545. <li class="md-nav__item">
  546. <a href="#cortex-m" class="md-nav__link">
  547. <span class="md-ellipsis">
  548. Cortex-M
  549. </span>
  550. </a>
  551. </li>
  552. </ul>
  553. </nav>
  554. </li>
  555. </ul>
  556. </nav>
  557. </div>
  558. </div>
  559. </div>
  560. <div class="md-content" data-md-component="content">
  561. <article class="md-content__inner md-typeset">
  562. <h1 id="install-openblas">Install OpenBLAS</h1>
  563. <p>OpenBLAS can be installed through package managers or from source. If you only
  564. want to use OpenBLAS rather than make changes to it, we recommend installing a
  565. pre-built binary package with your package manager of choice.</p>
  566. <p>This page contains an overview of installing with package managers as well as
  567. from source. For the latter, see <a href="#building-from-source">further down on this page</a>.</p>
  568. <h2 id="installing-with-a-package-manager">Installing with a package manager</h2>
  569. <div class="admonition note">
  570. <p class="admonition-title">Note</p>
  571. <p>Almost every package manager provides OpenBLAS packages; the list on this
  572. page is not comprehensive. If your package manager of choice isn't shown
  573. here, please search its package database for <code>openblas</code> or <code>libopenblas</code>.</p>
  574. </div>
  575. <h3 id="linux">Linux</h3>
  576. <p>On Linux, OpenBLAS can be installed with the system package manager, or with a
  577. package manager like <a href="https://docs.conda.io/en/latest/">Conda</a>
  578. (or alternative package managers for the conda-forge ecosystem, like
  579. <a href="https://mamba.readthedocs.io/en/latest/">Mamba</a>,
  580. <a href="https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html">Micromamba</a>,
  581. or <a href="https://pixi.sh/latest/#windows-installer">Pixi</a>),
  582. <a href="https://spack.io/">Spack</a>, or <a href="https://nixos.org/">Nix</a>. For the latter set of
  583. tools, the package name in all cases is <code>openblas</code>. Since package management in
  584. quite a few of these tools is declarative (i.e., managed by adding <code>openblas</code>
  585. to a metadata file describing the dependencies for your project or
  586. environment), we won't attempt to give detailed instructions for these tools here.</p>
  587. <p>Linux distributions typically split OpenBLAS up in two packages: one containing
  588. the library itself (typically named <code>openblas</code> or <code>libopenblas</code>), and one containing headers,
  589. pkg-config and CMake files (typically named the same as the package for the
  590. library with <code>-dev</code> or <code>-devel</code> appended; e.g., <code>openblas-devel</code>). Please keep
  591. in mind that if you want to install OpenBLAS in order to use it directly in
  592. your own project, you will need to install both of those packages.</p>
  593. <p>Distro-specific installation commands:</p>
  594. <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>
  595. <div class="tabbed-content">
  596. <div class="tabbed-block">
  597. <p><div class="highlight"><pre><span></span><code>$<span class="w"> </span>sudo<span class="w"> </span>apt<span class="w"> </span>update
  598. $<span class="w"> </span>sudo<span class="w"> </span>apt<span class="w"> </span>install<span class="w"> </span>libopenblas-dev
  599. </code></pre></div>
  600. OpenBLAS can be configured as the default BLAS through the <code>update-alternatives</code> mechanism:</p>
  601. <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
  602. </code></pre></div>
  603. </div>
  604. <div class="tabbed-block">
  605. <div class="highlight"><pre><span></span><code>$<span class="w"> </span>sudo<span class="w"> </span>zypper<span class="w"> </span>refresh
  606. $<span class="w"> </span>sudo<span class="w"> </span>zypper<span class="w"> </span>install<span class="w"> </span>openblas-devel
  607. </code></pre></div>
  608. <p>OpenBLAS can be configured as the default BLAS through the <code>update-alternatives</code> mechanism:
  609. <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
  610. </code></pre></div></p>
  611. </div>
  612. <div class="tabbed-block">
  613. <div class="highlight"><pre><span></span><code>$<span class="w"> </span>dnf<span class="w"> </span>check-update
  614. $<span class="w"> </span>dnf<span class="w"> </span>install<span class="w"> </span>openblas-devel
  615. </code></pre></div>
  616. <div class="admonition warning">
  617. <p class="admonition-title">Warning</p>
  618. <p>Fedora does not ship the pkg-config files for OpenBLAS. Instead, it wants you to
  619. link against <a href="https://www.mpi-magdeburg.mpg.de/projects/flexiblas">FlexiBLAS</a> (which
  620. uses OpenBLAS by default as its backend on Fedora), which you can install with:</p>
  621. <div class="highlight"><pre><span></span><code>$<span class="w"> </span>dnf<span class="w"> </span>install<span class="w"> </span>flexiblas-devel
  622. </code></pre></div>
  623. </div>
  624. <p>For CentOS and RHEL, OpenBLAS packages are provided via the <a href="https://fedoraproject.org/wiki/EPEL">Fedora EPEL repository</a>.
  625. After adding that repository and its repository keys, you can install
  626. <code>openblas-devel</code> with either <code>dnf</code> or <code>yum</code>.</p>
  627. </div>
  628. <div class="tabbed-block">
  629. <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
  630. </code></pre></div>
  631. </div>
  632. </div>
  633. </div>
  634. <h3 id="windows">Windows</h3>
  635. <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>
  636. <div class="tabbed-content">
  637. <div class="tabbed-block">
  638. <p>OpenBLAS can be installed with <code>conda</code> (or <code>mamba</code>, <code>micromamba</code>, or
  639. <code>pixi</code>) from conda-forge:
  640. <div class="highlight"><pre><span></span><code>conda install openblas
  641. </code></pre></div></p>
  642. <p>Conda-forge provides a method for switching the default BLAS implementation
  643. used by all packages. To use that for OpenBLAS, install <code>libblas=*=*openblas</code>
  644. (see <a href="https://conda-forge.org/docs/maintainer/knowledge_base/#switching-blas-implementation">the docs on this mechanism</a>
  645. for more details).</p>
  646. </div>
  647. <div class="tabbed-block">
  648. <p>OpenBLAS can be installed with vcpkg:
  649. <div class="highlight"><pre><span></span><code># In classic mode:
  650. vcpkg install openblas
  651. # Or in manifest mode:
  652. vcpkg add port openblas
  653. </code></pre></div></p>
  654. </div>
  655. <div class="tabbed-block">
  656. <p>Windows is the only platform for which binaries are made available by the
  657. OpenBLAS project itself. They can be downloaded from the GitHub
  658. Releases](https://github.com/OpenMathLib/OpenBLAS/releases) page. These
  659. binaries are built with MinGW, using the following build options:
  660. <div class="highlight"><pre><span></span><code>NUM_THREADS=64 TARGET=GENERIC DYNAMIC_ARCH=1 DYNAMIC_OLDER=1 CONSISTENT_FPCSR=1 INTERFACE=0
  661. </code></pre></div>
  662. There are separate packages for x86-64 and x86. The zip archive contains
  663. the include files, static and shared libraries, as well as configuration
  664. files for getting them found via CMake or pkg-config. To use these
  665. binaries, create a suitable folder for your OpenBLAS installation and unzip
  666. the <code>.zip</code> bundle there (note that you will need to edit the provided
  667. <code>openblas.pc</code> and <code>OpenBLASConfig.cmake</code> to reflect the installation path
  668. on your computer, as distributed they have "win" or "win64" reflecting the
  669. local paths on the system they were built on).</p>
  670. <p>Note that the same binaries can be downloaded
  671. <a href="http://sourceforge.net/projects/openblas/files">from SourceForge</a>; this is
  672. mostly of historical interest.</p>
  673. </div>
  674. </div>
  675. </div>
  676. <h3 id="macos">macOS</h3>
  677. <p>To install OpenBLAS with a package manager on macOS, run:</p>
  678. <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>
  679. <div class="tabbed-content">
  680. <div class="tabbed-block">
  681. <div class="highlight"><pre><span></span><code>%<span class="w"> </span>brew<span class="w"> </span>install<span class="w"> </span>openblas
  682. </code></pre></div>
  683. </div>
  684. <div class="tabbed-block">
  685. <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
  686. </code></pre></div>
  687. </div>
  688. <div class="tabbed-block">
  689. <div class="highlight"><pre><span></span><code>%<span class="w"> </span>conda<span class="w"> </span>install<span class="w"> </span>openblas
  690. </code></pre></div>
  691. <p>Conda-forge provides a method for switching the default BLAS implementation
  692. used by all packages. To use that for OpenBLAS, install <code>libblas=*=*openblas</code>
  693. (see <a href="https://conda-forge.org/docs/maintainer/knowledge_base/#switching-blas-implementation">the docs on this mechanism</a>
  694. for more details).</p>
  695. </div>
  696. </div>
  697. </div>
  698. <h3 id="freebsd">FreeBSD</h3>
  699. <p>You can install OpenBLAS from the FreeBSD <a href="https://www.freebsd.org/ports/index.html">Ports collection</a>:
  700. <div class="highlight"><pre><span></span><code>pkg install openblas
  701. </code></pre></div></p>
  702. <h2 id="building-from-source">Building from source</h2>
  703. <p>We recommend download the latest <a href="https://github.com/OpenMathLib/OpenBLAS/releases">stable version</a>
  704. from the GitHub Releases page, or checking it out from a git tag, rather than a
  705. dev version from the <code>develop</code> branch.</p>
  706. <div class="admonition tip">
  707. <p class="admonition-title">Tip</p>
  708. <p>The User manual contains <a href="../user_manual/#compiling-openblas">a section with detailed information on compiling OpenBLAS</a>,
  709. including how to customize builds and how to cross-compile. Please read
  710. that documentation first. This page contains only platform-specific build
  711. information, and assumes you already understand the general build system
  712. invocations to build OpenBLAS, with the specific build options you want to
  713. control multi-threading and other non-platform-specific behavior).</p>
  714. </div>
  715. <h3 id="linux-and-macos">Linux and macOS</h3>
  716. <p>Ensure you have C and Fortran compilers installed, then simply type <code>make</code> to compile the library.
  717. There are no other build dependencies, nor unusual platform-specific
  718. environment variables to set or other system setup to do.</p>
  719. <div class="admonition note">
  720. <p class="admonition-title">Note</p>
  721. <p>When building in an emulator (KVM, QEMU, etc.), please make sure that the combination of CPU features exposed to
  722. the virtual environment matches that of an existing CPU to allow detection of the CPU model to succeed.
  723. (With <code>qemu</code>, this can be done by passing <code>-cpu host</code> or a supported model name at invocation).</p>
  724. </div>
  725. <h3 id="windows_1">Windows</h3>
  726. <p>We support building OpenBLAS with either MinGW or Visual Studio on Windows.
  727. Using MSVC will yield an OpenBLAS build with the Windows platform-native ABI.
  728. Using MinGW will yield a different ABI. We'll describe both methods in detail
  729. in this section, since the process for each is quite different.</p>
  730. <h4 id="visual-studio-native-windows-abi">Visual Studio &amp; native Windows ABI</h4>
  731. <p>For Visual Studio, you can use CMake to generate Visual Studio solution files;
  732. note that you will need at least CMake 3.11 for linking to work correctly).</p>
  733. <p>Note that you need a Fortran compiler if you plan to build and use the LAPACK
  734. functions included with OpenBLAS. The sections below describe using either
  735. <code>flang</code> as an add-on to clang/LLVM or <code>gfortran</code> as part of MinGW for this
  736. purpose. If you want to use the Intel Fortran compiler (<code>ifort</code> or <code>ifx</code>) for
  737. this, be sure to also use the Intel C compiler (<code>icc</code> or <code>icx</code>) for building
  738. the C parts, as the ABI imposed by <code>ifort</code> is incompatible with MSVC</p>
  739. <p>A fully-optimized OpenBLAS that can be statically or dynamically linked to your
  740. application can currently be built for the 64-bit architecture with the LLVM
  741. compiler infrastructure. We're going to use <a href="https://docs.anaconda.com/miniconda/">Miniconda3</a>
  742. to grab all of the tools we need, since some of them are in an experimental
  743. status. Before you begin, you'll need to have Microsoft Visual Studio 2015 or
  744. newer installed.</p>
  745. <ol>
  746. <li>Install Miniconda3 for 64-bit Windows using <code>winget install --id Anaconda.Miniconda3</code>,
  747. or easily download from <a href="https://docs.conda.io/en/latest/miniconda.html">conda.io</a>.</li>
  748. <li>Open the "Anaconda Command Prompt" now available in the Start Menu, or at <code>%USERPROFILE%\miniconda3\shell\condabin\conda-hook.ps1</code>.</li>
  749. <li>In that command prompt window, use <code>cd</code> to change to the directory where you want to build OpenBLAS.</li>
  750. <li>Now install all of the tools we need:
  751. <div class="highlight"><pre><span></span><code>conda update -n base conda
  752. conda config --add channels conda-forge
  753. conda install -y cmake flang clangdev perl libflang ninja
  754. </code></pre></div></li>
  755. <li>
  756. <p>Still in the Anaconda Command Prompt window, activate the 64-bit MSVC environment with <code>vcvarsall x64</code>.
  757. On Windows 11 with Visual Studio 2022, this would be done by invoking:</p>
  758. <div class="highlight"><pre><span></span><code><span class="s2">&quot;c:\Program Files\Microsoft Visual Studio\2022\Community\vc\Auxiliary\Build\vcvars64.bat&quot;</span>
  759. </code></pre></div>
  760. <p>With VS2019, the command should be the same (except for the year number of course).
  761. For other versions of MSVC, please check the Visual Studio documentation for
  762. exactly how to invoke the <code>vcvars64.bat</code> script.</p>
  763. <p>Confirm that the environment is active by typing <code>link</code>. This should return
  764. a long list of possible options for the <code>link</code> command. If it just returns
  765. <em>"command not found"</em> or similar, review and retype the call to <code>vcvars64.bat</code>.</p>
  766. <div class="admonition note">
  767. <p class="admonition-title">Note</p>
  768. <p>if you are working from a Visual Studio command prompt window instead
  769. (so that you do not have to do the <code>vcvars</code> call), you need to invoke
  770. <code>conda activate</code> so that <code>CONDA_PREFIX</code> etc. get set up correctly before
  771. proceeding to step 6. Failing to do so will lead to link errors like
  772. <code>libflangmain.lib</code> not getting found later in the build.</p>
  773. </div>
  774. </li>
  775. <li>
  776. <p>Now configure the project with CMake. Starting in the project directory, execute the following:
  777. <div class="highlight"><pre><span></span><code>set &quot;LIB=%CONDA_PREFIX%\Library\lib;%LIB%&quot;
  778. set &quot;CPATH=%CONDA_PREFIX%\Library\include;%CPATH%&quot;
  779. mkdir build
  780. cd build
  781. cmake .. -G &quot;Ninja&quot; -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
  782. </code></pre></div></p>
  783. <p>You may want to add further options in the <code>cmake</code> command here. For
  784. instance, the default only produces a static <code>.lib</code> version of the library.
  785. If you would rather have a DLL, add <code>-DBUILD_SHARED_LIBS=ON</code> above. Note that
  786. this step only creates some command files and directories, the actual build
  787. happens next.</p>
  788. </li>
  789. <li>
  790. <p>Build the project:</p>
  791. <p><div class="highlight"><pre><span></span><code>cmake --build . --config Release
  792. </code></pre></div>
  793. This step will create the OpenBLAS library in the <code>lib</code> directory, and
  794. various build-time tests in the <code>test</code>, <code>ctest</code> and <code>openblas_utest</code>
  795. directories. However it will not separate the header files you might need
  796. for building your own programs from those used internally. To put all
  797. relevant files in a more convenient arrangement, run the next step.</p>
  798. </li>
  799. <li>
  800. <p>Install all relevant files created by the build:</p>
  801. <p><div class="highlight"><pre><span></span><code>cmake --install . --prefix c:\opt -v
  802. </code></pre></div>
  803. This will copy all files that are needed for building and running your own
  804. programs with OpenBLAS to the given location, creating appropriate
  805. subdirectories for the individual kinds of files. In the case of <code>C:\opt</code> as
  806. given above, this would be:</p>
  807. <ul>
  808. <li><code>C:\opt\include\openblas</code> for the header files, </li>
  809. <li><code>C:\opt\bin</code> for the <code>libopenblas.dll</code> shared library,</li>
  810. <li><code>C:\opt\lib</code> for the static library, and</li>
  811. <li><code>C:\opt\share</code> holds various support files that enable other cmake-based
  812. build scripts to find OpenBLAS automatically.</li>
  813. </ul>
  814. </li>
  815. </ol>
  816. <div class="admonition tip">
  817. <p class="admonition-title">Change in complex types for Visual Studio 2017 and up</p>
  818. <p>In newer Visual Studio versions, Microsoft has changed
  819. <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>.
  820. Even when using a precompiled version of OpenBLAS, you might need to define
  821. <code>LAPACK_COMPLEX_CUSTOM</code> in order to define complex types properly for MSVC.
  822. For example, some variant of the following might help:</p>
  823. <div class="highlight"><pre><span></span><code><span class="cp">#if defined(_MSC_VER)</span>
  824. <span class="w"> </span><span class="cp">#include</span><span class="w"> </span><span class="cpf">&lt;complex.h&gt;</span>
  825. <span class="w"> </span><span class="cp">#define LAPACK_COMPLEX_CUSTOM</span>
  826. <span class="w"> </span><span class="cp">#define lapack_complex_float _Fcomplex</span>
  827. <span class="w"> </span><span class="cp">#define lapack_complex_double _Dcomplex</span>
  828. <span class="cp">#endif</span>
  829. </code></pre></div>
  830. <p>For reference, see
  831. <a href="https://github.com/OpenMathLib/OpenBLAS/issues/3661">openblas#3661</a>,
  832. <a href="https://github.com/Reference-LAPACK/lapack/issues/683">lapack#683</a>, and
  833. <a href="https://stackoverflow.com/questions/47520244/using-openblas-lapacke-in-visual-studio">this Stack Overflow question</a>.</p>
  834. </div>
  835. <div class="admonition warning">
  836. <p class="admonition-title">Building 32-bit binaries with MSVC</p>
  837. <p>This method may produce binaries which demonstrate significantly lower
  838. performance than those built with the other methods. The Visual Studio
  839. compiler does not support the dialect of assembly used in the cpu-specific
  840. optimized files, so only the "generic" <code>TARGET</code> which is written in pure C
  841. will get built. For the same reason it is not possible (and not necessary)
  842. to use <code>-DDYNAMIC_ARCH=ON</code> in a Visual Studio build. You may consider
  843. building for the 32-bit architecture using the GNU (MinGW) ABI instead.</p>
  844. </div>
  845. <h5 id="cmake-visual-studio-integration">CMake &amp; Visual Studio integration</h5>
  846. <p>To generate Visual Studio solution files, ensure CMake is installed and then run:
  847. <div class="highlight"><pre><span></span><code># Do this from Powershell so cmake can find visual studio
  848. cmake -G &quot;Visual Studio 14 Win64&quot; -DCMAKE_BUILD_TYPE=Release .
  849. </code></pre></div></p>
  850. <p>To then build OpenBLAS using those solution files from within Visual Studio, we
  851. also need Perl. Please install it and ensure it's on the <code>PATH</code> (see, e.g.,
  852. <a href="http://stackoverflow.com/questions/3051049/active-perl-installation-on-windows-operating-system">this Stack Overflow question for how</a>).</p>
  853. <p>If you build from within Visual Studio, the dependencies may not be
  854. automatically configured: if you try to build <code>libopenblas</code> directly, it may
  855. fail with a message saying that some <code>.obj</code> files aren't found. If this
  856. happens, you can work around the problem by building the projects that
  857. <code>libopenblas</code> depends on before building <code>libopenblas</code> itself.</p>
  858. <h6 id="build-openblas-for-universal-windows-platform">Build OpenBLAS for Universal Windows Platform</h6>
  859. <p>OpenBLAS can be built targeting <a href="https://en.wikipedia.org/wiki/Universal_Windows_Platform">Universal Windows Platform</a>
  860. (UWP) like this:</p>
  861. <ol>
  862. <li>Follow the steps above to build the Visual Studio solution files for
  863. Windows. This builds the helper executables which are required when building
  864. the OpenBLAS Visual Studio solution files for UWP in step 2.</li>
  865. <li>
  866. <p>Remove the generated <code>CMakeCache.txt</code> and the <code>CMakeFiles</code> directory from
  867. the OpenBLAS source directory, then re-run CMake with the following options:</p>
  868. <p><div class="highlight"><pre><span></span><code># do this to build UWP compatible solution files
  869. cmake -G &quot;Visual Studio 14 Win64&quot; -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=&quot;10.0&quot; -DCMAKE_SYSTEM_PROCESSOR=AMD64 -DVS_WINRT_COMPONENT=TRUE -DCMAKE_BUILD_TYPE=Release .
  870. </code></pre></div>
  871. 3. Now build the solution with Visual Studio.</p>
  872. </li>
  873. </ol>
  874. <h4 id="mingw-gnu-abi">MinGW &amp; GNU ABI</h4>
  875. <div class="admonition note">
  876. <p class="admonition-title">Note</p>
  877. <p>The resulting library from building with MinGW as described below can be
  878. used in Visual Studio, but it can only be linked dynamically. This
  879. configuration has not been thoroughly tested and should be considered
  880. experimental.</p>
  881. </div>
  882. <p>To build OpenBLAS on Windows with MinGW:</p>
  883. <ol>
  884. <li>Install the MinGW (GCC) compiler suite, either the 32-bit
  885. [MinGW]((http://www.mingw.org/) or the 64-bit
  886. <a href="http://mingw-w64.sourceforge.net/">MinGW-w64</a> toolchain. Be sure to install
  887. its <code>gfortran</code> package as well (unless you really want to build the BLAS part
  888. of OpenBLAS only) and check that <code>gcc</code> and <code>gfortran</code> are the same version.
  889. In addition, please install MSYS2 with MinGW.</li>
  890. <li>Build OpenBLAS in the MSYS2 shell. Usually, you can just type <code>make</code>.
  891. OpenBLAS will detect the compiler and CPU automatically. </li>
  892. <li>After the build is complete, OpenBLAS will generate the static library
  893. <code>libopenblas.a</code> and the shared library <code>libopenblas.dll</code> in the folder. You
  894. can type <code>make PREFIX=/your/installation/path install</code> to install the
  895. library to a certain location.</li>
  896. </ol>
  897. <p>Note that OpenBLAS will generate the import library <code>libopenblas.dll.a</code> for
  898. <code>libopenblas.dll</code> by default.</p>
  899. <p>If you want to generate Windows-native PDB files from a MinGW build, you can
  900. use the <a href="https://github.com/rainers/cv2pdb">cv2pdb</a> tool to do so.</p>
  901. <p>To then use the built OpenBLAS shared library in Visual Studio:</p>
  902. <ol>
  903. <li>Copy the import library (<code>OPENBLAS_TOP_DIR/libopenblas.dll.a</code>) and the
  904. shared library (<code>libopenblas.dll</code>) into the same folder (this must be the
  905. folder of your project that is going to use the BLAS library. You may need
  906. to add <code>libopenblas.dll.a</code> to the linker input list: <code>properties-&gt;Linker-&gt;Input</code>).</li>
  907. <li>Please follow the Visual Studio documentation about using third-party .dll
  908. libraries, and make sure to link against a library for the correct
  909. architecture.<sup id="fnref:1"><a class="footnote-ref" href="#fn:1">1</a></sup></li>
  910. <li>If you need CBLAS, you should include <code>cblas.h</code> in
  911. <code>/your/installation/path/include</code> in Visual Studio. Please see
  912. <a href="http://github.com/OpenMathLib/OpenBLAS/issues/95">openblas#95</a> for more details.</li>
  913. </ol>
  914. <div class="admonition info">
  915. <p class="admonition-title">Limitations of using the MinGW build within Visual Studio</p>
  916. <ul>
  917. <li>Both static and dynamic linking are supported with MinGW. With Visual
  918. Studio, however, only dynamic linking is supported and so you should use
  919. the import library.</li>
  920. <li>Debugging from Visual Studio does not work because MinGW and Visual
  921. Studio have incompatible formats for debug information (PDB vs.
  922. DWARF/STABS). You should either debug with GDB on the command line or
  923. with a visual frontend, for instance <a href="http://www.eclipse.org/cdt/">Eclipse</a> or
  924. <a href="http://qt.nokia.com/products/developer-tools/">Qt Creator</a>.</li>
  925. </ul>
  926. </div>
  927. <h3 id="windows-on-arm">Windows on Arm</h3>
  928. <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).
  929. (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
  930. 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>
  931. <ol>
  932. <li>
  933. <p>Clone OpenBLAS to your local machine and checkout to latest release of
  934. OpenBLAS (unless you want to build the latest development snapshot - here we
  935. are using the 0.3.28 release as the example, of course this exact version
  936. may be outdated by the time you read this)</p>
  937. <div class="highlight"><pre><span></span><code>git clone https://github.com/OpenMathLib/OpenBLAS.git
  938. cd OpenBLAS
  939. git checkout v0.3.28
  940. </code></pre></div>
  941. </li>
  942. <li>
  943. <p>Install Latest LLVM toolchain for WoA:</p>
  944. <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
  945. page</a>. At
  946. the time of writing, this is version 19.1.5 - be sure to select the
  947. latest release for which you can find a precompiled package whose name ends
  948. in "-woa64.exe" (precompiled packages usually lag a week or two behind their
  949. corresponding source release). Make sure to enable the option
  950. <em>“Add LLVM to the system PATH for all the users”</em>.</p>
  951. <p>Note: Make sure that the path of LLVM toolchain is at the top of Environment
  952. Variables section to avoid conflicts between the set of compilers available
  953. in the system path</p>
  954. </li>
  955. <li>
  956. <p>Launch the Native Command Prompt for Windows ARM64:</p>
  957. <p>From the start menu search for <em>"ARM64 Native Tools Command Prompt for Visual
  958. Studio 2022"</em>. Alternatively open command prompt, run the following command to
  959. activate the environment:</p>
  960. <div class="highlight"><pre><span></span><code>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsarm64.bat
  961. </code></pre></div>
  962. </li>
  963. <li>
  964. <p>Navigate to the OpenBLAS source code directory and start building OpenBLAS
  965. by invoking Ninja:</p>
  966. <div class="highlight"><pre><span></span><code>cd OpenBLAS
  967. mkdir build
  968. cd build
  969. cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DTARGET=ARMV8 -DBINARY=64 -DCMAKE_C_COMPILER=clang-cl -DCMAKE_Fortran_COMPILER=flang-new
  970. ninja -j16
  971. </code></pre></div>
  972. <p>Note: You might want to include additional options in the cmake command
  973. here. For example, the default configuration only generates a
  974. <code>static.lib</code> version of the library. If you prefer a DLL, you can add
  975. <code>-DBUILD_SHARED_LIBS=ON</code>.</p>
  976. <p>Note that it is also possible to use the same setup to build OpenBLAS
  977. with Make, if you prefer Makefiles over the CMake build for some
  978. reason:</p>
  979. <div class="highlight"><pre><span></span><code>$ make CC=clang-cl FC=flang-new AR=&quot;llvm-ar&quot; TARGET=ARMV8 ARCH=arm64 RANLIB=&quot;llvm-ranlib&quot; MAKE=make
  980. </code></pre></div>
  981. </li>
  982. </ol>
  983. <h4 id="generating-an-import-library">Generating an import library</h4>
  984. <p>Microsoft Windows has this thing called "import libraries". You need it for
  985. MSVC; you don't need it for MinGW because the <code>ld</code> linker is smart enough -
  986. however, you may still want it for some reason, so we'll describe the process
  987. for both MSVC and MinGW.</p>
  988. <p>Import libraries are compiled from a list of what symbols to use, which are
  989. contained in a <code>.def</code> file. A <code>.def</code> file should be already be present in the
  990. <code>exports</code> directory under the top-level OpenBLAS directory after you've run a build.
  991. In your shell, move to this directory: <code>cd exports</code>.</p>
  992. <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>
  993. <div class="tabbed-content">
  994. <div class="tabbed-block">
  995. <p>Unlike MinGW, MSVC absolutely requires an import library. Now the C ABI of
  996. MSVC and MinGW are actually identical, so linking is actually okay (any
  997. incompatibility in the C ABI would be a bug).</p>
  998. <p>The import libraries of MSVC have the suffix <code>.lib</code>. They are generated
  999. from a <code>.def</code> file using MSVC's <code>lib.exe</code>.</p>
  1000. </div>
  1001. <div class="tabbed-block">
  1002. <p>MinGW import libraries have the suffix <code>.a</code>, just like static libraries.
  1003. Our goal is to produce the file <code>libopenblas.dll.a</code>.</p>
  1004. <p>You need to first insert a line <code>LIBRARY libopenblas.dll</code> in <code>libopenblas.def</code>:
  1005. <div class="highlight"><pre><span></span><code>cat &lt;(echo &quot;LIBRARY libopenblas.dll&quot;) libopenblas.def &gt; libopenblas.def.1
  1006. mv libopenblas.def.1 libopenblas.def
  1007. </code></pre></div></p>
  1008. <p>Now the <code>.def</code> file probably looks like:
  1009. <div class="highlight"><pre><span></span><code>LIBRARY libopenblas.dll
  1010. EXPORTS
  1011. caxpy=caxpy_ @1
  1012. caxpy_=caxpy_ @2
  1013. ...
  1014. </code></pre></div>
  1015. Then, generate the import library: <code>dlltool -d libopenblas.def -l libopenblas.dll.a</code></p>
  1016. <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>
  1017. </div>
  1018. </div>
  1019. </div>
  1020. <h3 id="android">Android</h3>
  1021. <p>To build OpenBLAS for Android, you will need the following tools installed on your machine:</p>
  1022. <ul>
  1023. <li><a href="https://developer.android.com/ndk/">The Android NDK</a></li>
  1024. <li>Clang compiler on the build machine</li>
  1025. </ul>
  1026. <p>The next two sections below describe how to build with Clang for ARMV7 and
  1027. ARMV8 targets, respectively. The same basic principles as described below for
  1028. ARMV8 should also apply to building an x86 or x86-64 version (substitute
  1029. something like <code>NEHALEM</code> for the target instead of <code>ARMV8</code>, and replace all the
  1030. <code>aarch64</code> in the toolchain paths with <code>x86</code> or <code>x96_64</code> as appropriate).</p>
  1031. <div class="admonition info">
  1032. <p class="admonition-title">Historic note</p>
  1033. <p>Since NDK version 19, the default toolchain is provided as a standalone
  1034. toolchain, so building one yourself following
  1035. <a href="http://developer.android.com/ndk/guides/standalone_toolchain.html">building a standalone toolchain</a>
  1036. should no longer be necessary.</p>
  1037. </div>
  1038. <h4 id="building-for-armv7">Building for ARMV7</h4>
  1039. <div class="highlight"><pre><span></span><code><span class="c1"># Set path to ndk-bundle</span>
  1040. <span class="nb">export</span><span class="w"> </span><span class="nv">NDK_BUNDLE_DIR</span><span class="o">=</span>/path/to/ndk-bundle
  1041. <span class="c1"># Set the PATH to contain paths to clang and arm-linux-androideabi-* utilities</span>
  1042. <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>
  1043. <span class="c1"># Set LDFLAGS so that the linker finds the appropriate libgcc</span>
  1044. <span class="nb">export</span><span class="w"> </span><span class="nv">LDFLAGS</span><span class="o">=</span><span class="s2">&quot;-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&quot;</span>
  1045. <span class="c1"># Set the clang cross compile flags</span>
  1046. <span class="nb">export</span><span class="w"> </span><span class="nv">CLANG_FLAGS</span><span class="o">=</span><span class="s2">&quot;-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/&quot;</span>
  1047. <span class="c1">#OpenBLAS Compile</span>
  1048. 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">&quot;clang </span><span class="si">${</span><span class="nv">CLANG_FLAGS</span><span class="si">}</span><span class="s2">&quot;</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
  1049. </code></pre></div>
  1050. <p>On macOS, it may also be necessary to give the complete path to the <code>ar</code>
  1051. utility in the make command above, like so:
  1052. <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
  1053. </code></pre></div>
  1054. otherwise you may get a linker error complaining like <code>malformed archive header
  1055. name at 8</code> when the native macOS <code>ar</code> command was invoked instead. Note that
  1056. with recent NDK versions, the AR tool may be named <code>llvm-ar</code> rather than what
  1057. is assumed above.</p>
  1058. <h4 id="building-for-armv8">Building for ARMV8</h4>
  1059. <p><div class="highlight"><pre><span></span><code><span class="c1"># Set path to ndk-bundle</span>
  1060. <span class="nb">export</span><span class="w"> </span><span class="nv">NDK_BUNDLE_DIR</span><span class="o">=</span>/path/to/ndk-bundle/
  1061. <span class="c1"># Export PATH to contain directories of clang and aarch64-linux-android-* utilities</span>
  1062. <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>
  1063. <span class="c1"># Setup LDFLAGS so that loader can find libgcc and pass -lm for sqrt</span>
  1064. <span class="nb">export</span><span class="w"> </span><span class="nv">LDFLAGS</span><span class="o">=</span><span class="s2">&quot;-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&quot;</span>
  1065. <span class="c1"># Setup the clang cross compile options</span>
  1066. <span class="nb">export</span><span class="w"> </span><span class="nv">CLANG_FLAGS</span><span class="o">=</span><span class="s2">&quot;-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/&quot;</span>
  1067. <span class="c1"># Compile</span>
  1068. 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">&quot;clang </span><span class="si">${</span><span class="nv">CLANG_FLAGS</span><span class="si">}</span><span class="s2">&quot;</span><span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span>-j4
  1069. </code></pre></div>
  1070. Note: using <code>TARGET=CORTEXA57</code> in place of <code>ARMV8</code> will pick up better
  1071. optimized routines. Implementations for the <code>CORTEXA57</code> target are compatible
  1072. with all other <code>ARMV8</code> targets.</p>
  1073. <p>Note: for NDK 23b, something as simple as:
  1074. <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>
  1075. 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
  1076. </code></pre></div>
  1077. appears to be sufficient on Linux. On OSX, setting AR to the ar provided in the
  1078. "bin" path of the NDK (probably <code>llvm-ar</code>) is also necessary.</p>
  1079. <details class="note">
  1080. <summary>Alternative build script for 3 architectures</summary>
  1081. <p>This script will build OpenBLAS for 3 architecture (<code>ARMV7</code>, <code>ARMV8</code>,
  1082. <code>X86</code>) and install them to <code>/opt/OpenBLAS/lib</code>. Of course you can also copy
  1083. only the section that is of interest to you - also notice that the <code>AR=</code>
  1084. line may need adapting to the name of the ar tool provided in your
  1085. <code>$TOOLCHAIN/bin</code> - for example <code>llvm-ar</code> in some recent NDK versions.
  1086. It was tested on macOS with NDK version 21.3.6528147.</p>
  1087. <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
  1088. <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
  1089. make<span class="w"> </span>clean
  1090. make<span class="w"> </span><span class="se">\</span>
  1091. <span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>ARMV7<span class="w"> </span><span class="se">\</span>
  1092. <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>
  1093. <span class="w"> </span><span class="nv">CC</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$TOOLCHAIN</span><span class="s2">&quot;</span>/bin/armv7a-linux-androideabi21-clang<span class="w"> </span><span class="se">\</span>
  1094. <span class="w"> </span><span class="nv">AR</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$TOOLCHAIN</span><span class="s2">&quot;</span>/bin/arm-linux-androideabi-ar<span class="w"> </span><span class="se">\</span>
  1095. <span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="se">\</span>
  1096. <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>
  1097. <span class="w"> </span>-j4
  1098. sudo<span class="w"> </span>make<span class="w"> </span>install
  1099. make<span class="w"> </span>clean
  1100. make<span class="w"> </span><span class="se">\</span>
  1101. <span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>CORTEXA57<span class="w"> </span><span class="se">\</span>
  1102. <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>
  1103. <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>
  1104. <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>
  1105. <span class="w"> </span><span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="se">\</span>
  1106. -j4
  1107. sudo<span class="w"> </span>make<span class="w"> </span>install
  1108. make<span class="w"> </span>clean
  1109. make<span class="w"> </span><span class="se">\</span>
  1110. <span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>ATOM<span class="w"> </span><span class="se">\</span>
  1111. <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>
  1112. <span class="nv">CC</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$TOOLCHAIN</span><span class="s2">&quot;</span>/bin/i686-linux-android21-clang<span class="w"> </span><span class="se">\</span>
  1113. <span class="nv">AR</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$TOOLCHAIN</span><span class="s2">&quot;</span>/bin/i686-linux-android-ar<span class="w"> </span><span class="se">\</span>
  1114. <span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="se">\</span>
  1115. <span class="nv">ARM_SOFTFP_ABI</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="se">\</span>
  1116. -j4
  1117. sudo<span class="w"> </span>make<span class="w"> </span>install
  1118. <span class="c1">## This will build for x86_64 </span>
  1119. make<span class="w"> </span>clean
  1120. make<span class="w"> </span><span class="se">\</span>
  1121. <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>
  1122. <span class="nv">ONLY_CBLAS</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="se">\</span>
  1123. <span class="nv">CC</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$TOOLCHAIN</span><span class="s2">&quot;</span>/bin/x86_64-linux-android21-clang<span class="w"> </span><span class="se">\</span>
  1124. <span class="nv">AR</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$TOOLCHAIN</span><span class="s2">&quot;</span>/bin/x86_64-linux-android-ar<span class="w"> </span><span class="se">\</span>
  1125. <span class="nv">HOSTCC</span><span class="o">=</span>gcc<span class="w"> </span><span class="se">\</span>
  1126. <span class="nv">ARM_SOFTFP_ABI</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="se">\</span>
  1127. -j4
  1128. sudo<span class="w"> </span>make<span class="w"> </span>install
  1129. </code></pre></div>
  1130. You can find full list of target architectures in <a href="https://github.com/OpenMathLib/OpenBLAS/blob/develop/TargetList.txt">TargetList.txt</a></p>
  1131. </details>
  1132. <h3 id="iphoneios">iPhone/iOS</h3>
  1133. <p>As none of the current developers uses iOS, the following instructions are what
  1134. was found to work in our Azure CI setup, but as far as we know this builds a
  1135. fully working OpenBLAS for this platform.</p>
  1136. <p>Go to the directory where you unpacked OpenBLAS,and enter the following commands:
  1137. <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
  1138. <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
  1139. 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>
  1140. </code></pre></div>
  1141. Adjust <code>MIN_IOS_VERSION</code> as necessary for your installation. E.g., change the version number
  1142. to the minimum iOS version you want to target and execute this file to build the library.</p>
  1143. <h3 id="harmonyos">HarmonyOS</h3>
  1144. <p>For this target you will need the cross-compiler toolchain package by Huawei,
  1145. which contains solutions for both Windows and Linux. Only the Linux-based
  1146. toolchain has been tested so far, but the following instructions may apply
  1147. similarly to Windows:</p>
  1148. <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>,
  1149. or whatever newer version may be available in the future). Use <code>tar -xvf
  1150. ohos-sdk-windows_linux_public.tar.gz</code> to unpack it somewhere on your system.
  1151. This will create a folder named "ohos-sdk" with subfolders "linux" and
  1152. "windows". In the linux one you will find a ZIP archive named
  1153. <code>native-linux-x64-4.1.7.8-Release.zip</code> - you need to unzip this where you want
  1154. to install the cross-compiler, for example in <code>/opt/ohos-sdk</code>.</p>
  1155. <p>In the directory where you unpacked OpenBLAS, create a build directory for cmake, and change into it :
  1156. <div class="highlight"><pre><span></span><code>mkdir<span class="w"> </span>build
  1157. <span class="nb">cd</span><span class="w"> </span>build
  1158. </code></pre></div>
  1159. Use the version of <code>cmake</code> that came with the SDK, and specify the location of
  1160. its toolchain file as a cmake option. Also set the build target for OpenBLAS to
  1161. <code>ARMV8</code> and specify <code>NOFORTRAN=1</code> (at least as of version 4.1.1, the SDK
  1162. contains no Fortran compiler):
  1163. <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>
  1164. <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>
  1165. <span class="w"> </span>-DOHOS_ARCH<span class="o">=</span><span class="s2">&quot;arm64-v8a&quot;</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>..
  1166. </code></pre></div>
  1167. Additional other OpenBLAS build options like <code>USE_OPENMP=1</code> or <code>DYNAMIC_ARCH=1</code>
  1168. will probably work too. Finally do the build:
  1169. <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>.
  1170. </code></pre></div></p>
  1171. <h3 id="mips">MIPS</h3>
  1172. <p>For MIPS targets you will need latest toolchains:</p>
  1173. <ul>
  1174. <li>P5600 - MTI GNU/Linux Toolchain</li>
  1175. <li>I6400, P6600 - IMG GNU/Linux Toolchain</li>
  1176. </ul>
  1177. <p>You can use following commandlines for builds:</p>
  1178. <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">&quot;bin&quot;</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>
  1179. <span class="nv">IMG_GCC_PREFIX</span><span class="o">=</span>mips-img-linux-gnu
  1180. <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>
  1181. <span class="c1"># I6400 Build (n32):</span>
  1182. 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">&quot;</span><span class="nv">$IMG_TOOLCHAIN</span><span class="s2">-gfortran -EL -mabi=n32&quot;</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">&quot;-EL&quot;</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
  1183. <span class="c1"># I6400 Build (n64):</span>
  1184. 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">&quot;</span><span class="nv">$IMG_TOOLCHAIN</span><span class="s2">-gfortran -EL&quot;</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">&quot;-EL&quot;</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
  1185. <span class="c1"># P6600 Build (n32):</span>
  1186. 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">&quot;</span><span class="nv">$IMG_TOOLCHAIN</span><span class="s2">-gfortran -EL -mabi=n32&quot;</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">&quot;-EL&quot;</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
  1187. <span class="c1"># P6600 Build (n64):</span>
  1188. 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">&quot;</span><span class="nv">$IMG_TOOLCHAIN</span><span class="s2">-gfortran -EL&quot;</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">&quot;-EL&quot;</span><span class="w"> </span><span class="nv">FFLAGS</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$CFLAGS</span><span class="s2">&quot;</span><span class="w"> </span><span class="nv">LDFLAGS</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$CFLAGS</span><span class="s2">&quot;</span><span class="w"> </span><span class="nv">TARGET</span><span class="o">=</span>P6600
  1189. <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">&quot;bin&quot;</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>
  1190. <span class="nv">MTI_GCC_PREFIX</span><span class="o">=</span>mips-mti-linux-gnu
  1191. <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>
  1192. <span class="c1"># P5600 Build:</span>
  1193. 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">&quot;</span><span class="nv">$MTI_TOOLCHAIN</span><span class="s2">-gfortran -EL&quot;</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">&quot;-EL&quot;</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
  1194. </code></pre></div>
  1195. <h3 id="freebsd_1">FreeBSD</h3>
  1196. <p>You will need to install the following tools from the FreeBSD ports tree:</p>
  1197. <ul>
  1198. <li>lang/gcc</li>
  1199. <li>lang/perl5.12</li>
  1200. <li>ftp/curl</li>
  1201. <li>devel/gmake</li>
  1202. <li>devel/patch</li>
  1203. </ul>
  1204. <p>To compile run the command:
  1205. <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
  1206. </code></pre></div></p>
  1207. <h3 id="cortex-m">Cortex-M</h3>
  1208. <p>Cortex-M is a widely used microcontroller that is present in a variety of
  1209. industrial and consumer electronics. A common variant of the Cortex-M is the
  1210. <code>STM32F4xx</code> series. Here, we will give instructions for building for that
  1211. series.</p>
  1212. <p>First, install the embedded Arm GCC compiler from the Arm website. Then, create
  1213. the following <code>toolchain.cmake</code> file:</p>
  1214. <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>
  1215. <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>
  1216. <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_C_COMPILER</span><span class="w"> </span><span class="s2">&quot;arm-none-eabi-gcc.exe&quot;</span><span class="p">)</span>
  1217. <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_CXX_COMPILER</span><span class="w"> </span><span class="s2">&quot;arm-none-eabi-g++.exe&quot;</span><span class="p">)</span>
  1218. <span class="nb">set</span><span class="p">(</span><span class="s">CMAKE_EXE_LINKER_FLAGS</span><span class="w"> </span><span class="s2">&quot;--specs=nosys.specs&quot;</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">&quot;&quot;</span><span class="p">)</span>
  1219. <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>
  1220. <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>
  1221. <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>
  1222. <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>
  1223. </code></pre></div>
  1224. <p>Then build OpenBLAS with:
  1225. <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">&quot;toolchain.cmake&quot;</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>
  1226. </code></pre></div></p>
  1227. <p>In your embedded application, the following functions need to be provided for OpenBLAS to work correctly:
  1228. <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>
  1229. <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>
  1230. </code></pre></div></p>
  1231. <div class="admonition note">
  1232. <p class="admonition-title">Note</p>
  1233. <p>If you are developing for an embedded platform, it is your responsibility
  1234. to make sure that the device has sufficient memory for <code>malloc</code> calls.
  1235. <a href="https://github.com/embeddedartistry/libmemory">Libmemory</a>
  1236. provides one implementation of <code>malloc</code> for embedded platforms.</p>
  1237. </div>
  1238. <div class="footnote">
  1239. <hr />
  1240. <ol>
  1241. <li id="fn:1">
  1242. <p>If the OpenBLAS DLLs are not linked correctly, you may see an error like
  1243. <em>"The application was unable to start correctly (0xc000007b)"</em>, which typically
  1244. indicates a mismatch between 32-bit and 64-bit libraries.&#160;<a class="footnote-backref" href="#fnref:1" title="Jump back to footnote 1 in the text">&#8617;</a></p>
  1245. </li>
  1246. </ol>
  1247. </div>
  1248. <aside class="md-source-file">
  1249. <span class="md-source-file__fact">
  1250. <span class="md-icon" title="Last update">
  1251. <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>
  1252. </span>
  1253. <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>
  1254. </span>
  1255. <span class="md-source-file__fact">
  1256. <span class="md-icon" title="Created">
  1257. <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>
  1258. </span>
  1259. <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>
  1260. </span>
  1261. </aside>
  1262. </article>
  1263. </div>
  1264. <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
  1265. </div>
  1266. </main>
  1267. <footer class="md-footer">
  1268. <div class="md-footer-meta md-typeset">
  1269. <div class="md-footer-meta__inner md-grid">
  1270. <div class="md-copyright">
  1271. <div class="md-copyright__highlight">
  1272. Copyright &copy; 2012- OpenBLAS contributors
  1273. </div>
  1274. Made with
  1275. <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
  1276. Material for MkDocs
  1277. </a>
  1278. </div>
  1279. <div class="md-social">
  1280. <a href="https://github.com/OpenMathLib/OpenBLAS" target="_blank" rel="noopener" title="github.com" class="md-social__link">
  1281. <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>
  1282. </a>
  1283. <a href="https://github.com/OpenMathLib/OpenBLAS/LICENSE" target="_blank" rel="noopener" title="github.com" class="md-social__link">
  1284. <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>
  1285. </a>
  1286. </div>
  1287. </div>
  1288. </div>
  1289. </footer>
  1290. </div>
  1291. <div class="md-dialog" data-md-component="dialog">
  1292. <div class="md-dialog__inner md-typeset"></div>
  1293. </div>
  1294. <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>
  1295. <script src="../assets/javascripts/bundle.13a4f30d.min.js"></script>
  1296. </body>
  1297. </html>

OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.