2 <html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
14 font-family: Arial, Helvetica, sans-serif;
25 background-color: #0071C5;
29 /* Apply to logo in banner. Add as class to image tag. */
41 /* Add as class to H1 in banner */
42 font-family: "Intel Clear", Verdana, Arial, sans-serif;
68 font-family: "Consolas", Monaco, monospace;
78 font-family: "Consolas", Monaco, monospace;
87 .changes input:active {
91 .changes input:hover:after {
96 .changes input:checked:hover:after {
99 .changes input + .show-hide {
102 .changes input:checked + .show-hide {
108 padding: 0.5em 0 0.5em 2.5em;
120 list-style-type:circle
127 /* ------------------------------------------------- */
131 border-collapse:collapse;
143 background-color:#0071C5;
149 vertical-align:middle;
152 border:1px #dddddd solid;
159 border:1px #dddddd solid;
230 border-collapse:collapse;
232 .specs td, .specs th {
236 border: 1px solid black;
238 .specs td td, .specs td th {
241 .specs td, .specs td td, .specs td th {
242 padding: 0 0.2em 0.2em;
245 .specs td tr:last-child td,
246 .specs td tr:last-child th {
266 <title>Intel® Threading Building Blocks. Square sample</title>
271 <img class="logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEMAAAAsCAYAAAA+aAX8AAAAAXNSR0IArs4c6QAAAARnQU1BAACx
272 jwv8YQUAAAAJcEhZcwAALiIAAC4iAari3ZIAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVh
273 ZHlxyWU8AAAIN0lEQVRoQ+WaCaxdUxSGW2ouatZWaVS15nkqkZhSVERQglLEPCam1BCixhqqCKUS
274 NIiYpxhqHmouIeaY5ylFzA/v1fev8+/j3N5737v3vtf3buNP/uy9/7X2Ovuse4a997m9mgltbW2L
275 wRHwcHgFfAx+AH+GCb/BT2fNmvUk5ZXwYOrrOsTcCU5CJ74pPBJeA5+Bn8LfOLmagf/f8Af4NrwD
276 ngg3wdTHh2pOMMB1Gejx8AE4M85mNqD/A7+D78GXkXQFTIMPwUfhdPg6/AxWTRw29b8QruPD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wCIUHB4H86227gKH1+JtL3gd1N5sCdACbgZo5rtgnQKx+hLs/ixsdjBXBd2TtyKNhUOp1/dprgMQ
305 rx9x16fcn1KbttrIyf9OkICWw1KApvY2YyXbpSBobKf7OGXApFtI+5d3Qq1BDoL6V87GcDVc9Ivq
306 E4D+bjTQbc1i9demreDu8Ch0ffG6hdnmDMrvFbsSsAXczIGk3fwb4VYe+pwBB9Angkd83ADtqgkq
307 AjetdTTV1icDlfl+Qi3AP4elHEjaDXscHgFjPdNt4ID6S9B9sNLiKoelmuFuJbCpDJi+hvqz2qFw
308 iIfWc2AQusxPgvq484vH2eUgtpYHH0Hteeqb75ZwMQ+j+cDg9PlwFDwd6o9sr0KtbWI/tSPgp32M
309 76H+s6mNX3030df5neGq1OtbZDUbOIlFoFaha0L9j0qfCHeAerDqVtODU8+hNThZfR1fHHbpG6kx
310 9Or1LzUmVVz+HJXDAAAAAElFTkSuQmCC">
311 <h1 class="title">Intel® Threading Building Blocks.<br>Square sample</h1>
315 Text filter that demonstrates the use of parallel_pipeline. Example program reads a file
316 containing decimal integers in text format, and changes each to its square.
319 <div class="changes">
320 <div class="h3-alike">System Requirements</div>
321 <input type="checkbox">
322 <div class="show-hide">
324 For the most up to date system requirements, see the <a href="http://software.intel.com/en-us/articles/intel-threading-building-blocks-release-notes">release notes.</a>
329 <div class="changes">
330 <div class="h3-alike">Files</div>
331 <input type="checkbox" checked="checked">
332 <div class="show-hide">
334 <dt><a href="square.cpp">square.cpp</a>
335 <dd>Source code for example.
336 <dt><a href="gen_input.cpp">gen_input.cpp </a>
337 <dd>Source code for sample input generation.
338 <dt><a href="Makefile">Makefile</a>
339 <dd>Makefile for building the example.
344 <div class="changes">
345 <div class="h3-alike">Directories</div>
346 <input type="checkbox" checked="checked">
347 <div class="show-hide">
349 <dt><a href="msvs/">msvs</a>
350 <dd>Contains Microsoft* Visual Studio* workspace for building and running the example (Windows* systems only).
351 <dt><a href="xcode/">xcode</a>
352 <dd>Contains Xcode* IDE workspace for building and running the example (macOS* systems only).
354 <p>For information about the minimum supported version of IDE, see <a href="http://software.intel.com/en-us/articles/intel-threading-building-blocks-release-notes">release notes.</a></p>
358 <div class="changes">
359 <div class="h3-alike">Build instructions</div>
360 <input type="checkbox" checked="checked">
361 <div class="show-hide">
362 <p>General build directions can be found <a href="../../index.html">here</a>.</p>
363 Two additional targets for this example:
365 <dt><tt>make gen_input</tt>
366 <dd>Create an input generator program that prints out a sequence of integers.
367 <dt><tt>make input.txt</tt>
368 <dd>Create an input file for the example (with help of <tt>gen_input</tt>).
373 <div class="changes">
374 <div class="h3-alike">Usage</div>
375 <input type="checkbox" checked="checked">
376 <div class="show-hide">
378 <dt><tt>square <i>-h</i></tt>
379 <dd>Prints the help for command line options
380 <dt><tt>square [<i>n-of-threads</i>=value] [<i>input-file</i>=value] [<i>output-file</i>=value] [<i>max-slice-size</i>=value] [<i>silent</i>]</tt>
381 <dt><tt>square [<i>n-of-threads</i> [<i>input-file</i> [<i>output-file</i> [<i>max-slice-size</i>]]]] [<i>silent</i>]</tt>
382 <dd><i>n-of-threads</i> is the number of threads to use; a range of the form <i>low</i>[:<i>high</i>], where low and optional high are non-negative integers or 'auto' for a platform-specific default number.<br>
383 <i>input-file</i> is an input file name.<br>
384 <i>output-file</i> is an output file name. <br>
385 <i>max-slice-size</i> is the maximum number of characters in one slice.<br>
386 <i>silent</i> - no output except elapsed time.<br>
387 <dt><tt>gen_input [<i>LN</i>] > <i>inputfile</i></tt>
388 <dd>Generate a file named <i>inputfile</i> consisting of <i>LN</i> lines each containing one integer.
389 If not specified, <i>LN</i> is assumed to be 1000000.
391 <dt>To run a short version of this example, e.g., for use with Intel® Parallel Inspector:
392 <dd>Build a <i>debug</i> version of the example
393 (see the <a href="../../index.html">build instructions</a>).
394 <br>Prepare an <i>inputfile</i> with about 5,000 lines of text (see the instruction above).
395 <br>Run it with this <i>inputfile</i> and the desired number of threads,
396 e.g., <tt>square 4 <i>inputfile</i> <i>outputfile</i></tt>.
402 <a href="../index.html">Up to parent directory</a>
404 <div class="changes">
405 <div class="h3-alike">Legal Information</div>
406 <input type="checkbox">
407 <div class="show-hide">
409 Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and/or other countries.
410 <br>* Other names and brands may be claimed as the property of others.
411 <br>© 2019, Intel Corporation