Malcolm Mashig (mjm2396)

Parallelizing Huffman Coding (ParHuff)

----------------------------------------------------

Please find all code in ParHuff.hs

Two test text files are provided:
- shakespeare.txt (large-scale test)
- test.txt (small-scale test)

Final report is provided (report.pdf)

Presentation slides are provided (presentation.pdf)
- NOTE: due to changes after presentation, figures/results are not updated.

Original proposal is provided (proposal.pdf)

----------------------------------------------------

To run test, enter the following commands:

stack --resolver lts-18.10 ghci
main

OR ...

stack ghc -- -threaded -rtsopts -eventlog ParHuff.hs
TIMEFORMAT="real %Rs"
time ./ParHuff +RTS -N4 -ls

(NOTE: adjust N4 to Nx to use x cores)

----------------------------------------------------

To update test parameters:

Edit the three params (lines 166-168) in ParHuff.hs
- parallel (whether or not to use parallelized approach)
- n_batches (if parallel, how many batches to encode + decode in parallel)
- filepath ("shakespeare.txt" or "test.txt" or another txt file to encode + decode)

----------------------------------------------------

Program Outputs:
- test-ParHuff.txt (intermediate encoded file)
- "Compression was lossless" will be printed if the decoded string matches the original file
- Error will occur if compression was not lossless
- Compression percentage (# of bits in encoding / # of bits for original file * 100) is also printed
