Intel® Threading Building Blocks. Square sample

# Intel® Threading Building Blocks.
Square sample

Text filter that demonstrates the use of parallel_pipeline. Example program reads a file containing decimal integers in text format, and changes each to its square.

System Requirements

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

Files

square.cpp
  Source code for example.
gen_input.cpp
  Source code for sample input generation.
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.

Two additional targets for this example:

`make gen_input`
  Create an input generator program that prints out a sequence of integers.
`make input.txt`
  Create an input file for the example (with help of `gen_input`).

Usage

`square -h`
  Prints the help for command line options
`square [n-of-threads=value] [input-file=value] [output-file=value] [max-slice-size=value] [silent]`
`square [n-of-threads [input-file [output-file [max-slice-size]]]] [silent]`
  n-of-threads is the number of threads to use; a range of the form low[:high], where low and optional high are non-negative integers or 'auto' for a platform-specific default number.
  input-file is an input file name.
  output-file is an output file name.
  max-slice-size is the maximum number of characters in one slice.
  silent - no output except elapsed time.
`gen_input [LN] > inputfile`
  Generate a file named inputfile consisting of LN lines each containing one integer. If not specified, LN is assumed to be 1000000.
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).
  Prepare an inputfile with about 5,000 lines of text (see the instruction above).
  Run it with this inputfile and the desired number of threads, e.g., `square 4 inputfile outputfile`.

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.
© 2020, Intel Corporation