4

First macOS release of Arm Performance Libraries

 1 year ago
source link: https://community.arm.com/arm-community-blogs/b/tools-software-ides-blog/posts/first-macos-release-of-arm-performance-libraries
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Arm are proud to announce that we have now released our first version of Arm Performance Libraries (ArmPL) fully compatible with M-series Apple silicon running macOS. This release brings the full support for all the areas included in the usual Linux releases. 

Background to Arm Performance Libraries

Arm Performance Libraries itself has been available for Linux-based AArch64 systems since 2015 and is already commonly used for HPC applications. It provides a high-performing CPU-based implementations of the following commonly used numerical functionality:

  • BLAS: Matrix and vector linear algebra building blocks.
  • LAPACK: More complex linear algebra including matrix factorization and solving functions, eigenvalues and eigenvector calculation, and matrix inversion routines. This version matches the latest version of LAPACK which is 3.11.0.
  • FFTs: Full support for in-place and out-of-place real and complex Fast Fourier Transforms using the FFTW API.
  • Sparse linear algebra: Support including optimized functions for matrix-vector, matrix-matrix and solving triangular sparse systems. A recent blog outlines the new additions to this provision.
  • Batched linear algebra: Useful where there are many small cases to be solved at once

The use of the standard APIs for BLAS, LAPACK and the FFTs means users can easily switching between using other libraries and ArmPL. All existing applications that use these interfaces will work without code changes.

What's different in the Mac version?

Hopefully nothing! This version includes both C/C++ and Fortran interfaces. Full documentation is available online for all functions. The library also has a set of example programs provided at installation time that can be used, not only to verify you can link correctly, but also to demonstrate how to use our custom sparse interfaces.

Optimizations in this release are tailored to the M1 and M2 families of chips for Mac, including parallel implementations using OpenMP on the available cores. We're looking forward to getting feedback from users on how they get to accelerate their own application performance using this product.

How to get and use ArmPL 23.06

In order to get Arm Performance Libraries simply head over to our Download page. No payment or license is needed, simply install and you will be good to go.

The libraries are provided from a standard Mac mountable disk image (.dmg) which contains an installation script. Once installed, simply modify the build environment of your application to point to your ArmPL install directory and link in the correct library.

As with existing versions of Arm PL, we provide builds using 32-bit and 64-bit integers, and with and without OpenMP. For the Mac version we ensure compatibility with the latest released version of LLVM, i.e. LLVM 16.  C/C++ users are therefore advised to install clang version 16 or above, including support for OpenMP run time libraries. We suggest using either Homebrew (https://brew.sh/) or MacPorts (https://ports.macports.org).  Installing LLVM using each of these is done, respectively, using the commands:

Fullscreen
brew install llvm@16
    brew install llvm@16
Fullscreen
port install clang-16
    port install clang-16

In addition, users are advised to set the following environment variables, especially if running the examples provided:

Fullscreen
export ARMPL_DIR=<location of Arm PL armpl_23.06_flang-new_clang_16 directory>
export OPENMP_DIR=<location of libomp.dylib>
    export ARMPL_DIR=<location of Arm PL armpl_23.06_flang-new_clang_16 directory>
    export OPENMP_DIR=<location of libomp.dylib>

For convenience we provide a version of libomp.dylib in ${ARMPL_DIR}/lib.

Users who wish to link to the libraries only from C/C++ will still need to link to the Fortran runtime libraries, libFortranDecimal.a and libFortranRuntime.a which are also provided in ${ARMPL_DIR}/lib.

Today there are limited choices of Fortran compilers available for Macs, and we are very pleased to announce that we have produced the Fortran parts of the library using the new LLVM Flang project. Whilst Flang is still in development we are confident that we have ArmPL as a good proof point of the continued development of that compiler as it heads towards production level. Fortran users, those who have Fortran source code to compile, should download. and build the LLVM Fortran compiler for MacOS. The source repository can be downloaded from https://github.com/llvm/llvm-project.git.

The following libraries are provided:

  • libarmpl_lp64          - 32-bit integer interface functions with no OpenMP
  • libarmpl_lp64_mp   - 32-bit integer interface functions including multithreading using OpenMP
  • libarmpl_ilp64        - 64-bit integer interface functions with no OpenMP
  • libarmpl_ilp64_mp - 64-bit integer interface functions including multithreading using OpenMP

Each of the library types are provided as static (e.g. libarmpl_lp64.a) and dynamic (e.g. libarmpl_lp64.dylib). Advice on how to use dynamic libraries is given in our documentation. Note that the availability of both 32-bit and 64-bit integers version is one of the advantages of using ArmPL over some other frameworks which just offers a single choice of interface.

An example of linking to the OpenMP version of the library with 32-bit integer interfaces using clang would be:

Fullscreen
clang foo.o -fopenmp -L${ARMPL_DIR}/lib -larmpl_lp64_mp -lFortranDecimal -lFortranRuntime -lm -lc++ -o foo.exe
clang foo.o -fopenmp -L${ARMPL_DIR}/lib -larmpl_lp64_mp -lFortranDecimal -lFortranRuntime -lm -lc++ -o foo.exe

What's next?

The releases of Arm Performance Libraries for Apple silicon on macOS will be continued going forward as part of our regular release cycle. This aims for two major releases each year with the 23.10 being the next scheduled release in October. Getting feedback from users will help us plan all future work so don't hesitate to get in contact through our user forum.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK