# Intel® Threading Building Blocks.
fgbzip2 sample

fgbzip2 is a parallel implementation of bzip2 block-sorting file compressor that uses tbb::flow. The output of this application is fully compatible with bzip2 v1.0.6 or newer.
This example includes software developed by Julian R Seward. See here for copyright information.
It exemplifies support for asynchronous capabilities in the flow graph API, in particular async_node and async_msg.
This example uses C++11 lambda expressions. Specifying a compiler option such as -std=c++11 or similar might be necessary in order to build the example. For more information please refer to the documentation for the compiler you use.

System Requirements

For the most up to date system requirements, see the release notes.

Files

fgbzip2.cpp
  Flow Graph implementation of bzip2 compressor.
blocksort.cpp
  Block sorting machinery of libbzip2.
bzlib.cpp
  libbzip2 top-level functions.
bzlib.h
  Public header file for the libbzip2.
bzlib_private.h
  Private header file for the libbzip2.
compress.cpp
  Compression machinery of libbzip2.
crctable.cpp
  libbzip2 table for doing CRCs.
decompress.cpp
  Decompression machinery of libbzip2.
huffman.cpp
  Huffman coding low-level stuff of libbzip2.
randtable.cpp
  libbzip2 table for randomising repetitive blocks.
Makefile
  Makefile for building the example.

Directories

msvs
  Contains Microsoft* Visual Studio* workspace for building and running the example (Windows* systems only).
xcode
  Contains Xcode* IDE workspace for building and running the example (macOS* systems only).

For information about the minimum supported version of IDE, see release notes.

Build instructions

General build directions can be found here.

Usage

`fgbzip2 -h`
  Prints the help for command line options
`fgbzip2 [-b=value] [-v] [-l=value] [-a=value] [filename]`
  -b block size in 100 KB chunks, [1 .. 9]
  -v print diagnostic output to screen
  -l used memory limit for compression algorithm with 1 MB (minimum) granularity
  -a name of the used graph async realization - can be async_node or async_msg
  filename name of the file to compress
To run a short version of this example, e.g., for use with Intel® Parallel Inspector:
  Build a debug version of the example (see the build instructions).
  Run it with a small problem size, e.g., `fgbzip2 -b=1 -a fgbzip2`.

Up to parent directory

Legal Information

Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and/or other countries.
* Other names and brands may be claimed as the property of others.
© 2019, Intel Corporation

The "libbzip2" sources for this example is Copyright (c) 1996-2010 Julian R Seward. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
4. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.