Browse Source

Update build instructions for WoA (use LLVM19 and its flang-new)

tags/v0.3.29
Martin Kroeker GitHub 1 year ago
parent
commit
760a5371f3
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 30 deletions
  1. +15
    -30
      docs/install.md

+ 15
- 30
docs/install.md View File

@@ -439,49 +439,34 @@ 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".
E.g: LLVM 19 build for WoA64 can be found [here](https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.4/LLVM-19.1.4-woa64.exe)
Run the LLVM installer and ensure that LLVM is added to environment 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


Loading…
Cancel
Save