Code Monkey home page Code Monkey logo

optimized-routines's Introduction

ARM math library functions
----------------------------

This package contains a number of math functions from ARM's math library,
as well as a build system and a test suite. In addition to the source code,
there is also a script "remez.jl", which was used to generate coefficients
used in the implementation of these functions (see comments in the code).

Requirements: gcc >= 4.8, cmake >= 2.8, mpfr, mpc, qemu-user-static.

For a native build on an AArch64 platform, everything (including tests) should
work out-of the box, assuming the system compiler is a recent gcc. Simply follow
the instructions below to configure the build using cmake (leaving out the
-DCMAKE_TOOLCHAIN_FILE argument).

Cross builds are supported for Linux hosts. First, install the required
packages to build and run the tests on your distro of choice:
# apt-get install qemu-user-static gcc-aarch64-linux-gnu libmpfr-dev \
  libmpc-dev cmake

You could also use a custom aarch64-linux-gnu-gcc cross toolchain, e.g. from
Linaro, if your system doesn't provide one:

https://releases.linaro.org/15.02/components/toolchain/binaries/

The build script will build both a shared and a static math library object
containing the ARM functions for the specified target, a host-side application
rtest that generates test cases, and a target-side application mathtest that is
linked against the math library and actually executes the tests.

Generally, the steps to build and run the tests are:

mkdir -p /my/build/folder && cd /my/build/folder
cmake /path/to/src -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain/file
make
make check

The toolchain file specifies the paths to the cross-compiler, i.e.
aarch64-linux-gnu-gcc, as well as the sysroot parameter for the build. An
example can be found in toolchain-gcc.cmake, which assumes that you have
the cross toolchain installed in /usr/bin and the sysroot is
/usr/aarch64-linux-gnu respectively. This should work with the Ubuntu packages
suggested above as-is. Edit the paths as necessary if your cross toolchain
lives somewhere else. Alternatively, you can specify the necessary parameters
from the toolchain file directly on the command line.

The files are built in the build directory as follows:
build/
  bin/
    rtest
    mathtest
    runtest.sh
  lib/
    libmathlib.so
    libmathlib_static.a
  include/
    arm_math.h

It is possible to specify which emulator to use for the execution of the tests
in the cross compilation case by specifying the following option:
cmake (...) -DCMAKE_CROSSCOMPILING_EMULATOR=/path/to/your/emulator
By default, qemu-aarch64-static will be used, so this has to be on your path
if you want to cross-run the test suite.

Whenever the CMake configuration is changed, it is wise to delete the whole
build folder instead of just rerunning CMake inside the existing folder.

The build system also has experimental support for using clang as the cross
compiler.
!!!You need CMake >= 3.0 and clang >= 3.5.0 for this!!!
Before compilation, apply the source patch in the patches/ folder to make sure
everything works properly when compiled with clang. There is a sample toolchain
file for clang included as toolchain-clang.cmake.

optimized-routines's People

Contributors

nsz-arm avatar gwl-arm avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.