0% found this document useful (0 votes)
21 views11 pages

HPC Miniproject

The document presents a mini project report on implementing Huffman Encoding using GPU technology through CUDA, aimed at enhancing performance in data compression tasks. It outlines the project's objectives, methodology, and the advantages of using parallel processing to accelerate character frequency counting and data encoding. The report concludes that the hybrid CPU-GPU approach significantly improves the efficiency of Huffman Encoding, especially for large datasets.

Uploaded by

Arbaz Shaikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views11 pages

HPC Miniproject

The document presents a mini project report on implementing Huffman Encoding using GPU technology through CUDA, aimed at enhancing performance in data compression tasks. It outlines the project's objectives, methodology, and the advantages of using parallel processing to accelerate character frequency counting and data encoding. The report concludes that the hybrid CPU-GPU approach significantly improves the efficiency of Huffman Encoding, especially for large datasets.

Uploaded by

Arbaz Shaikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

.

Department Of Computer Engineering


STES’S SINHGAD ACADEMY OF ENGINEERING
KONDHWA BK, PUNE 411048

2024-2025
“Implement Huffman Encoding on GPU”

Submitted to the

Savitribai Phule Pune University


In partial fulfillment for the award of the Degree of

Bachelor of Engineering
in

Computer Engineering
By

1) Snehal Abnave COBA03


2) Shubham Upadhyay COBA53
3) Sahil Narale COBC12
4) Shreyash Chalke COBC13

Under the guidance of

Prof. P.R. Dongre

1
CERTIFICATE

This is to certify that the mini project report entitled “Implement Huffman Encoding on
GPU” being submitted by Snehal Abnave COBA03, Shubham Upadhyay COBA53, Sahil
Narale COBC12 and Shreyas Chalke COBC13 is a record of bonafide work carried out by
him/her under the supervision and guidance of Prof. P.R. Dongre in partial fulfillment of the
requirement for BE (Computer Engineering) – 2019 course of Savitribai Phule Pune
University, Pune in the academic year 2024-2025.

Date:

Place: Pune

Subject Coordinator Head of the Department

Principal

This Mini Project report has been examined by us as per the Savitribai Phule Pune University,
Pune requirements at SINHGAD ACADEMY OF ENGINEERING Pune – 411048

Internal Examiner External Examiner

2
ACKNOWLEDGEMENT

First and foremost, praises and thanks to the God, the Almighty, for showers
of blessings throughout my project work to complete the research
successfully.
I would like to express my deep and sincere gratitude to my subject teacher
Prof. P.R.Dongre for giving us the opportunity to do this project and provide
invaluable guidance throughout this project. Her dynamism, vision, sincerity,
and motivation have deeply inspired us. She has taught us the methodology to
carry out the research and to present the project works as clearly as possible.
It was a great privilege and honor to work and study under her guidance. We
are extremely grateful for what she has offered us. We would also like to
thank him for his friendship, empathy, and great sense of humor.
We are extremely grateful to all group members Snehal Abnave, Shubham
Upadhyay, Sahil Narale, and Shreyash Chalke for their dedication and
consistency towards this mini project. And also thankful for all the resources
which are provided by each group member and that played a very crucial role
in the accomplishment of this project.

Name Sign
Snehal Abnave
Shubham Upadhyay
Sahil Narale
Shreyash Chalke

