![]() |
![]() |
This readme provides instructions to compile the RALFit solver.
To read more about the solver, see the documentation, the C interface, or the Python interface.
- CMake (tested on 3.31) and GNU Make
- Modern Fortran compiler
- C compiler
- Python 3 (tested on 3.11.4) if building the Python package
The package uses CMake to configure and Make build. The following CMake options are briefly described
-DCMAKE_BUILD_TYPE={Release|Debug}defines the type of build, defaultRelease-DBUILD_PYTHON={On|Off}option to build the Python interface (package), defaultOn-DSINGLE_PRECISION={Off|On}selects which floating point type to use, defaultOff(double precision)
-
Building the
Debugversion implies the internal reference LAPACK and BLAS libraries are used, not the user-provided one. -
Some of the example sources are only compiled when building the double precision floating point version of the library and are not available when building the single precision version.
git clone https://github.com/ralna/RALFit.git
If building Python interface, then configure or load the virtual environment
python3 -mvenv p3
. p3/bin/activate
cd RALFit/libRALFit`
cmake -S . -B build
cmake --build build --parallel 4
The examples sources are located in the sub-folders of libRALFit/examples/ and there are Fortran, C and Python examples.
The compiled example executables can be found in build/examples/
This section shows how to build RALFit using an accelerated compiler (AMD, Intel, etc) and linking to performant LAPACK/BLAS libraries (e.g. AOCL, MKL). We illustrate how to build using AMD's AOCC compiler and AOCL accelerated BLAS and LAPACK libraries.
Prior to building an accelerated version of RALFit, install compiler and libraries. Refer here to install and load AMD AOCC compilers and here to install and configure AOCL BLAS and LAPACK.
Make sure the correct compiler version is available on the path:
$ clang --version
AMD clang version 17.0.6 (CLANG: AOCC_5.1.0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/u/amd/aocc-compiler-rel-5.1.0/bin
and a the same banner is printed for flang --version command.
To instruct CMake to compile to the native CPU architecture and use the AMD accelerated versions BLAS and LAPACK,
pass the flags -DBLA_VENDOR=AOCL -DCMAKE_C_FLAGS_RELEASE="-O2 -march=native -DNDEBUG" -DCMAKE_Fortran_FLAGS_RELEASE="-O2 -march=native -DNDEBUG".
Make sure the correct compiler, BLAS, and LAPACK versions are found by CMake:
$ CC=clang FC=flang cmake -S . -B build --fresh -DBLA_VENDOR=AOCL -DCMAKE_C_FLAGS_RELEASE="-O2 -march=native -DNDEBUG" -DCMAKE_Fortran_FLAGS_RELEASE="-O2 -march=native -DNDEBUG"
Should produce an output similar to
...
-- Check for working Fortran compiler: /home/u/amd/aocc-compiler-rel-5.0.0/bin/flang - skipped
-- Check for working C compiler: /home/u/amd/aocc-compiler-rel-5.0.0/bin/clang - skipped
...
-- Found LAPACK: /home/u/amd/5.0.0/aocl/lib/libflame.so;/home/u/amd/5.0.0/aocl/lib/libblis.so;-fopenmp
-- The LAPACK library was found at/home/u/amd/5.0.0/aocl/lib/libflame.so/home/u/amd/5.0.0/gcc/lib/libblis.so-fopenmp
...
Now it is ready to build
cmake --build build --parallel 4

