LAPACK - Modernized
LAPACK is a library of Fortran subroutines for solving dense linear algebra problems
Lapack Demo Video
Disclaimer
LAPACK is already pretty modern, this was an attempt at using AI on enterprise code. The title is misleading for marketing purposes.
Lapack
LAPACK (Linear Algebra Package) is a standard software library for numerical linear algebra. It’s written in FORTRAN, and established in mid 1980s. This project is a showcase on the power of AI to work with old and established codebases.
~Vibe~ AI coding isn’t just for greenfield apps; it’s for enterprise brownfield apps as well.
Overview
LAPACK was originally written in FORTRAN 77, but has since been updated to Fortran 90. The routines are organized in a modular fashion so that users can build custom libraries tailored to their specific needs.
My goal was to add modern features to LAPACK without compromizing any existing functionality.
Features Added
- Modern DevOps: Standardize build systems using modern technology (nix) and provide pre-made dev environments (nix, docker).
- Codebase Analysis: Comes with a routine analyzer that can map out entire codebase.
fortran-mapper
, an in-house built parser that loads fortran structure to graph database. With custom hooks, it specializes to extract metadata of LAPACK conventions. - Sparse Matrices: Added previously unimplemented data types that are crucial in modern application.
- Rust Integration: Built direct interfaces to Rust, so that modern applications can interface directly with modern high-performance use cases.
- Testing: Added more testing utilities to make sure new contributions don’t break existing functionality.
- AI Documentation: Specific documentation for LLMs to make AI assisted coding more robust on the codebase.
Impact
LAPACK is used as a linear algebra library for;
- PyTorch
- Numpy
- SciPy
- MATLAB
- OpenFOAM
And many others.
These technologies build a connectivity layer through C code due to LAPACK providing only C bindings. They also ship their in-house solution for sparse matrices.
Now, any project can use the memory safety features of Rust for their interface. And sparse matrix implementations can be provided straight through LAPACK.
Contributing
LAPACK is an open-source project by a team of developers. Contributions are welcome through:
- Bug reports and feature requests
- Code contributions via pull requests
- Documentation improvements
- Performance optimizations
To contribute to this repo;
- The mapper is abstracted to be a standalone project connectome
- For other contributions, submit pull requests.
For development, a development environment is provided through nix
.
1
2
3
4
nix develop
# Optional: enter any of the specific features; check ./nix/shells.nix for details
#nix develop .#feature
#nix develop .#organize
Installation
With the new integration, in any nix environment, lapack can be built using;
1
nix build github:bbaserdem/lapack