| 1 |
Dec 18, 2015 |
| 2 |
|
| 3 |
Parallel BZIP2 v1.1.13 - by: Jeff Gilchrist <[email protected]> |
| 4 |
Available at: http://compression.ca/ |
| 5 |
|
| 6 |
This is the README for pbzip2, a parallel implementation of the |
| 7 |
bzip2 block-sorting file compressor. The output of this version |
| 8 |
should be fully compatible with bzip2 v1.0.2 or newer (ie: anything |
| 9 |
compressed with pbzip2 can be decompressed with bzip2). |
| 10 |
|
| 11 |
pbzip2 is distributed under a BSD-style license. For details, |
| 12 |
see the file COPYING. |
| 13 |
|
| 14 |
|
| 15 |
1. HOW TO BUILD -- UNIX |
| 16 |
|
| 17 |
Type `make'. This builds the pbzip2 program and dynamically |
| 18 |
links to the libbzip2 library. You should ensure that you have |
| 19 |
at least libbzip2 1.0.5 or newer installed as it contains some |
| 20 |
important security bug fixes. |
| 21 |
|
| 22 |
If you do not have libbzip2 installed on your system, you should |
| 23 |
first go to http://www.bzip.org/ and install it. |
| 24 |
|
| 25 |
Debian users need the package "libbz2-dev". If you want to |
| 26 |
install a pre-built package on Debian, run the following command: |
| 27 |
'apt-get update; apt-get install pbzip2' |
| 28 |
|
| 29 |
If you would like to build pbzip2 with a statically linked |
| 30 |
libbzip2 library, download the bzip2 source from the above site, |
| 31 |
compile it, and copy the libbz2.a and bzlib.h files into the |
| 32 |
pbzip2 source directory. Then type `make pbzip2-static'. |
| 33 |
|
| 34 |
Note: This software has been tested on Linux (Intel, Alpha), |
| 35 |
Solaris (Sparc), HP-UX, Irix (SGI), and Tru64/OSF1 (Alpha). |
| 36 |
|
| 37 |
|
| 38 |
2. HOW TO BUILD -- Windows |
| 39 |
|
| 40 |
On Windows, pbzip2 can be compiled using Cygwin. |
| 41 |
|
| 42 |
If you do not have libbzip2 installed on your system, you should |
| 43 |
first go to http://www.bzip.org/ and install it. |
| 44 |
|
| 45 |
Cygwin can be found at: http://www.cygwin.com/ |
| 46 |
From a Cygwin shell, go to the directory where the pbzip2 source |
| 47 |
files are located and type `make'. This builds the pbzip2 |
| 48 |
program and dynamically links to the libbzip2 library. |
| 49 |
|
| 50 |
If you would like to build pbzip2 with a statically linked |
| 51 |
libbzip2 library, download the bzip2 source from the above site, |
| 52 |
compile it, and copy the libbz2.a file into the pbzip2 source |
| 53 |
directory. Then type `make pbzip2-static'. |
| 54 |
|
| 55 |
|
| 56 |
3. DISCLAIMER |
| 57 |
|
| 58 |
I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE |
| 59 |
USE OF THIS PROGRAM, HOWSOEVER CAUSED. |
| 60 |
|
| 61 |
DO NOT COMPRESS ANY DATA WITH THIS PROGRAM UNLESS YOU ARE |
| 62 |
PREPARED TO ACCEPT THE POSSIBILITY, HOWEVER SMALL, THAT THE |
| 63 |
DATA WILL NOT BE RECOVERABLE. |
| 64 |
|
| 65 |
* Portions of this README were copied directly from the bzip2 README |
| 66 |
written by Julian Seward. |
| 67 |
|
| 68 |
|
| 69 |
4. PBZIP2 DATA FORMAT |
| 70 |
|
| 71 |
You should be able to compress files larger than 4GB with pbzip2. |
| 72 |
|
| 73 |
Files that are compressed with pbzip2 are broken up into pieces and |
| 74 |
each individual piece is compressed. This is how pbzip2 runs faster |
| 75 |
on multiple CPUs since the pieces can be compressed simultaneously. |
| 76 |
The final .bz2 file may be slightly larger than if it was compressed |
| 77 |
with the regular bzip2 program due to this file splitting (usually |
| 78 |
less than 0.2% larger). Files that are compressed with pbzip2 will |
| 79 |
also gain considerable speedup when decompressed using pbzip2. |
| 80 |
|
| 81 |
Files that were compressed using bzip2 will not see speedup since |
| 82 |
bzip2 pacakages the data into a single chunk that cannot be split |
| 83 |
between processors. pbzip2 will still be able to decompress these |
| 84 |
files, but it will be slower than if the .bz2 file was created |
| 85 |
with pbzip2. |
| 86 |
|
| 87 |
A file compressed with bzip2 will contain one compressed stream of |
| 88 |
data that looks like this: |
| 89 |
[-----------------------------------------------------] |
| 90 |
|
| 91 |
Data compressed with pbzip2 is broken into multiple streams and each |
| 92 |
stream is bzip2 compressed looking like this: |
| 93 |
[-----|-----|-----|-----|-----|-----|-----|-----|-----] |
| 94 |
|
| 95 |
If you are writing software with libbzip2 to decompress data created |
| 96 |
with pbzip2, you must take into account that the data contains multiple |
| 97 |
bzip2 streams so you will encounter end-of-stream markers from libbzip2 |
| 98 |
after each stream and must look-ahead to see if there are any more |
| 99 |
streams to process before quitting. The bzip2 program itself will |
| 100 |
automatically handle this condition. |
| 101 |
|
| 102 |
|
| 103 |
5. USAGE |
| 104 |
|
| 105 |
The pbzip2 program is a parallel version of bzip2 for use on shared |
| 106 |
memory machines. It provides near-linear speedup when used on true |
| 107 |
multi-processor machines and 5-10% speedup on Hyperthreaded machines. |
| 108 |
The output is fully compatible with the regular bzip2 data so any |
| 109 |
files created with pbzip2 can be uncompressed by bzip2 and vice-versa. |
| 110 |
The default settings for pbzip2 will work well in most cases. The |
| 111 |
only switch you will likely need to use is -d to decompress files and |
| 112 |
-p to set the # of processors for pbzip2 to use if autodetect is not |
| 113 |
supported on your system, or you want to use a specific # of CPUs. |
| 114 |
Note, that if you are using a large number of CPUs you may wish to |
| 115 |
lower your default stack size setting (with the -S switch or ulimit) |
| 116 |
to reduce the amount of memory each thread uses. |
| 117 |
|
| 118 |
Usage: pbzip2 [-1 .. -9] [-b#cdfhklm#p#qrS#tvVz] <filename> <filename2> <filenameN> |
| 119 |
|
| 120 |
Switches: |
| 121 |
-b# Where # is block size in 100k steps (default 9 = 900k) |
| 122 |
-c, --stdout Output to standard out (stdout) |
| 123 |
-d,--decompress Decompress file |
| 124 |
-f,--force Force, overwrite existing output file |
| 125 |
-h,--help Print this help message |
| 126 |
-k,--keep Keep input file, do not delete |
| 127 |
-l,--loadavg Load average determines max number processors to use |
| 128 |
-m# Where # is max memory usage in 1MB steps (default 100 = 100MB) |
| 129 |
-p# Where # is the number of processors (default: autodetect) |
| 130 |
-q,--quiet Quiet mode (default) |
| 131 |
-r,--read Read entire input file into RAM and split between processors |
| 132 |
-S# Child thread stack size in 1KB steps (default stack size if unspecified) |
| 133 |
-t,--test Test compressed file integrity |
| 134 |
-v,--verbose Verbose mode |
| 135 |
-V Display version info for pbzip2 then exit |
| 136 |
-z,--compress Compress file (default) |
| 137 |
-1,--fast ... -9,--best Set BWT block size to 100k .. 900k (default 900k). |
| 138 |
--ignore-trailing-garbage=# Ignore trailing garbage flag (1 - ignored; 0 - forbidden) |
| 139 |
|
| 140 |
|
| 141 |
Example: pbzip2 myfile.tar |
| 142 |
|
| 143 |
This example will compress the file "myfile.tar" into the compressed |
| 144 |
file "myfile.tar.bz2". It will use the autodetected # of processors |
| 145 |
(or 2 processors if autodetect not supported) with the default file |
| 146 |
block size of 900k and default BWT block size of 900k. |
| 147 |
|
| 148 |
|
| 149 |
Example: pbzip2 -b15vk myfile.tar |
| 150 |
|
| 151 |
This example will compress the file "myfile.tar" into the compressed |
| 152 |
file "myfile.tar.bz2". It will use the autodetected # of processors |
| 153 |
(or 2 processors if autodetect not supported) with a file block |
| 154 |
size of 1500k and a BWT block size of 900k. Verbose mode will be |
| 155 |
enabled so progress and other messages will be output to the display |
| 156 |
and the file myfile.tar will not be deleted after compression is |
| 157 |
finished. |
| 158 |
|
| 159 |
|
| 160 |
Example: pbzip2 -p4 -r -5 myfile.tar second*.txt |
| 161 |
|
| 162 |
This example will compress the file "myfile.tar" into the compressed |
| 163 |
file "myfile.tar.bz2". It will use 4 processors with a BWT block |
| 164 |
size of 500k. The file block size will be the size of "myfile.tar" |
| 165 |
divided by 4 (# of processors) so that the data will be split |
| 166 |
evenly among each processor. This requires you have enough RAM for |
| 167 |
pbzip2 to read the entire file into memory for compression. pbzip2 |
| 168 |
will then use the same options to compress all other files that |
| 169 |
match the wildcard "second*.txt" in that directory. |
| 170 |
|
| 171 |
|
| 172 |
Example: pbzip2 -l myfile.tar |
| 173 |
|
| 174 |
This example will compress the file "myfile.tar" into the compressed |
| 175 |
file "myfile.tar.bz2". It will use the autodetected # of processors |
| 176 |
(or 2 processors if autodetect not supported) if the 1 minute load |
| 177 |
average is less than 0.5, otherwise it will select the maximum # of |
| 178 |
processors so that only idle processors are used for pbzip2. If the |
| 179 |
system has 4 processors and the load average is 2.00, then pbzip2 |
| 180 |
will use 2 processors to compress the data. |
| 181 |
|
| 182 |
|
| 183 |
Example: tar cf myfile.tar.bz2 --use-compress-prog=pbzip2 dir_to_compress/ |
| 184 |
Example: tar -c directory_to_compress/ | pbzip2 -c > myfile.tar.bz2 |
| 185 |
|
| 186 |
These examples will compress the data being given to pbzip2 via pipe |
| 187 |
from TAR into the compressed file "myfile.tar.bz2". It will use the |
| 188 |
autodetected # of processors (or 2 processors if autodetect not |
| 189 |
supported) with the default file block size of 900k and default BWT |
| 190 |
block size of 900k. TAR is collecting all of the files from the |
| 191 |
"directory_to_compress/" directory and passing the data to pbzip2 as |
| 192 |
it works. |
| 193 |
|
| 194 |
|
| 195 |
Example: pbzip2 -d -m500 myfile.tar.bz2 |
| 196 |
|
| 197 |
This example will decompress the file "myfile.tar.bz2" into the |
| 198 |
decompressed file "myfile.tar". It will use the autodetected # of |
| 199 |
processors (or 2 processors if autodetect not supported). It will use |
| 200 |
a maximum of 500MB of memory for decompression. |
| 201 |
The switches -b, -r, -t, and -1..-9 are not valid for decompression. |