Disabled external gits

This commit is contained in:
2022-04-07 18:46:57 +02:00
parent 88cb3426ad
commit 15e7120d6d
5316 changed files with 4563444 additions and 6 deletions

View File

@@ -0,0 +1,48 @@
# Copyright (c) 2005-2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Common Makefile that builds and runs example.
# Just specify your program basename
PROG=Tree_sum
ARGS=
PERF_RUN_ARGS=auto 100000000 silent
# Trying to find if icl.exe is set
CXX1 = $(TBB_CXX)-
CXX2 = $(CXX1:icl.exe-=icl.exe)
CXX = $(CXX2:-=cl.exe)
# The C++ compiler options
MYCXXFLAGS = /TP /EHsc /W3 /nologo /D _CONSOLE /D _MBCS /D WIN32 $(CXXFLAGS)
MYLDFLAGS =/INCREMENTAL:NO /NOLOGO /DEBUG /FIXED:NO $(LDFLAGS)
all: release test
release: compiler_check
$(CXX) *.cpp /MD /O2 /D NDEBUG $(MYCXXFLAGS) /link tbbmalloc.lib tbb.lib $(LIBS) $(MYLDFLAGS) /OUT:$(PROG).exe
debug: compiler_check
$(CXX) *.cpp /MDd /Od /Zi /D TBB_USE_DEBUG /D _DEBUG $(MYCXXFLAGS) /link tbbmalloc_debug.lib tbb_debug.lib $(LIBS) $(MYLDFLAGS) /OUT:$(PROG).exe
clean:
@cmd.exe /C del $(PROG).exe *.obj *.?db *.manifest
test:
$(PROG) $(ARGS)
$(PROG) stdmalloc $(ARGS)
perf_build: release
perf_run:
$(PROG) $(PERF_RUN_ARGS)
compiler_check:
@echo compiler_test>compiler_test && @$(CXX) /E compiler_test >nul 2>&1 || echo "$(CXX) command not found. Check if CXX=$(CXX) is set properly"
@cmd.exe /C del compiler_test

View File

@@ -0,0 +1,65 @@
/*
Copyright (c) 2005-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "common.h"
#include "tbb/task.h"
class OptimizedSumTask: public tbb::task {
Value* const sum;
TreeNode* root;
bool is_continuation;
Value x, y;
public:
OptimizedSumTask( TreeNode* root_, Value* sum_ ) : root(root_), sum(sum_), is_continuation(false) {
}
tbb::task* execute() /*override*/ {
tbb::task* next = NULL;
if( !is_continuation ) {
if( root->node_count<1000 ) {
*sum = SerialSumTree(root);
} else {
// Create tasks before spawning any of them.
tbb::task* a = NULL;
tbb::task* b = NULL;
if( root->left )
a = new( allocate_child() ) OptimizedSumTask(root->left,&x);
if( root->right )
b = new( allocate_child() ) OptimizedSumTask(root->right,&y);
recycle_as_continuation();
is_continuation = true;
set_ref_count( (a!=NULL)+(b!=NULL) );
if( a ) {
if( b ) spawn(*b);
} else
a = b;
next = a;
}
} else {
*sum = root->value;
if( root->left ) *sum += x;
if( root->right ) *sum += y;
}
return next;
}
};
Value OptimizedParallelSumTree( TreeNode* root ) {
Value sum;
OptimizedSumTask& a = *new(tbb::task::allocate_root()) OptimizedSumTask(root,&sum);
tbb::task::spawn_root_and_wait(a);
return sum;
}

View File

