The project contains the runtime libraries that are used by the MARCO compiler during the link phase.
According to their purpose, they can be categorized as follows:
-
Skeleton libraries
They handle the basic aspects of the executable (e.g., arguments parsing) and manage the various stages of the simulation. -
Driver libraries
They implement the logic that is specific to the chosen integration method. In other words, they control the evolution of the dynamic model. -
Solver libraries
They can be thought as the backbone of driver libraries. They implement the code to perform numerical integration or the classes used to interface with external solvers. Differently from driver libraries, they do not handle more basic aspects of the simulation like printing values at the end of each time step. -
Support libraries
Differently from the other categories, the purpose of support libraries is to provide the implementation of functions that are called by the compiled model and are not generated by the compiler. This is useful in case of operations whose generation in terms of LLVM-IR -- or even higher abstractions -- would be inconvenient when comparing performance improvements and maintainability.
Two development Docker images, marco-runtime-dev-debug-debian-12
and marco-runtime-dev-release-debian-12
are made available.
Their purpose and content follow the same principles for the compiler development images.
The debug
image has the LLVM assertions enabled, while the release
image does not.
The following instructions explain how to build the runtime libraries. LLVM is assumed to be already installed. See the instructions for compiling MARCO for more instructions on its installation.
The RUNTIME_INSTALL_PATH
variable must be set to the desired installation path.
The LLVM_PATH
variable must be set to the installation path that was used during the LLVM installation process.
By default, the CMake configuration searches for SUNDIALS libraries within the OS.
Alternatively, they can be built manually using the dependencies/sundials.sh
script.
If the Sundials library have been built manually, the build system of MARCO can be instructed to use them by setting the MARCO_USE_BUILTIN_SUNDIALS
CMake option must to ON
and the SUNDIALS_PATH
variable to their installation path.
The LLVM_EXTERNAL_LIT
variable represent the path (including the executable name) to the lit
tool. If it has been installed in user mode, it is usually /home/user/.local/bin/lit
.
git clone https://github.com/marco-compiler/marco-runtime.git
cd marco-runtime
mkdir build && cd build
# Set the installation path.
RUNTIME_INSTALL_PATH=runtime_install_path
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${RUNTIME_INSTALL_PATH} \
-DLLVM_PATH=${LLVM_INSTALL_PATH} \
..
cmake --build .
# Run the unit tests.
cmake --build . --target test
# Install the runtime library.
cmake --build . --target install