-
Notifications
You must be signed in to change notification settings - Fork 1.5k
How to build OpenBLAS for iPhone iOS (ARMv8)
As none of the current developers uses iOS, it is unfortunately still unclear if the following instructions are sufficient to build a fully working OpenBLAS for this platform. Apple provides its own implementation of BLAS/LAPACK under the name Accelerate so you may want to just use that unless you are specifically interested in OpenBLAS.
Go to the directory where you unpacked OpenBLAS. (latest develop branch or 0.3.9 or later)
Next, create a file with the following content:
#!/bin/bash
MIN_IOS_VERSION=10.2
TARGET_SDKROOT="$(xcrun --sdk iphoneos --show-sdk-path)"
CC="$(xcrun --sdk iphoneos --find clang) -isysroot $TARGET_SDKROOT"
CFLAGS="-isysroot $TARGET_SDKROOT -arch arm64 -target arm64-apple-ios -mios-version-min=$MIN_IOS_VERSION"
HOST_SDKROOT="$(xcrun --show-sdk-path)"
HOSTCC="$(xcrun --find clang) -isysroot $HOST_SDKROOT"
make TARGET=ARMV8 BINARY=64 HOSTCC="$HOSTCC" CC="$CC" CFLAGS="$CFLAGS" NOFORTRAN=1 libs
Adjust MIN_IOS_VERSION as necessary for your installation, e.g. change the version number to the minimum iOS version you want to target and execute this file to build the library.
Note that ARMV8 is a generic implementation that should work on most arm64 hardware, for best performance try
compiling with TARGET=CORTEXA57 or equivalent cpu-specific entry from TargetList.txt as appropriate for your hardware.
Unfortunately it is unclear at the moment whether the Xcode assembler will accept the dialect used in the assembly files. According to issue #1531, you will probably have to edit the file kernel/arm64/KERNEL.ARMV8 and replace the
line SGEMMKERNEL= sgemm_kernel_4x4.S
with SGEMMKERNEL=../generic/gemmkernel_2x2.c
to work around one such incompatibility.(This is done automatically starting from version 0.3.4)