@@ -0,0 +1,26 @@
/*
Copyright (c) 2005-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "common.h"
Value SerialSumTree( TreeNode* root ) {
Value result = root->value;
if( root->left )
result += SerialSumTree(root->left);
if( root->right )
result += SerialSumTree(root->right);
return result;
}

View File

@@ -0,0 +1,58 @@
/*
Copyright (c) 2005-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "common.h"
#include "tbb/task.h"
class SimpleSumTask: public tbb::task {
Value* const sum;
TreeNode* root;
public:
SimpleSumTask( TreeNode* root_, Value* sum_ ) : root(root_), sum(sum_) {}
task* execute() /*override*/ {
if( root->node_count<1000 ) {
*sum = SerialSumTree(root);
} else {
Value x, y;
int count = 1;
tbb::task_list list;
if( root->left ) {
++count;
list.push_back( *new( allocate_child() ) SimpleSumTask(root->left,&x) );
}
if( root->right ) {
++count;
list.push_back( *new( allocate_child() ) SimpleSumTask(root->right,&y) );
}
// Argument to set_ref_count is one more than size of the list,
// because spawn_and_wait_for_all expects an augmented ref_count.
set_ref_count(count);
spawn_and_wait_for_all(list);
*sum = root->value;
if( root->left ) *sum += x;
if( root->right ) *sum += y;
}
return NULL;
}
};
Value SimpleParallelSumTree( TreeNode* root ) {
Value sum;
SimpleSumTask& a = *new(tbb::task::allocate_root()) SimpleSumTask(root,&sum);
tbb::task::spawn_root_and_wait(a);
return sum;
}

View File

@@ -0,0 +1,112 @@
/*
Copyright (c) 2005-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef TREE_MAKER_H_
#define TREE_MAKER_H_
#include "tbb/tick_count.h"
#include "tbb/task.h"
static double Pi = 3.14159265358979;
const bool tbbmalloc = true;
const bool stdmalloc = false;
template<bool use_tbbmalloc>
class TreeMaker {
class SubTreeCreationTask: public tbb::task {
TreeNode*& my_root;
bool is_continuation;
typedef TreeMaker<use_tbbmalloc> MyTreeMaker;
public:
SubTreeCreationTask( TreeNode*& root, long number_of_nodes ) : my_root(root), is_continuation(false) {
my_root = MyTreeMaker::allocate_node();
my_root->node_count = number_of_nodes;
my_root->value = Value(Pi*number_of_nodes);
}
tbb::task* execute() /*override*/ {
tbb::task* next = NULL;
if( !is_continuation ) {
long subtree_size = my_root->node_count - 1;
if( subtree_size<1000 ) { /* grainsize */
my_root->left = MyTreeMaker::do_in_one_thread(subtree_size/2);
my_root->right = MyTreeMaker::do_in_one_thread(subtree_size - subtree_size/2);
} else {
// Create tasks before spawning any of them.
tbb::task* a = new( allocate_child() ) SubTreeCreationTask(my_root->left,subtree_size/2);
tbb::task* b = new( allocate_child() ) SubTreeCreationTask(my_root->right,subtree_size - subtree_size/2);
recycle_as_continuation();
is_continuation = true;
set_ref_count(2);
spawn(*b);
next = a;
}
}
return next;
}
};
public:
static TreeNode* allocate_node() {
return use_tbbmalloc? tbb::scalable_allocator<TreeNode>().allocate(1) : new TreeNode;
}
static TreeNode* do_in_one_thread( long number_of_nodes ) {
if( number_of_nodes==0 ) {
return NULL;
} else {
TreeNode* n = allocate_node();
n->node_count = number_of_nodes;
n->value = Value(Pi*number_of_nodes);
--number_of_nodes;
n->left = do_in_one_thread( number_of_nodes/2 );
n->right = do_in_one_thread( number_of_nodes - number_of_nodes/2 );
return n;
}
}
static TreeNode* do_in_parallel( long number_of_nodes ) {
TreeNode* root_node;
SubTreeCreationTask& a = *new(tbb::task::allocate_root()) SubTreeCreationTask(root_node, number_of_nodes);
tbb::task::spawn_root_and_wait(a);
return root_node;
}
static TreeNode* create_and_time( long number_of_nodes, bool silent=false ) {
tbb::tick_count t0, t1;
TreeNode* root = allocate_node();
root->node_count = number_of_nodes;
root->value = Value(Pi*number_of_nodes);
--number_of_nodes;
t0 = tbb::tick_count::now();
root->left = do_in_one_thread( number_of_nodes/2 );
t1 = tbb::tick_count::now();
if ( !silent ) printf ("%24s: time = %.1f msec\n", "half created serially", (t1-t0).seconds()*1000);
t0 = tbb::tick_count::now();
root->right = do_in_parallel( number_of_nodes - number_of_nodes/2 );
t1 = tbb::tick_count::now();
if ( !silent ) printf ("%24s: time = %.1f msec\n", "half done in parallel", (t1-t0).seconds()*1000);
return root;
}
};
#endif // TREE_MAKER_H_

