This project implements and evaluates the performance of matrix multiplication across multiple nodes using MPI.
The project includes:
- Serial Matrix Multiplication: Baseline implementation for comparison
- MPI Distributed Matrix Multiplication: Parallel implementation using MPI
- Performance Metrics: Execution time and scalability measurements
- Benchmarking Tools: Automated testing and comparison utilities
- Documentation: Comprehensive analysis and results
.
├── src/
│ ├── serial_matrix_mult.c # Serial implementation
│ ├── mpi_matrix_mult.c # MPI distributed implementation
│ └── utils.c # Utility functions
├── include/
│ └── utils.h # Header file for utilities
├── scripts/
│ ├── run_benchmarks.sh # Benchmarking script
│ └── plot_results.py # Performance visualization
├── results/ # Benchmark results and plots
├── Makefile # Build configuration
├── requirements.txt # Python dependencies for plotting
└── README.md # This file
brew install open-mpi
sudo apt-get update
sudo apt-get install openmpi-bin libopenmpi-dev
sudo yum install openmpi openmpi-devel
pip install -r requirements.txt
make clean
make all
./serial_matrix_mult <matrix_size>
mpirun -np <number_of_processes> ./mpi_matrix_mult <matrix_size>
./scripts/run_benchmarks.sh
python scripts/plot_results.py
- Standard O(n³) matrix multiplication algorithm
- Used as baseline for performance comparison
- Data Partitioning: Matrices are distributed across processes using block distribution
- Communication Pattern:
- Process 0 distributes matrix data to all processes
- Each process computes its assigned portion
- Results are gathered back to process 0
- Load Balancing: Ensures even distribution of computational load
The system measures:
- Execution Time: Wall-clock time for computation
- Speedup: Ratio of serial time to parallel time
- Efficiency: Speedup divided by number of processes
- Scalability: Performance across different process counts
- Speedup: Should approach linear speedup for large matrices
- Efficiency: May decrease with more processes due to communication overhead
- Scalability: Performance gains diminish with very large process counts
- MPI not found: Ensure MPI is properly installed and in PATH
- Permission denied: Check file permissions for execution
- Memory issues: Reduce matrix size for limited memory systems
make debug
mpirun -np 4 ./mpi_matrix_mult_debug 100
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.