(Student's Name & Signature)

3
CONTENTS
Sr. No TITLE Page no

1. Abstract 5

2. Introduction 6

3. Problem Statement 7

4. Motivation 7

5. Objectives 8

6. Theory and Outputs 8-10

7. Conclusion 11

8. References 11

4
Abstract
Huffman Encoding is a fundamental data compression technique that reduces the size of
files without losing any data. It works by assigning shorter binary codes to frequently
occurring characters and longer codes to rare ones.

This project focuses on implementing Huffman Encoding using CUDA to leverage GPU
parallelism. The goal is to accelerate parts of the Huffman process such as character
frequency counting and data encoding. By using the parallel computation capability of the
GPU, we aim to optimize performance and reduce processing time, especially for large
inputs.

This report explains the objectives, theory, implementation strategy, output analysis, and
final conclusions based on the CUDA-based Huffman encoder we developed.

5
Introduction
Data compression plays an essential role in computer science, allowing efficient
storage and transmission of information. Huffman encoding is a popular
technique that uses variable-length codes to represent characters based on their
frequency. This project explores the GPU-accelerated version of Huffman
encoding using CUDA. The goal is to speed up parts of the process, such as
frequency counting and parallel encoding, by leveraging the parallel processing
power of modern GPUs.

6
Problem Statement

Traditional Huffman encoding is inherently sequential and can be slow


on large datasets. With the increasing demand for high-speed
compression in big data and real-time systems, there is a need to
accelerate this process using parallel computing. The project aims to
implement Huffman encoding using CUDA to harness the power of the
GPU.

Motivation

In today’s digital age, data is generated at an enormous scale, and


efficient compression techniques have become essential for storage,
transmission, and processing. Huffman Encoding is a classical and
widely used lossless compression algorithm that has been the backbone
of compression systems for decades.
However, as the volume of data continues to grow exponentially,
traditional CPU-based Huffman encoding may become a performance
bottleneck, especially in real-time and large-scale applications. This
motivated us to explore the use of GPU parallel processing with CUDA
to accelerate the Huffman encoding algorithm.
The motivation behind this mini project is to combine classical
algorithms with modern parallel computing to make data compression
faster, smarter, and future-ready.

7
Objective

➢ Implement the Huffman Encoding algorithm using GPU (CUDA).

➢ Use GPU kernels to calculate the character frequency in parallel.

➢ Generate the Huffman Tree and binary codes on the CPU.

➢ Encode the input data using GPU-based parallel processing.

➢ Compare performance and output efficiency.

Theory

Huffman Encoding – Overview

Huffman Encoding is a lossless data compression algorithm developed


by David A. Huffman in 1952. It is based on the principle of assigning
shorter binary codes to frequently occurring characters and longer codes
to rarer characters. This helps reduce the total number of bits required to
represent the data.
The key property of Huffman codes is that they are prefix-free, meaning
no code is a prefix of another. This ensures that the encoded data can be
decoded unambiguously.

Steps in Huffman Encoding

1. Frequency Calculation
Count how often each character appears in the input data.
2. Build a Min-Heap (Priority Queue)
Each node in the heap represents a character and its frequency.
3. Construct the Huffman Tree
8
Repeatedly combine the two lowest-frequency nodes into a new internal
node. This forms a binary tree with frequencies as weights.

4. Assign Binary Codes


Traverse the tree to assign codes to each character:
• Left edge = 0
• Right edge = 1
5. Encode the Input
Replace every character in the input string with its binary code.

Why Use CUDA and GPU?

• Huffman encoding is traditionally implemented on the CPU. However,


certain parts of the process are compute-intensive and can be
parallelized, especially:
• Character frequency calculation: Each thread can count frequencies in a
chunk of the input.
• Parallel encoding: Each thread encodes one character using the
generated Huffman table.
• CUDA (Compute Unified Device Architecture) is a parallel computing
platform by NVIDIA that allows writing GPU programs using C/C++. It
provides thousands of threads to work simultaneously, which is ideal for
data-parallel operations like those in Huffman encoding.

Advantages of Huffman Encoding

• Simple and effective for text-based compression.


• Produces optimal prefix codes for known character frequencies.
• Widely used in formats like JPEG, MP3, PNG, and ZIP files.

9
OUTPUT

Fig: Code of Huffman encoding

Fig: Output of the given string/text

10
Conclusion

Huffman Encoding is a powerful algorithm for data compression. In this


project, we successfully implemented a hybrid CPU-GPU system for
encoding using Huffman’s method.
We offloaded frequency calculation and encoding to the GPU, which
makes it faster than traditional CPU-only methods, especially for large
inputs. The project proves that classical algorithms can benefit from
modern parallel processing platforms like CUDA.
This approach can be extended further by adding decoding on the GPU
or compressing actual files like .txt or .csv for practical use.

References

• GeeksforGeeks - Huffman Encoding


• Wikipedia - Huffman Coding
• CUDA Toolkit Documentation - NVIDIA
• Rivera, C., Di, S., Tian, J., Yu, X., Tao, D., & Cappello, F. (2022).
Optimizing Huffman Decoding for Error-Bounded Lossy Compression on
GPUs.

11

You might also like