View File

@@ -0,0 +1,32 @@
/*
Copyright (c) 2005-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
typedef float Value;
struct TreeNode {
//! Pointer to left subtree
TreeNode* left;
//! Pointer to right subtree
TreeNode* right;
//! Number of nodes in this subtree, including this node.
long node_count;
//! Value associated with the node.
Value value;
};
Value SerialSumTree( TreeNode* root );
Value SimpleParallelSumTree( TreeNode* root );
Value OptimizedParallelSumTree( TreeNode* root );

View File

@@ -0,0 +1,105 @@
/*
Copyright (c) 2005-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "common.h"
#include <cstdlib>
#include <cstdio>
#include <cstring>
// The performance of this example can be significantly better when
// the objects are allocated by the scalable_allocator instead of the
// default "operator new". The reason is that the scalable_allocator
// typically packs small objects more tightly than the default "operator new",
// resulting in a smaller memory footprint, and thus more efficient use of
// cache and virtual memory. Also the scalable_allocator works faster for
// multi-threaded allocations.
//
// Pass stdmalloc as the 1st command line parameter to use the default "operator new"
// and see the performance difference.
#include "tbb/scalable_allocator.h"
#include "tbb/global_control.h"
#include "TreeMaker.h"
#include "tbb/tick_count.h"
#include "../../common/utility/utility.h"
#include "../../common/utility/get_default_num_threads.h"
using namespace std;
void Run( const char* which, Value(*SumTree)(TreeNode*), TreeNode* root, bool silent) {
tbb::tick_count t0;
if ( !silent ) t0 = tbb::tick_count::now();
Value result = SumTree(root);
if ( !silent ) printf ("%24s: time = %.1f msec, sum=%g\n", which, (tbb::tick_count::now()-t0).seconds()*1000, result);
}
int main( int argc, const char *argv[] ) {
try{
tbb::tick_count mainStartTime = tbb::tick_count::now();
// The 1st argument is the function to obtain 'auto' value; the 2nd is the default value
// The example interprets 0 threads as "run serially, then fully subscribed"
utility::thread_number_range threads( utility::get_default_num_threads, 0 );
long number_of_nodes = 10000000;
bool silent = false;
bool use_stdmalloc = false;
utility::parse_cli_arguments(argc,argv,
utility::cli_argument_pack()
//"-h" option for displaying help is present implicitly
.positional_arg(threads,"n-of-threads",utility::thread_number_range_desc)
.positional_arg(number_of_nodes,"number-of-nodes","the number of nodes")
.arg(silent,"silent","no output except elapsed time")
.arg(use_stdmalloc,"stdmalloc","use standard allocator")
);
TreeNode* root;
{ // In this scope, TBB will use default number of threads for tree creation
tbb::global_control c(tbb::global_control::max_allowed_parallelism, utility::get_default_num_threads());
if( use_stdmalloc ) {
if ( !silent ) printf("Tree creation using standard operator new\n");
root = TreeMaker<stdmalloc>::create_and_time( number_of_nodes, silent );
} else {
if ( !silent ) printf("Tree creation using TBB scalable allocator\n");
root = TreeMaker<tbbmalloc>::create_and_time( number_of_nodes, silent );
}
}
// Warm up caches
SerialSumTree(root);
if ( !silent ) printf("Calculations:\n");
if ( threads.first ) {
for(int p = threads.first; p <= threads.last; p = threads.step(p) ) {
if ( !silent ) printf("threads = %d\n", p );
tbb::global_control c(tbb::global_control::max_allowed_parallelism, p);
Run ( "SimpleParallelSumTree", SimpleParallelSumTree, root, silent );
Run ( "OptimizedParallelSumTree", OptimizedParallelSumTree, root, silent );
}
} else { // Number of threads wasn't set explicitly. Run serial and two parallel versions
Run ( "SerialSumTree", SerialSumTree, root, silent );
tbb::global_control c(tbb::global_control::max_allowed_parallelism, utility::get_default_num_threads());
Run ( "SimpleParallelSumTree", SimpleParallelSumTree, root, silent );
Run ( "OptimizedParallelSumTree", OptimizedParallelSumTree, root, silent );
}
utility::report_elapsed_time((tbb::tick_count::now() - mainStartTime).seconds());
return 0;
}catch(std::exception& e){
std::cerr<<"error occurred. error text is :\"" <<e.what()<<"\"\n";
return 1;
}
}

View File

@@ -0,0 +1,423 @@
<!DOCTYPE html>
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<head>
<meta charset="UTF-8">
<style>
::selection {
background: #b7ffb7;
}
::-moz-selection {
background: #b7ffb7;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
width: 800px;
margin: 0 auto;
}
#banner {
/* Div for banner */
float:left;
margin: 0px;
margin-bottom: 10px;
width: 100%;
background-color: #0071C5;
z-index: 0;
}
#banner .logo {
/* Apply to logo in banner. Add as class to image tag. */
float: left;
margin-right: 20px;
margin-left: 20px;
margin-top: 15px;
padding-bottom: 5px;
}
h1 {
text-align: center;
font-size: 36px;
}
h1.title {
/* Add as class to H1 in banner */
font-family: "Intel Clear", Verdana, Arial, sans-serif;
font-weight:normal;
color: #FFFFFF;
font-size: 170%;
margin-right: 40px;
margin-left: 40px;
padding-right: 20px;
text-indent: 20px;
}
.h3-alike {
display:inline;
font-size: 1.17em;
font-weight: bold;
color: #0071C5;
}
h3 {
font-size: 1.17em;
font-weight: bold;
color: #0071C5;
}
.h4-alike {
display:inline;
font-size: 1.05em;
font-weight: bold;
}
pre {
font-family: "Consolas", Monaco, monospace;
font-size:small;
background: #fafafa;
margin: 0;
padding-left:20px;
}
#footer {
font-size: small;
}
code {
font-family: "Consolas", Monaco, monospace;
}
.code-block
{
padding-left:20px;
}
.changes {
margin: 1em 0;
}
.changes input:active {
position: relative;
top: 1px;
}
.changes input:hover:after {
padding-left: 16px;
font-size: 10px;
content: 'More';
}
.changes input:checked:hover:after {
content: 'Less';
}
.changes input + .show-hide {
display: none;
}
.changes input:checked + .show-hide {
display: block;
}
ul {
margin: 0;
padding: 0.5em 0 0.5em 2.5em;
}
ul li {
margin-bottom: 3px;
}
ul li:last-child {
margin-bottom: 0;
}
.disc {
list-style-type:disc
}
.circ {
list-style-type:circle
}
.single {
padding: 0 0.5em;
}
/* ------------------------------------------------- */
/* Table styles */
table{
margin-bottom:5pt;
border-collapse:collapse;
margin-left:0px;
margin-top:0.3em;
font-size:10pt;
}
tr{
vertical-align:top;
}
th,
th h3{
padding:4px;
text-align:left;
background-color:#0071C5;
font-weight:bold;
margin-top:1px;
margin-bottom:0;
color:#FFFFFF;
font-size:10pt;
vertical-align:middle;
}
th{
border:1px #dddddd solid;
padding-top:2px;
padding-bottom:0px;
padding-right:3px;
padding-left:3px;
}
td{
border:1px #dddddd solid;
vertical-align:top;
font-size:100%;
text-align:left;
margin-bottom:0;
}
td,
td p{
margin-top:0;
margin-left:0;
text-align:left;
font-size:inherit;
line-height:120%;
}
td p{
margin-bottom:0;
padding-top:5px;
padding-bottom:5px;
padding-right:5px;
padding-left:1px;
}
.noborder{
border:0px none;
}
.noborder1stcol{
border:0px none;
padding-left:0pt;
}
td ol{
font-size:inherit;
margin-left:28px;
}
td ul{
font-size:inherit;
margin-left:24px;
}
.DefListTbl{
width:90%;
margin-left:-3pt;
}
.syntaxdiagramtbl{
margin-left:-3pt;
}
.sdtbl{
}
.sdrow{
}
.sdtblp{
border:0px none;
font-size:inherit;
line-height:120%;
margin-bottom:0;
padding-bottom:0px;
padding-top:5px;
padding-left:0px;
padding-right:5px;
vertical-align:top;
}
.idepara, .ide_para{
border:0px none;
font-size:inherit;
line-height:120%;
margin-bottom:0;
padding-bottom:0px;
padding-top:5px;
padding-left:0px;
padding-right:5px;
vertical-align:top;
}
.specs {
border-collapse:collapse;
}
.specs td, .specs th {
font-size: 14px;
}
.specs td {
border: 1px solid black;
}
.specs td td, .specs td th {
border: none;
}
.specs td, .specs td td, .specs td th {
padding: 0 0.2em 0.2em;
text-align: center;
}
.specs td tr:last-child td,
.specs td tr:last-child th {
padding: 0 0.2em;
}
.serial-time {
}
.modified-time {
width: 6.5em;
}
.compiler {
}
.comp-opt {
}
.sys-specs {
width: 18em;
}
.note {
font-size:small;
font-style: italic;
}
</style>
<title>Intel&reg; Threading Building Blocks. Tree_sum sample</title>
</head>
<body>
<div id="banner">
<img class="logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEMAAAAsCAYAAAA+aAX8AAAAAXNSR0IArs4c6QAAAARnQU1BAACx
jwv8YQUAAAAJcEhZcwAALiIAAC4iAari3ZIAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVh
ZHlxyWU8AAAIN0lEQVRoQ+WaCaxdUxSGW2ouatZWaVS15nkqkZhSVERQglLEPCam1BCixhqqCKUS
NIiYpxhqHmouIeaY5ylFzA/v1fev8+/j3N5737v3vtf3buNP/uy9/7X2Ovuse4a997m9mgltbW2L
wRHwcHgFfAx+AH+GCb/BT2fNmvUk5ZXwYOrrOsTcCU5CJ74pPBJeA5+Bn8LfOLmagf/f8Af4NrwD
ngg3wdTHh2pOMMB1Gejx8AE4M85mNqD/A7+D78GXkXQFTIMPwUfhdPg6/AxWTRw29b8QruPD9zwY
zPrwHPi2xxmg3QrfgDfD05BGU24EB1HvC3s7REXgtwDsDzeEY+Ak+AJsUfwE2sJdcBN37V4whiU4
+KGUM2JEBtpzUInZEa5g9y4FcYfAo+GLPmwOND2HFrXrnAUHWgnq0vzDB2+Bt0H9coPs1m3gmNvD
ZyITBu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q
AjetdTTV1icDlfl+Qi3AP4elHEjaDXscHgFjPdNt4ID6S9B9sNLiKoelmuFuJbCpDJi+hvqz2qFw
iIfWc2AQusxPgvq484vH2eUgtpYHH0Hteeqb75ZwMQ+j+cDg9PlwFDwd6o9sr0KtbWI/tSPgp32M
76H+s6mNX3030df5neGq1OtbZDUbOIlFoFaha0L9j0qfCHeAerDqVtODU8+hNThZfR1fHHbpG6kx
9Or1LzUmVVz+HJXDAAAAAElFTkSuQmCC">
<h1 class="title">Intel&reg; Threading Building Blocks.<br>Tree_sum sample</h1>
</div>
<p>
This directory contains a simple example that sums values in a tree.
<br><br>
The example exhibits some speedup, but not a lot, because it quickly saturates
the system bus on a multiprocessor. For good speedup, there needs to be
more computation cycles per memory reference. The point of the example
is to teach how to use the raw task interface, so the computation is
deliberately trivial.
<br><br>
The performance of this example is better when objects are allocated
by the scalable_allocator instead of
the default "operator new". The reason is that the scalable_allocator typically
packs small objects more tightly than the default "operator new", resulting in
a smaller memory footprint, and thus more efficient use of cache and virtual memory.
In addition, the scalable_allocator performs better for multi-threaded allocations.
</p>
<div class="changes">
<div class="h3-alike">System Requirements</div>
<input type="checkbox">
<div class="show-hide">
<p>
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>
</p>
</div>
</div>
<div class="changes">
<div class="h3-alike">Files</div>
<input type="checkbox" checked="checked">
<div class="show-hide">
<dl>
<dt><a href="SerialSumTree.cpp">SerialSumTree.cpp</a>
<dd>Sums sequentially.
<dt><a href="SimpleParallelSumTree.cpp">SimpleParallelSumTree.cpp</a><dt>
<dd>Sums in parallel without any fancy tricks.
<dt><a href="OptimizedParallelSumTree.cpp">OptimizedParallelSumTree.cpp</a><dt>
<dd>Sums in parallel, using "recycling" and "continuation-passing" tricks.
In this case, it is only slightly faster than the simple version.
<dt><a href="common.h">common.h</a>
<dd>Shared declarations.
<dt><a href="main.cpp">main.cpp</a>
<dd>Main program which parses command line options and runs the algorithm.
<dt><a href="Makefile">Makefile</a>
<dd>Makefile for building the example.
</dl>
</div>
</div>
<div class="changes">
<div class="h3-alike">Directories</div>
<input type="checkbox" checked="checked">
<div class="show-hide">
<dl>
<dt><a href="msvs/">msvs</a>
<dd>Contains Microsoft* Visual Studio* workspace for building and running the example (Windows* systems only).
<dt><a href="xcode/">xcode</a>
<dd>Contains Xcode* IDE workspace for building and running the example (macOS* systems only).
</dl>
<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>
</div>
</div>
<div class="changes">
<div class="h3-alike">Build instructions</div>
<input type="checkbox" checked="checked">
<div class="show-hide">
<p>General build directions can be found <a href="../../index.html">here</a>.</p>
</div>
</div>
<div class="changes">
<div class="h3-alike">Usage</div>
<input type="checkbox" checked="checked">
<div class="show-hide">
<dl>
<dt><tt>tree_sum <i>-h</i></tt>
<dd>Prints the help for command line options
<dt><tt>tree_sum [<i>n-of-threads</i>=value] [<i>number-of-nodes</i>=value] [<i>silent</i>] [<i>stdmalloc</i>]</tt>
<dt><tt>tree_sum [<i>n-of-threads</i> [<i>number-of-nodes</i>]] [<i>silent</i>] [<i>stdmalloc</i>]</tt>
<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 the default.<br>
<i>number-of-nodes</i> is the number of nodes in the tree.<br>
<i>silent</i> - no output except elapsed time.<br>
<i>stdmalloc</i> - causes the default "operator new" to be used for memory allocations instead of the scalable_allocator.<br>
<dt>To run a short version of this example, e.g., for use with Intel&reg; Parallel Inspector:
<dd>Build a <i>debug</i> version of the example
(see the <a href="../../index.html">build instructions</a>).
<br>Run it with a small problem size and the desired number of threads, e.g., <tt>tree_sum&nbsp;4&nbsp;100000</tt>.
</dl>
</div>
</div>
<br>
<a href="../index.html">Up to parent directory</a>
<hr>
<div class="changes">
<div class="h3-alike">Legal Information</div>
<input type="checkbox">
<div class="show-hide">
<p>
Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and/or other countries.
<br>* Other names and brands may be claimed as the property of others.
<br>&copy; 2020, Intel Corporation
</p>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,278 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
05593A110B8F4F4500DE73AB /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 05593A0C0B8F4F4500DE73AB /* main.cpp */; };
05593A120B8F4F4500DE73AB /* OptimizedParallelSumTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 05593A0D0B8F4F4500DE73AB /* OptimizedParallelSumTree.cpp */; };
05593A130B8F4F4500DE73AB /* SerialSumTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 05593A0E0B8F4F4500DE73AB /* SerialSumTree.cpp */; };
05593A140B8F4F4500DE73AB /* SimpleParallelSumTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 05593A0F0B8F4F4500DE73AB /* SimpleParallelSumTree.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXBuildRule section */
C3C5895D218B6AA800DAC94C /* PBXBuildRule */ = {
isa = PBXBuildRule;
compilerSpec = com.intel.compilers.icc.latest;
fileType = sourcecode.cpp;
isEditable = 1;
outputFiles = (
);
script = "# Type a script or drag a script file from your workspace to insert its path.\n";
};
/* End PBXBuildRule section */
/* Begin PBXCopyFilesBuildPhase section */
8DD76F690486A84900D96B5E /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 12;
dstPath = "";
dstSubfolderSpec = 16;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
05593A0B0B8F4F4500DE73AB /* common.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = common.h; path = ../common.h; sourceTree = SOURCE_ROOT; };
05593A0C0B8F4F4500DE73AB /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = ../main.cpp; sourceTree = SOURCE_ROOT; };
05593A0D0B8F4F4500DE73AB /* OptimizedParallelSumTree.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = OptimizedParallelSumTree.cpp; path = ../OptimizedParallelSumTree.cpp; sourceTree = SOURCE_ROOT; };
05593A0E0B8F4F4500DE73AB /* SerialSumTree.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SerialSumTree.cpp; path = ../SerialSumTree.cpp; sourceTree = SOURCE_ROOT; };
05593A0F0B8F4F4500DE73AB /* SimpleParallelSumTree.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = SimpleParallelSumTree.cpp; path = ../SimpleParallelSumTree.cpp; sourceTree = SOURCE_ROOT; };
05593A4A0B8F51E000DE73AB /* tree_sum */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = tree_sum; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8DD76F660486A84900D96B5E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
08FB7794FE84155DC02AAC07 /* tree_sum */ = {
isa = PBXGroup;
children = (
08FB7795FE84155DC02AAC07 /* Source */,
1AB674ADFE9D54B511CA2CBB /* Products */,
);
name = tree_sum;
sourceTree = "<group>";
};
08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
05593A0B0B8F4F4500DE73AB /* common.h */,
05593A0C0B8F4F4500DE73AB /* main.cpp */,
05593A0D0B8F4F4500DE73AB /* OptimizedParallelSumTree.cpp */,
05593A0E0B8F4F4500DE73AB /* SerialSumTree.cpp */,
05593A0F0B8F4F4500DE73AB /* SimpleParallelSumTree.cpp */,
);
name = Source;
sourceTree = "<group>";
};
1AB674ADFE9D54B511CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
05593A4A0B8F51E000DE73AB /* tree_sum */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8DD76F620486A84900D96B5E /* tree_sum */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "tree_sum" */;
buildPhases = (
8DD76F640486A84900D96B5E /* Sources */,
8DD76F660486A84900D96B5E /* Frameworks */,
8DD76F690486A84900D96B5E /* CopyFiles */,
);
buildRules = (
C3C5895D218B6AA800DAC94C /* PBXBuildRule */,
);
dependencies = (
);
name = tree_sum;
productInstallPath = "$(HOME)/bin";
productName = tree_sum;
productReference = 05593A4A0B8F51E000DE73AB /* tree_sum */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1000;
};
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "tree_sum" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 08FB7794FE84155DC02AAC07 /* tree_sum */;
projectDirPath = "";
projectRoot = "";
targets = (
8DD76F620486A84900D96B5E /* tree_sum */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
8DD76F640486A84900D96B5E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
05593A110B8F4F4500DE73AB /* main.cpp in Sources */,
05593A120B8F4F4500DE73AB /* OptimizedParallelSumTree.cpp in Sources */,
05593A130B8F4F4500DE73AB /* SerialSumTree.cpp in Sources */,
05593A140B8F4F4500DE73AB /* SimpleParallelSumTree.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
A1F593C60B8F0E6E00073279 /* Debug64 */ = {
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_VERSION = "";
HEADER_SEARCH_PATHS = "$(inherited)";
ICC_CXX_LANG_DIALECT = "c++11";
INSTALL_PATH = "$(HOME)/bin";
LD_RUNPATH_SEARCH_PATHS = "$(inherited)";
LIBRARY_SEARCH_PATHS = "$(inherited)";
PRODUCT_NAME = tree_sum;
ZERO_LINK = NO;
};
name = Debug64;
};
A1F593C70B8F0E6E00073279 /* Release64 */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_VERSION = "";
HEADER_SEARCH_PATHS = "$(inherited)";
ICC_CXX_LANG_DIALECT = "c++11";
INSTALL_PATH = "$(HOME)/bin";
LD_RUNPATH_SEARCH_PATHS = "$(inherited)";
LIBRARY_SEARCH_PATHS = "$(inherited)";
PRODUCT_NAME = tree_sum;
ZERO_LINK = NO;
};
name = Release64;
};
A1F593C80B8F0E6E00073279 /* Debug64 */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ENABLE_TESTABILITY = YES;
GCC_ENABLE_CPP_RTTI = YES;
GCC_MODEL_TUNING = "";
GCC_VERSION = "";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(TBBROOT)/include",
/opt/intel/tbb/include,
);
ICC_CXX_LANG_DIALECT = "c++11";
LD_RUNPATH_SEARCH_PATHS = "$(TBBROOT)/lib /opt/intel/tbb/lib";
LIBRARY_SEARCH_PATHS = (
"$(TBBROOT)/lib",
/opt/intel/tbb/lib,
);
MACOSX_DEPLOYMENT_TARGET = 10.11;
ONLY_ACTIVE_ARCH = YES;
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
"-m64",
);
OTHER_LDFLAGS = (
"-m64",
"-ltbb_debug",
"-ltbbmalloc_debug",
);
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
SYMROOT = "/tmp/tbb-$(USER)";
VALID_ARCHS = x86_64;
};
name = Debug64;
};
A1F593C90B8F0E6E00073279 /* Release64 */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
GCC_ENABLE_CPP_RTTI = YES;
GCC_MODEL_TUNING = "";
GCC_VERSION = "";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(TBBROOT)/include",
/opt/intel/tbb/include,
);
ICC_CXX_LANG_DIALECT = "c++11";
LD_RUNPATH_SEARCH_PATHS = "$(TBBROOT)/lib /opt/intel/tbb/lib";
LIBRARY_SEARCH_PATHS = (
"$(TBBROOT)/lib",
/opt/intel/tbb/lib,
);
MACOSX_DEPLOYMENT_TARGET = 10.11;
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
"-m64",
);
OTHER_LDFLAGS = (
"-m64",
"-ltbb",
"-ltbbmalloc",
);
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
SYMROOT = "/tmp/tbb-$(USER)";
VALID_ARCHS = x86_64;
};
name = Release64;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "tree_sum" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A1F593C60B8F0E6E00073279 /* Debug64 */,
A1F593C70B8F0E6E00073279 /* Release64 */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release64;
};
1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "tree_sum" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A1F593C80B8F0E6E00073279 /* Debug64 */,
A1F593C90B8F0E6E00073279 /* Release64 */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release64;
};
/* End XCConfigurationList section */
};
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
}