HPC 2025 (1)
HPC 2025 (1)
Definition:
Types:
1. Undirected Graph:
o Edges do not have direction.
o If there is an edge between A and B, you can go from A → B and B → A.
2. Directed Graph (Digraph):
o Edges have direction.
o A → B does not imply B → A.
3. Weighted Graph:
o Each edge has a weight (cost, distance, etc.).
4. Unweighted Graph:
o Edges have no weights.
5. Cyclic Graph:
o Contains one or more cycles.
6. Acyclic Graph:
o Contains no cycles.
o Directed Acyclic Graph (DAG) used in scheduling, compiler design, etc.
7. Connected Graph:
o There is a path between every pair of vertices.
8. Disconnected Graph:
o Not all vertices are connected.
Explores all neighbors at the current depth before moving to the next level.
Steps:
Applications:
Advantages:
Disadvantages:
Steps:
1. Start at a node.
2. Use a stack (or recursion) to go deep.
3. Backtrack if no unvisited neighbors.
Applications:
Advantages:
Disadvantages:
Key Points:
Steps:
Applications:
GPS systems.
Network routing.
Game AI pathfinding.
A subset of edges that connect all vertices with the minimum total edge weight and
no cycles.
Applications:
Network design.
Clustering.
Image segmentation.
🔧 Prim’s Algorithm
Purpose:
Builds the MST by growing the tree from one starting node.
Steps:
Key Types:
1. Best-First Search:
o Uses a priority queue based on a heuristic value.
o Greedy in nature.
2. A Search*:
o Combines actual cost from start and estimated cost to goal:
f(n) = g(n) + h(n)
g(n): cost so far
h(n): estimated cost to goal
Advantages:
Disadvantages:
Advantage:
Fast and often finds solution quickly.
Disadvantage:
⭐ A* Search Algorithm
Key Features:
Applications:
Pathfinding in games.
Robotics navigation.
Puzzle solvers.
Advantages:
Disadvantages:
Steps:
1. Start at index 0.
2. Compare each element with the target.
3. Return index if found, else return -1.
Simple to implement.
Works on unsorted data.
Disadvantages:
Types:
Advantages:
Disadvantages:
Overhead of synchronization.
Complex to implement for irregular data.
2. Deadlock:
3. Race Conditions:
4. Load Balancing:
5. Scalability:
6. Communication Overhead:
💬 What is MPI?
MPI (Message Passing Interface):
🎯 Goals of MPI:
MPI_Finalize();
return 0;
}
🔹 MPI in FORTRAN:
fortran
CopyEdit
program hello
use mpi
implicit none
integer :: rank, size, ierr
call MPI_Init(ierr)
call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr)
call MPI_Comm_size(MPI_COMM_WORLD, size, ierr)
call MPI_Finalize(ierr)
end program hello
Derived Types:
📡 Eager Protocol
Definition:
Use Case:
Small messages.
Reduces latency.
Advantage:
Fast transmission.
Disadvantage:
🔁 Rendezvous Protocol
Definition:
Use Case:
Large messages.
Advantage:
Disadvantage:
Higher latency.
🔃 Linear Shift Communication Pattern
Definition:
Steps:
Use Case:
Ring topology.
Collective operations.
Solutions:
Goal:
When multiple data transmissions compete for the same network resources.
Causes:
Many-to-one communication.
Shared interconnects.
Effects:
Increased latency.
Lower bandwidth.
Solutions:
Topology-aware scheduling.
Buffer management.
Traffic shaping.
Key Concepts:
1. Optimal Substructure:
o Problem can be solved using solutions of its subproblems.
2. Overlapping Subproblems:
o Same subproblems are solved multiple times.
Techniques:
Examples:
Fibonacci series.
Knapsack problem.
Matrix chain multiplication.
Shortest paths in graphs (e.g., Floyd-Warshall).
Advantages:
Disadvantages:
Finding the path between two vertices such that the sum of weights is minimized.
Algorithms:
1. Dijkstra’s Algorithm:
o For non-negative weights.
2. Bellman-Ford Algorithm:
o Handles negative weights.
3. Floyd-Warshall Algorithm:
o Finds shortest paths between all pairs of vertices.
4. A*:
o Uses heuristic for efficient search.
Applications:
A class of deep neural networks mainly used for image recognition and
classification.
🔧 Architecture:
📈 Advantages:
📉 Disadvantages:
Computationally expensive.
Requires a lot of labeled data.
🔁 What is RNN?
Definition:
🔄 How it works:
Formula:
h(t) = f(W * x(t) + U * h(t-1))
Remembers sequences.
Ideal for language modeling, time series, speech recognition.
❌ Disadvantages:
Benefits: