Skip to content

"Red-Black Tree Search Project": Parallelized Red-Black Tree search with MPI, OpenMP, and CUDA. Performance analysis on various hardware and input configurations.

License

Notifications You must be signed in to change notification settings

Crostino14/RB-Tree-Search-Project-Linux-Version

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

๐Ÿ”ดโšซ Red-Black Tree Search Project (Linux Version)

๐Ÿ“Œ Overview

This project focuses on the parallelisation of the Red-Black Tree Search Algorithm, a self-balancing binary search tree, using different computational approaches:

  • Sequential implementation ๐Ÿ›๏ธ (baseline).
  • MPI + OpenMP implementation โšก (distributed parallelism).
  • CUDA + OpenMP implementation ๐Ÿš€ (GPU acceleration).

๐ŸŽฏ Objectives

  • Implement and analyse the Red-Black AVL Tree Search algorithm in parallel computing environments.
  • Evaluate performance differences between MPI, OpenMP, and CUDA implementations.
  • Conduct extensive benchmarking with different input sizes and hardware configurations.

๐Ÿ“– Theoretical Background

  • Red-Black AVL Tree combines Red-Black Tree and AVL Tree properties to maintain efficient balance for search operations.
  • Parallel Computing Approaches:
    • OpenMP: Multi-threading on shared-memory architectures.
    • MPI: Distributed computing with message-passing.
    • CUDA: GPU acceleration using thousands of cores.

โš™๏ธ Implementation

The project implements three versions of the search algorithm:

  1. Sequential version (baseline).
  2. MPI + OpenMP version:
    • Distributes work across multiple processes using MPI.
    • Utilises OpenMP threads for intra-process parallelism.
  3. CUDA + OpenMP version:
    • CUDA Kernels handle subtree search in parallel.
    • Optimised memory management with shared memory and atomic operations.

๐Ÿ–ฅ๏ธ Experimental Setup

๐Ÿ’ป Hardware

  • CPU: AMD Ryzen 5 7640HS (6 cores, 12 threads)
  • GPU: NVIDIA RTX 4060 (8GB VRAM, 24 CUDA cores)
  • RAM: 16GB DDR5

๐Ÿ› ๏ธ Software

  • OS: Ubuntu 22.04 (via WSL)
  • Compilers: GCC, NVCC (CUDA 12.3), MPI Compiler
  • Tools: Python 3.11 for analysis, CMake for builds

๐Ÿ“Š Performance Analysis

Performance was evaluated by measuring:

  • Execution time under different parallel configurations.
  • Speed-up compared to the sequential baseline.
  • Scalability across varying input sizes.

Key Findings:

  • MPI+OpenMP is effective for multi-node CPU clusters, but performance is limited by communication overhead.
  • CUDA+OpenMP achieves better speed-up on large datasets, benefiting from GPU parallelism.
  • Sequential execution is efficient for small inputs but does not scale well.

๐Ÿ”ง Prerequisites

Before running the Makefile commands, ensure you have the following installed:

  • GCC compiler ๐Ÿ–ฅ๏ธ for C code compilation.
  • MPICC compiler ๐Ÿ”€ for MPI parallel execution.
  • NVCC compiler ๐ŸŽฎ from the CUDA toolkit for GPU-based computation.
  • OpenMP ๐ŸŽ๏ธ for multi-threading support.
  • Python 3 ๐Ÿ with:
    • matplotlib ๐Ÿ“Š (for plots)
    • pandas ๐Ÿ“‘ (for data processing)
    • numpy ๐Ÿ”ข (for numerical computations)

To install Python dependencies, run:

make install_dependencies

๐Ÿ› ๏ธ Makefile Commands

The Makefile automates compilation, testing, cleaning, and performance analysis.

โš™๏ธ Compilation Commands

Command Description
make clean ๐Ÿ—‘๏ธ Removes compiled binaries and output data from previous builds.
make all ๐Ÿ”„ Compiles all versions (with different optimisation levels).
make compile0 ๐Ÿ—๏ธ Compiles with -O0 (no optimisation).
make compile1 ๐Ÿ”น Compiles with -O1 (basic optimisations).
make compile2 ๐Ÿ”ท Compiles with -O2 (further optimisations).
make compile3 ๐Ÿš€ Compiles with -O3 (full optimisation).

๐Ÿงช Testing Commands

Command Description
make test0 / make test1 / make test2 / make test3 โœ… Runs tests for different compiled versions.
make test00 / make test01 / make test02 / make test03 ๐Ÿ”„ Runs tests with predefined values, threads, and MPI processes.
make all_test1 / make all_test2 ๐Ÿ† Combines multiple test targets for convenience.

๐Ÿ“Š Performance Analysis

Command Description
make tables ๐Ÿ“‘ Runs a Python script to create tables from CSV results.
make performance ๐Ÿ“Š Runs a Python script to analyse performance and generate plots & tables.

๐Ÿš€ Usage Guide

To compile and test the project with all optimisation levels and generate performance tables and plots, run:

make clean
make all
make all_test1
make tables
make performance

Each command should be run in the terminal from the root directory of the project.

๐Ÿ“– Full Report

For detailed performance results and analysis, see the full Project Report ๐Ÿ“‘.


๐Ÿค Contributors

  • Agostino Cardamone ๐ŸŽ“ (Student & Creator)
  • Supervisor: Francesco Moscato ๐Ÿซ

About

"Red-Black Tree Search Project": Parallelized Red-Black Tree search with MPI, OpenMP, and CUDA. Performance analysis on various hardware and input configurations.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published