Skip to content

How to build OpenBLAS for Windows on ARM64

Niyas Sait edited this page Feb 22, 2022 · 10 revisions

This page describes how to natively build OpenBLAS library for windows on arm64 targets.

Prerequisite

Following tools needs to be installed

1. Download and install clang for windows on arm

Find the latest LLVM build for WoA from LLVM release page

E.g: LLVM 12 build for WoA64 can be found here

Run the LLVM installer and ensure that LLVM is added to environment PATH.

2. Download and install classic flang for windows on arm

Classic flang is the only available FORTRAN compiler for windows on arm for now and a pre-release build can be found here

There is no installer for classic flang and the zip package can be extracted and the path needs to be added to environment PATH.

E.g: on PowerShell

$env:Path += ";C:\flang_woa\bin"

Build

The following steps describe how to build the static library for OpenBLAS with and without LAPACK

1. Build static library with BLAS routines

This can be either built using CMake or Make

a. CMake

cmake .. -G Ninja -DCMAKE_C_COMPILER=clang -DBUILD_WITHOUT_LAPACK=1 -DNOFORTRAN=1 -DDYNAMIC_ARCH=0 -DTARGET=ARMV8 -DARCH=arm64 -DBINARY=64 -DUSE_OPENMP=0

cmake --build . --config Release

b. Make

make CC="clang" HOSTCC="clang" AR="llvm-ar" BUILD_WITHOUT_LAPACK=0 NOFORTRAN=0 DYNAMIC_ARCH=0 TARGET=ARMV8 ARCH=arm64 BINARY=64 USE_OPENMP=0 PARALLEL=1 RANLIB="llvm-ranlib" MAKE=make F_COMPILER=FLANG FC=FLANG FFLAGS_NOOPT="-march=armv8-a -cpp" FFLAGS="-march=armv8-a -cpp" NEED_PIC=0 libs

2. Add LAPACK routines to the static library

Classic flang have compatibility issues with cmake hence the adding LAPACK to the library can be only performed with make

make -C lapack-netlib CC="clang" HOSTCC="clang" AR="llvm-ar" BUILD_WITHOUT_LAPACK=0 NOFORTRAN=0 DYNAMIC_ARCH=0 TARGET=ARMV8 ARCH=arm64 BINARY=64 USE_OPENMP=0 PARALLEL=1 RANLIB="llvm-ranlib" MAKE=make F_COMPILER=FLANG FC=FLANG FFLAGS_NOOPT="-march=armv8-a -cpp" FFLAGS="-march=armv8-a -cpp" NEED_PIC=0 lib

Known issue

getarch.exe execution error

If you notice that platform-specific headers by getarch.exe are not generated correctly, It could be due to a known debug runtime DLL issue for arm64 platforms. Please check out link for the workaround.