Skip to content

Commit

Permalink
Merge pull request #4987 from martin-frbg/issue3973
Browse files Browse the repository at this point in the history
Update build instructions for WoA (use LLVM19 and its flang-new)
  • Loading branch information
martin-frbg authored Nov 23, 2024
2 parents c520ed1 + 009c1e0 commit 8481301
Showing 1 changed file with 16 additions and 30 deletions.
46 changes: 16 additions & 30 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,49 +439,35 @@ To then use the built OpenBLAS shared library in Visual Studio:
#### Windows on Arm
While OpenBLAS can be built with Microsoft VisualStudio (Community Edition or commercial), you would only be able to build for the GENERIC target
that does not use optimized assembly kernels, also the stock VisualStudio lacks the Fortran compiler necessary for building the LAPACK component.
It is therefore highly recommended to download the free LLVM compiler suite and use it to compile OpenBLAS outside of VisualStudio.
The following tools needs to be installed to build for Windows on Arm (WoA):
- Clang for Windows on Arm.
Find the latest LLVM build for WoA from [LLVM release page](https://releases.llvm.org/).
E.g: LLVM 12 build for WoA64 can be found [here](https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/LLVM-12.0.0-woa64.exe)
Run the LLVM installer and ensure that LLVM is added to environment PATH.
- Download and install classic Flang for Windows on Arm.
Classic Flang is the only available Fortran compiler for Windows on Arm for now.
A pre-release build can be found [here](https://github.com/kaadam/flang/releases/tag/v0.1)
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., in PowerShell:
```
$env:Path += ";C:\flang_woa\bin"
```
- LLVM for Windows on Arm.
Find the latest LLVM build for WoA from [LLVM release page](https://releases.llvm.org/) - you want the package whose name ends in "woa64.exe".
(This may not always be present in the very latest point release, as building and uploading the binaries takes time.)
E.g: a LLVM 19 build for WoA64 can be found [here](https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.2/LLVM-19.1.2-woa64.exe).
Run the LLVM installer and ensure that LLVM is added to the environment variable PATH. (If you do not want to add it to the PATH, you will need to specify
both C and Fortran compiler to Make or CMake with their full path later on)
The following steps describe how to build the static library for OpenBLAS with and without LAPACK:
The following steps describe how to build the static library for OpenBLAS with either Make or CMake:
1. Build OpenBLAS static library with BLAS and LAPACK routines with Make:
1. Build OpenBLAS with Make:
```bash
$ make CC="clang-cl" HOSTCC="clang-cl" 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 HOSTARCH=arm64 libs netlib
$ make CC=clang-cl FC=flang-new AR="llvm-ar" TARGET=ARMV8 ARCH=arm64 RANLIB="llvm-ranlib" MAKE=make
```
2. Build static library with BLAS routines using CMake:
Classic Flang has compatibility issues with CMake, hence only BLAS routines can be compiled with CMake:
2. Build OpenBLAS with CMake
```bash
$ mkdir build
$ cd build
$ 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 -DCMAKE_SYSTEM_PROCESSOR=ARM64 -DCMAKE_CROSSCOMPILING=1 -DCMAKE_SYSTEM_NAME=Windows
$ cmake --build . --config Release
$ cmake .. -G Ninja -DCMAKE_C_COMPILER=clang-cl -DCMAKE_Fortran_COMPILER=flang-new -DTARGET=ARMV8 -DCMAKE_BUILD_TYPE=Release
$ cmake --build .
```
!!! tip "`getarch.exe` execution error"
If you notice that platform-specific headers by `getarch.exe` are not
generated correctly, this could be due to a known debug runtime DLL issue for
arm64 platforms. Please check out [this page](https://linaro.atlassian.net/wiki/spaces/WOAR/pages/28677636097/Debug+run-time+DLL+issue#Workaround)
for a workaround.
#### Generating an import library
Microsoft Windows has this thing called "import libraries". You need it for
Expand Down

0 comments on commit 8481301

Please sign in to comment.