The primary goal of our project is to enhance loma
by integrating support for OpenMPI (Open Message Passing Interface). This integration will enable loma
to distribute and parallelize the compilation process across multiple machines, significantly improving compilation speed and efficiency. By splitting a very large dataset across several machines, we can effectively test various inputs for a particular function, leveraging the computational power of distributed systems.
The OpenMPI extension of Loma is supported by the implementation described below:
-
Parser Codebase Extension:
- The parser codebase has been extended to support another decorator
@openMPI
. If this decorator is found, the parser sets a parameter asis_openMPI
totrue
in theFunctionDef
.
- The parser codebase has been extended to support another decorator
-
Compiler Codebase Modification:
- If a
FunctionDef
is found, it generates two different C files: one which acts as a parent and the other which acts as a child.
- If a
-
Parent Codebase Compilation:
- The parent codebase is compiled as a DLL (shared library) and can be loaded easily in Python. The main purpose of the parent is to spawn
n
(present as a parameter to the parent function) child workers which will execute the function. Additionally, the parent will send all the required parameters to the child processes and gather and receive the output from the child processes. This gathered output is what is sent back to the Python interface.
- The parent codebase is compiled as a DLL (shared library) and can be loaded easily in Python. The main purpose of the parent is to spawn
-
Child Codebase Compilation:
- The child codebase is compiled as a regular object file. This is necessary as OpenMPI parallelization can only be invoked in files which have a
main
function. This child codebase additionally contains a wrapper on top of the concerned function which receives the parameters from the parent and sends back the response to the parent.
- The child codebase is compiled as a regular object file. This is necessary as OpenMPI parallelization can only be invoked in files which have a
Figure 1: Open MPI implementation in Loma. The loma compiler generates two OpenMPI-based C code files. One DLL which acts as a parent and spawns multiple child workers. These child workers are the second generated files which contain an OpenMPI wrapper on top of the actual generated C function.
The project is organized within the directory hw_tests/project
, which includes the following components:
-
documentation: This directory houses the installation guide for OpenMPI and project documentation, offering comprehensive insights into project setup and functionality.
-
plots: Within this directory, various plots generated during the project reside, showcasing visual representations of data and results.
-
tests: This directory hosts two distinct Python files:
- forward_test.py: Contains test cases specifically designed for forward differentiation.
- reverse_test.py: Contains test cases tailored for reverse differentiation.
-
experiments: This directory contains detailed experimentation conducted throughout the project, providing empirical validation and analysis of the implemented functionalities.
This structured organization facilitates clarity and ease of navigation, ensuring efficient access to project components and resources essential for development, testing, and documentation purposes.