AOCL-LibM is a high-performant implementation of LibM, the standard C library of basic floating-point mathematical functions. It includes many of the functions from the C99 standard. Single and double precision versions of the functions are provided, all optimized for accuracy and performance, including a small number of complex functions. There are also a number of vector and fast scalar variants provided, in which a small amount of the accuracy has been traded for greater performance.
A list of the scalar functions present in the library is provided below. Note that an "f" at the end of the function name indicates that it is single-precision; otherwise, it is double-precision. They can be called by a standard C99 function call and naming convention and must be linked with AOCL-LibM before standard libm.
For example:
$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/path/to/AOCL-LibM_library
$ clang -Wall -std=c99 myprogram.c -o myprogram -L<Path to AOCL-LibM Library> -lalm -lm
Or
$ gcc -Wall -std=c99 myprogram.c -o myprogram -L<Path to AOCL-LibM Library> -lalm -lm
Trigonometric
Inverse Trigonometric
Hyperbolic
Inverse Hyperbolic
Exponential and Logarithmic
Error
Power and Absolute Value
Nearest Integer
Remainder
Manipulation
Maximum, Minimum and Difference
The recommended build system is CMake. See BUILDING.md for scons reference and
docs/CMakeBuildSystem.md for the cmake reference.
Note (changed in this release): AOCL-LibM no longer depends on the external
aocl-utilslibrary. Runtime CPU detection is now handled by an internal, pure-C module, so building/installingaocl-utilsand its related build flags (--aocl_utils_install_path,--aocl_utils_link,-DAOCL_UTILS_INCLUDE_DIR,-DAOCL_UTILS_LIB) are no longer required. If you are upgrading from a previous release, you can drop anyaocl-utilsconfiguration; seedocs/design/InternalUtilsDesign.mdfor migration details.
Building the library alone needs only CMake and a C/C++ compiler; the multi-precision packages (MPFR, GMP, MPC) are required only for the test framework. All optional components (tests and examples) are off by default.
Linux:
cmake --preset dev-release-gcc --fresh
cmake --build --preset dev-release-gcc -j
Windows:
cmake --preset dev-win-release-llvm-ninja --fresh
cmake --build --preset dev-win-release-llvm-ninja -j
The built libraries are placed under build/<presetName>/lib.
The examples are off by default, so enable them at configure time with
-DLIBM_BUILD_EXAMPLES=ON. Always build the library first, then the test_libm
target, then run the example. The full, copy-pasteable sequence is:
Linux:
# 1. Configure with examples enabled
cmake --preset dev-release-gcc -DLIBM_BUILD_EXAMPLES=ON --fresh
# 2. Build the library
cmake --build --preset dev-release-gcc
# 3. Build the example (library must already be built)
cmake --build --preset dev-release-gcc --target test_libm
# 4. Run the example
export LD_LIBRARY_PATH=${PWD}/build/dev-release-gcc/lib:$LD_LIBRARY_PATH
./build/dev-release-gcc/examples/test_libm
Windows (Ninja generator):
REM i. Set up the Visual Studio x64 build environment (provides Ninja and clang-cl)
"<path_to_visualstudio>\VC\Auxiliary\Build\vcvarsall.bat" x64
REM 1. Configure with examples enabled
cmake --preset dev-win-release-llvm-ninja -DLIBM_BUILD_EXAMPLES=ON --fresh
REM 2. Build the library
cmake --build --preset dev-win-release-llvm-ninja
REM 3. Build the example (library must already be built)
cmake --build --preset dev-win-release-llvm-ninja --target test_libm
REM 4. Run the example
set PATH=%PATH%;%CD%\build\dev-win-release-llvm-ninja\lib
build\dev-win-release-llvm-ninja\examples\test_libm.exe
For the full list of targets, build options and other details, see
docs/CMakeBuildSystem.md.
AOCL-LibM is developed and maintained by AMD. For support of these libraries and the other tools of AMD Zen Software Studio, see https://www.amd.com/en/developer/aocc/compiler-technical-support.html
Assembly
40.5%
C
38.0%
C++
17.8%
Python
2.0%
CMake
1.3%
AOCL-LibM is a high-performant implementation of LibM, the standard C library of basic floating-point mathematical functions. It includes many of the functions from the C99 standard. Single and double precision versions of the functions are provided, all optimized for accuracy and performance, including a small number of complex functions. There are also a number of vector and fast scalar variants provided, in which a small amount of the accuracy has been traded for greater performance.
A list of the scalar functions present in the library is provided below. Note that an "f" at the end of the function name indicates that it is single-precision; otherwise, it is double-precision. They can be called by a standard C99 function call and naming convention and must be linked with AOCL-LibM before standard libm.
For example:
$ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/path/to/AOCL-LibM_library
$ clang -Wall -std=c99 myprogram.c -o myprogram -L<Path to AOCL-LibM Library> -lalm -lm
Or
$ gcc -Wall -std=c99 myprogram.c -o myprogram -L<Path to AOCL-LibM Library> -lalm -lm
Trigonometric
Inverse Trigonometric
Hyperbolic
Inverse Hyperbolic
Exponential and Logarithmic
Error
Power and Absolute Value
Nearest Integer
Remainder
Manipulation
Maximum, Minimum and Difference
The recommended build system is CMake. See BUILDING.md for scons reference and
docs/CMakeBuildSystem.md for the cmake reference.
Note (changed in this release): AOCL-LibM no longer depends on the external
aocl-utilslibrary. Runtime CPU detection is now handled by an internal, pure-C module, so building/installingaocl-utilsand its related build flags (--aocl_utils_install_path,--aocl_utils_link,-DAOCL_UTILS_INCLUDE_DIR,-DAOCL_UTILS_LIB) are no longer required. If you are upgrading from a previous release, you can drop anyaocl-utilsconfiguration; seedocs/design/InternalUtilsDesign.mdfor migration details.
Building the library alone needs only CMake and a C/C++ compiler; the multi-precision packages (MPFR, GMP, MPC) are required only for the test framework. All optional components (tests and examples) are off by default.
Linux:
cmake --preset dev-release-gcc --fresh
cmake --build --preset dev-release-gcc -j
Windows:
cmake --preset dev-win-release-llvm-ninja --fresh
cmake --build --preset dev-win-release-llvm-ninja -j
The built libraries are placed under build/<presetName>/lib.
The examples are off by default, so enable them at configure time with
-DLIBM_BUILD_EXAMPLES=ON. Always build the library first, then the test_libm
target, then run the example. The full, copy-pasteable sequence is:
Linux:
# 1. Configure with examples enabled
cmake --preset dev-release-gcc -DLIBM_BUILD_EXAMPLES=ON --fresh
# 2. Build the library
cmake --build --preset dev-release-gcc
# 3. Build the example (library must already be built)
cmake --build --preset dev-release-gcc --target test_libm
# 4. Run the example
export LD_LIBRARY_PATH=${PWD}/build/dev-release-gcc/lib:$LD_LIBRARY_PATH
./build/dev-release-gcc/examples/test_libm
Windows (Ninja generator):
REM i. Set up the Visual Studio x64 build environment (provides Ninja and clang-cl)
"<path_to_visualstudio>\VC\Auxiliary\Build\vcvarsall.bat" x64
REM 1. Configure with examples enabled
cmake --preset dev-win-release-llvm-ninja -DLIBM_BUILD_EXAMPLES=ON --fresh
REM 2. Build the library
cmake --build --preset dev-win-release-llvm-ninja
REM 3. Build the example (library must already be built)
cmake --build --preset dev-win-release-llvm-ninja --target test_libm
REM 4. Run the example
set PATH=%PATH%;%CD%\build\dev-win-release-llvm-ninja\lib
build\dev-win-release-llvm-ninja\examples\test_libm.exe
For the full list of targets, build options and other details, see
docs/CMakeBuildSystem.md.
AOCL-LibM is developed and maintained by AMD. For support of these libraries and the other tools of AMD Zen Software Studio, see https://www.amd.com/en/developer/aocc/compiler-technical-support.html
Assembly
40.5%
C
38.0%
C++
17.8%
Python
2.0%
CMake
1.3%