HPC LA Report-1
HPC LA Report-1
on
Bachelor of Engineering
in
Computer Science and Engineering
Submitted by:
Darshan R. M. 1NT21CS058
CERTIFICATE
This is to certify that the Parallel Computation of Age Statistics Using MPI for School Grade
Simulation (High Performance Computing Learning Assessment 2) is an authentic work carried
out by Darshan R. M. (1NT21CS058) Bonafide student of Nitte Meenakshi Instituteof
Technology, Bangalore in partial fulfilment for the award of the degree of Bachelor of
Engineering in COMPUTER SCIENCE AND ENGINEERING of Visvesvaraya Technological
University, Belgavi during the academic year 2024-25. It is certified that all corrections and
suggestions indicated during the internal assessment has been incorporated inthe report. This
learning assessment has been approved as it satisfies the academic requirement in respect of
learning assessment presented for the said degree.
Faculty Co-ordinator
Mr. Deepak R
Assistant Professor,
Dept. of CSE, NMIT Bangalore
DECLARATION
I hereby declare that
DARSHAN R. M. 1NT21CS058
Date: 20/12/2024
ACKNOWLEDGEMENT
The satisfaction and euphoria that accompany the successful completion of any task would be
incomplete without the mention of the people who made it possible, whose constant guidance and
encouragement crowned our effort with success. I express my sincere gratitude to our Principal
Dr. H. C. Nagaraj, Nitte Meenakshi Institute of Technology for providing facilities.
I wish to thank our HoD, Dr. S Meenakshi Sundaram. for the excellent environment created to
further educational growth in our college. I also thank him for the invaluable guidance provided
which has helped in the creation of a better learning assessment.
I hereby like to thank our Mr.Deepak R, Assistant Professor, Department of Computer Science &
Engineering on his periodic inspection, time to time evaluation of the learning assessment and helpto
bring the learning assessment to the present form.
I also thank all our friends, teaching and non-teaching staff at NMIT, Bangalore, for all the direct
and indirect help provided in the completion of the learning assessment.
DARSHAN R. M. 1NT21CS058
Date: 20/12/2024
ABSTRACT
This project explores the use of the Message Passing Interface (MPI) to simulate the collection and
computation of age statistics in a school setting. The school consists of three grades (PreKG, LKG, UKG),
each with five sections, and each section has ten students. The simulation involves parallel computation,
where each section is represented as an independent process to collect age data.
The program utilizes random number generation to simulate the ages of students and employs MPI's
reduction functions to calculate the minimum age, maximum age, and average age for each section, grade,
and the entire school. This approach demonstrates the efficiency of distributed computing in solving real-
world problems by leveraging parallel processing and aggregation techniques.
Additionally, the implementation emphasizes the scalability and adaptability of the MPI framework. By
distributing tasks across multiple processes, the program efficiently handles large datasets, reducing
computational time and resource usage. The design also provides insights into the importance of parallel
programming in modern applications, making it an effective solution for similar large-scale statistical
computations.
TABLE OF CONTENTS
Background
Brief History of Technology/Concept
Applications
Problem Statement
Primary Objectives
2. Implementation 3-6
Methodology
Flow Diagram
Code
3. Result Analysis 7
4. Conclusion 8
LIST OF FIGURES
FIGURE PAGE
DESCRIPTION
NUMBER NUMBER
1 Program Flow 4
2 Output of Code Execution 7
CHAPTER 1
INTRODUCTION
Background
In modern distributed systems, efficient communication and data aggregation are critical
for the seamless operation of geographically dispersed units. Restaurant chains, which
handle vast amounts of transactional and sales data, benefit significantly from parallel
computing techniques to optimize operations, reduce communication overhead, and
improve decision-making. OpenMPI (Open Message Passing Interface) facilitates robust,
scalable communication for such systems, enabling real-time data exchange and processing
across multiple nodes.
In industries like hospitality, where rapid data collection, aggregation, and dissemination
are critical, MPI's message-passing paradigm ensures minimal latency and high data
consistency. Restaurant management systems, particularly those distributed across
locations, use such technologies for sales monitoring, resource allocation, and performance
optimization.
Applications
The concepts and technologies used in OpenMPI for distributed communication extend
to various domains, including:
1
• Retail and E-Commerce: Synchronizing inventory and sales data across
distributed warehouses and stores.
• Supply Chain Optimization: Facilitating efficient communication between
different nodes in the supply chain for real-time updates.
• IoT Systems: Collecting and processing sensor data from geographically
distributed devices for centralized analysis.
Problem Statement
A school has five sections for each grade and they have three grades (PreKG, LKG and
UKG). They send a teacher to each section to get the information about the age of each
child in the section. Assume that there are ten students in each section. Assuming each
teacher is simulated as a thread use the MPI-Reduction function to determine the
Minimum age, the Maximum age and the Average age for each section, each grade and
for the whole school. Use random numbers for generating the age of the children.
Primary Objectives
The primary objectives of this project are as follows:
1. Simulate a School's Data Structure: Represent the school's organization with three
grades (PreKG, LKG, UKG), five sections per grade, and ten students per section.
2. Generate Random Age Data: Create random ages for students in each section to
simulate real-world data.
3. Utilize MPI for Parallel Computing: Employ MPI to assign each section as an
independent process for parallel computation.
4. Calculate Local Statistics:
5. Compute the minimum age, maximum age, and average age for each section.
6. Aggregate Global Statistics:
7. Use MPI reduction operations to calculate the minimum, maximum, and average ages
for each grade and the entire school.
8. Demonstrate Scalability:
9. Showcase the ability to efficiently handle computations for larger datasets using
distributed processes.
2
Chapter 2
IMPLEMENTATION
Methodology
The age statistics computation system for a simulated school was implemented using MPI to perform
distributed parallel processing. The following steps outline the methodology:
Step 1: Initialization
• Each section of the school is modeled as an MPI process, where every process simulates a section
of one grade.
• The MPI environment is initialized using MPI_Init, and the rank and size of each process are
determined using MPI_Comm_rank and MPI_Comm_size.
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define STUDENTS_PER_SECTION 10
#define SECTIONS 5
#define GRADES 3
#define MIN_AGE 3
#define MAX_AGE 8
// Initialize MPI
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
// Execution time
printf("Execution Time: %.6f seconds\n", end_time - start_time);
}
// Finalize MPI
MPI_Finalize();
return 0;
}
6
CHAPTER 3
RESULT ANALYSIS
7
CHAPTER 4
CONCLUSION
The MPI-based solution efficiently simulates the collection of age data across a school with three grades
and five sections per grade, leveraging parallel processing for faster computation. Each section operates as
an independent MPI process, enabling concurrent generation of student age data and local statistics
calculation.
By utilizing MPI_Reduce, the program aggregates local data from all processes to compute global
statistics, such as minimum age, maximum age, and average age, ensuring accurate results at the
school level.
The design guarantees scalability and efficiency, with processes working independently yet
collaborating to achieve a unified result. The solution highlights the power of MPI in handling real-
world distributed computing problems effectively. With proper configuration and random age
generation, the implementation successfully meets the problem requirements for statistical analysis of
the students' age data.