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,44 @@
# 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=dining_philosophers
ARGS= auto 5
LIGHT_ARGS= auto 3
# 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 /D _CRT_SECURE_NO_DEPRECATE $(CXXFLAGS)
MYLDFLAGS =/INCREMENTAL:NO /NOLOGO /DEBUG /FIXED:NO $(LDFLAGS)
all: release test
release:
$(CXX) ./dining_philosophers.cpp /MD /O2 /D NDEBUG $(MYCXXFLAGS) /link tbb.lib $(LIBS) $(MYLDFLAGS) /OUT:$(PROG).exe
debug:
$(CXX) ./dining_philosophers.cpp /MDd /Od /Zi /D _DEBUG $(MYCXXFLAGS) /link tbb_debug.lib $(LIBS) $(MYLDFLAGS) /OUT:$(PROG).exe
profile:
$(CXX) ./dining_philosophers.cpp /MD /O2 /Zi /D NDEBUG $(MYCXXFLAGS) /D TBB_USE_THREADING_TOOLS /link tbb.lib $(LIBS) $(MYLDFLAGS) /OUT:$(PROG).exe
clean:
@cmd.exe /C del $(PROG).exe *.obj *.?db *.manifest
test:
$(PROG) $(ARGS)
light_test:
$(PROG) $(LIGHT_ARGS)

View File

@@ -0,0 +1,303 @@
/*
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.
*/
#if _MSC_VER
// Suppress "decorated name length exceeded, name was truncated" warning
#pragma warning (disable: 4503)
#endif
#include "tbb/flow_graph.h"
#include "tbb/tick_count.h"
#include "tbb/spin_mutex.h"
#include "tbb/global_control.h"
#include <iostream>
#include <thread>
#include <chrono>
#include "../../common/utility/utility.h"
#include "../../common/utility/get_default_num_threads.h"
#include <cstdlib>
#include <cstdio>
// Each philosopher is an object, and is invoked in the think() function_node, the
// eat() function_node and forward() multifunction_node.
//
// The graph is constructed, and each think() function_node is started with a continue_msg.
//
// The philosopher will think, then gather two chopsticks, eat, place the chopsticks back,
// and if they have not completed the required number of cycles, will start to think() again
// by sending a continue_msg to their corresponding think() function_node.
//
// The reserving join has as its inputs the left and right chopstick queues an a queue
// that stores the continue_msg emitted by the function_node after think()ing is done.
// When all three inputs are available, a tuple of the inputs will be forwarded to the
// eat() function_node. The output of the eat() function_node is sent to the forward()
// multifunction_node.
const std::chrono::seconds think_time (1);
const std::chrono::seconds eat_time (1);
const int num_times = 10;
tbb::tick_count t0;
bool verbose = false;
const char *names[] = { "Archimedes", "Bakunin", "Confucius", "Democritus", "Euclid"
, "Favorinus", "Geminus", "Heraclitus", "Ichthyas", "Jason of Nysa",
"Kant", "Lavrov", "Metrocles", "Nausiphanes", "Onatas", "Phaedrus",
"Quillot", "Russell", "Socrates", "Thales", "Udayana",
"Vernadsky", "Wittgenstein", "Xenophilus", "Yen Yuan", "Zenodotus"
};
const int NumPhilosophers = sizeof(names) / sizeof(char*);
struct RunOptions {
utility::thread_number_range threads;
int number_of_philosophers;
bool silent;
RunOptions(utility::thread_number_range threads_, int number_of_philosophers_, bool silent_) :
threads(threads_), number_of_philosophers(number_of_philosophers_), silent(silent_) { }
};
RunOptions ParseCommandLine(int argc, char *argv[]) {
int auto_threads = utility::get_default_num_threads();
utility::thread_number_range threads(utility::get_default_num_threads, auto_threads, auto_threads);
int nPhilosophers = 5;
bool verbose = false;
char charbuf[100];
std::sprintf(charbuf, "%d", NumPhilosophers);
std::string pCount = "how many philosophers, from 2-";
pCount += charbuf;
utility::cli_argument_pack cli_pack;
cli_pack.positional_arg(threads, "n-of_threads", utility::thread_number_range_desc)
.positional_arg(nPhilosophers, "n-of-philosophers", pCount)
.arg(verbose,"verbose","verbose output");
utility::parse_cli_arguments(argc, argv, cli_pack);
if(nPhilosophers < 2 || nPhilosophers > NumPhilosophers) {
std::cout << "Number of philosophers (" << nPhilosophers << ") out of range [2:" << NumPhilosophers << "]\n";
std::cout << cli_pack.usage_string(argv[0]) << std::flush;
std::exit(1);
}
return RunOptions(threads, nPhilosophers,!verbose);
}
tbb::spin_mutex my_mutex;
class chopstick {};
using namespace tbb::flow;
typedef tbb::flow::tuple<continue_msg, chopstick, chopstick> join_output;
typedef join_node< join_output, reserving > join_node_type;
typedef function_node<continue_msg, continue_msg> think_node_type;
typedef function_node<join_output, continue_msg> eat_node_type;
typedef multifunction_node<continue_msg, join_output> forward_node_type;
class philosopher {
public:
philosopher( const char *name ) :
my_name(name), my_count(num_times) { }
~philosopher() {
}
void check();
const char *name() const { return my_name; }
private:
friend std::ostream& operator<<(std::ostream& o, philosopher const &p);
const char *my_name;
int my_count;
friend class think_node_body;
friend class eat_node_body;
friend class forward_node_body;
void think( );
void eat();
void forward( const continue_msg &in, forward_node_type::output_ports_type &out_ports );
};
std::ostream& operator<<(std::ostream& o, philosopher const &p) {
o << "< philosopher[" << reinterpret_cast<uintptr_t>(const_cast<philosopher *>(&p)) << "] " << p.name()
<< ", my_count=" << p.my_count;
return o;
}
class think_node_body {
philosopher& my_philosopher;
public:
think_node_body( philosopher &p ) : my_philosopher(p) { }
think_node_body( const think_node_body &other ) : my_philosopher(other.my_philosopher) { }
continue_msg operator()( continue_msg /*m*/) {
my_philosopher.think();
return continue_msg();
}
};
class eat_node_body {
philosopher &my_philosopher;
public:
eat_node_body( philosopher &p) : my_philosopher(p) {}
eat_node_body( const eat_node_body &other ) : my_philosopher(other.my_philosopher) { }
continue_msg operator()(const join_output &in) {
my_philosopher.eat();
return continue_msg();
}
};
class forward_node_body {
philosopher &my_philosopher;
public:
forward_node_body( philosopher &p) : my_philosopher(p) {}
forward_node_body( const forward_node_body &other ) : my_philosopher(other.my_philosopher) { }
void operator()( const continue_msg &in, forward_node_type::output_ports_type &out) {
my_philosopher.forward( in, out);
}
};
void philosopher::check() {
if ( my_count != 0 ) {
std::printf("ERROR: philosopher %s still had to run %d more times\n", name(), my_count);
std::exit(1);
}
}
void philosopher::forward( const continue_msg &/*in*/, forward_node_type::output_ports_type &out_ports ) {
if(my_count < 0) abort();
--my_count;
(void)tbb::flow::get<1>(out_ports).try_put(chopstick());
(void)tbb::flow::get<2>(out_ports).try_put(chopstick());
if (my_count > 0) {
(void)tbb::flow::get<0>(out_ports).try_put(continue_msg()); //start thinking again
} else {
if(verbose) {
tbb::spin_mutex::scoped_lock lock(my_mutex);
std::printf("%s has left the building\n", name());
}
}
}
void philosopher::eat() {
if(verbose) {
tbb::spin_mutex::scoped_lock lock(my_mutex);
std::printf("%s eating\n", name());
}
std::this_thread::sleep_for(eat_time);
if(verbose) {
tbb::spin_mutex::scoped_lock lock(my_mutex);
std::printf("%s done eating\n", name());
}
}
void philosopher::think() {
if(verbose) {
tbb::spin_mutex::scoped_lock lock(my_mutex);
std::printf("%s thinking\n", name());
}
std::this_thread::sleep_for(think_time);
if(verbose) {
tbb::spin_mutex::scoped_lock lock(my_mutex);
std::printf("%s done thinking\n", name());
}
}
typedef queue_node<continue_msg> thinking_done_type;
int main(int argc, char *argv[]) {
try {
tbb::tick_count main_time = tbb::tick_count::now();
int num_threads;
int num_philosophers;
RunOptions options = ParseCommandLine(argc, argv);
num_philosophers = options.number_of_philosophers;
verbose = !options.silent;
for(num_threads = options.threads.first; num_threads <= options.threads.last; num_threads = options.threads.step(num_threads)) {
tbb::global_control c(tbb::global_control::max_allowed_parallelism, num_threads);
graph g;
if(verbose) std::cout << std::endl << num_philosophers << " philosophers with "
<< num_threads << " threads" << std::endl << std::endl;
t0 = tbb::tick_count::now();
std::vector<queue_node<chopstick> > places(num_philosophers, queue_node<chopstick>(g));
std::vector<philosopher> philosophers;
philosophers.reserve(num_philosophers);
std::vector<think_node_type *> think_nodes;
think_nodes.reserve(num_philosophers);
std::vector<thinking_done_type> done_vector(num_philosophers, thinking_done_type(g));
std::vector<join_node_type> join_vector(num_philosophers,join_node_type(g));
std::vector<eat_node_type *> eat_nodes;
eat_nodes.reserve(num_philosophers);
std::vector<forward_node_type *> forward_nodes;
forward_nodes.reserve(num_philosophers);
for ( int i = 0; i < num_philosophers; ++i ) {
places[i].try_put(chopstick());
philosophers.push_back( philosopher( names[i] ) ); // allowed because of default generated assignment
if(verbose) {
tbb::spin_mutex::scoped_lock lock(my_mutex);
std::cout << "Built philosopher " << philosophers[i] << std::endl;
}
think_nodes.push_back(new think_node_type(g, unlimited, think_node_body(philosophers[i])));
eat_nodes.push_back( new eat_node_type(g, unlimited, eat_node_body(philosophers[i])));
forward_nodes.push_back( new forward_node_type(g, unlimited, forward_node_body(philosophers[i])));
}
// attach chopstick buffers and think function_nodes to joins
for(int i = 0; i < num_philosophers; ++i) {
make_edge( *think_nodes[i], done_vector[i] );
make_edge( done_vector[i], input_port<0>(join_vector[i]) );
make_edge( places[i], input_port<1>(join_vector[i]) ); // left chopstick
make_edge( places[(i+1) % num_philosophers], input_port<2>(join_vector[i]) ); // right chopstick
make_edge( join_vector[i], *eat_nodes[i] );
make_edge( *eat_nodes[i], *forward_nodes[i] );
make_edge( output_port<0>(*forward_nodes[i]), *think_nodes[i] );
make_edge( output_port<1>(*forward_nodes[i]), places[i] );
make_edge( output_port<2>(*forward_nodes[i]), places[(i+1) % num_philosophers] );
}
// start all the philosophers thinking
for(int i = 0; i < num_philosophers; ++i) think_nodes[i]->try_put(continue_msg());
g.wait_for_all();
tbb::tick_count t1 = tbb::tick_count::now();
if(verbose) std::cout << std::endl << num_philosophers << " philosophers with "
<< num_threads << " threads have taken " << (t1-t0).seconds() << "seconds" << std::endl;
for ( int i = 0; i < num_philosophers; ++i ) philosophers[i].check();
for(int i = 0; i < num_philosophers; ++i) {
delete think_nodes[i];
delete eat_nodes[i];
delete forward_nodes[i];
}
}
utility::report_elapsed_time((tbb::tick_count::now() - main_time).seconds());
return 0;
} catch(std::exception& e) {
std::cerr<<"error occurred. error text is :\"" <<e.what()<<"\"\n";
return 1;
}
}

View File

@@ -0,0 +1,383 @@
<!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. Dining_philosophers 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
ZyITBu234Jp26XoQfCC80sfTAXVv7wOXskuPgnHoSvn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FjPdNt4ID6S9B9sNLiKoelmuFuJbCpDJi+hvqz2qFw
iIfWc2AQusxPgvq484vH2eUgtpYHH0Hteeqb75ZwMQ+j+cDg9PlwFDwd6o9sr0KtbWI/tSPgp32M
76H+s6mNX3030df5neGq1OtbZDUbOIlFoFaha0L9j0qfCHeAerDqVtODU8+hNThZfR1fHHbpG6kx
9Or1LzUmVVz+HJXDAAAAAElFTkSuQmCC">
<h1 class="title">Intel&reg; Threading Building Blocks.<br>Dining_philosophers sample</h1>
</div>
<p>
The Dining Philosophers problem demonstrates tbb::flow and the use of the reserving join node to
solve the potential deadlock.
<br><br>
This program runs some number of philosophers in parallel, each thinking and then waiting for chopsticks
to be available before eating. Eating and thinking are implemented with sleep(). The chopstick positions are represented by a queue_node with one item.
</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="dining_philosophers.cpp">dining_philosophers.cpp</a>
<dd>Source code for the example.
<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>
<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,316 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
A1F593A60B8F042A00073279 /* dining_philosophers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1F593A50B8F042A00073279 /* dining_philosophers.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXBuildRule section */
C3C58955218B5FE200DAC94C /* 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 */
8DD76F6C0486A84900D96B5E /* dining_philosophers */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = dining_philosophers; sourceTree = BUILT_PRODUCTS_DIR; };
A1F593A50B8F042A00073279 /* dining_philosophers.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = dining_philosophers.cpp; path = ../dining_philosophers.cpp; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8DD76F660486A84900D96B5E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
08FB7794FE84155DC02AAC07 /* dining_philosophers */ = {
isa = PBXGroup;
children = (
08FB7795FE84155DC02AAC07 /* Source */,
1AB674ADFE9D54B511CA2CBB /* Products */,
);
name = dining_philosophers;
sourceTree = "<group>";
};
08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
A1F593A50B8F042A00073279 /* dining_philosophers.cpp */,
);
name = Source;
sourceTree = "<group>";
};
1AB674ADFE9D54B511CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8DD76F6C0486A84900D96B5E /* dining_philosophers */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8DD76F620486A84900D96B5E /* dining_philosophers */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "dining_philosophers" */;
buildPhases = (
8DD76F640486A84900D96B5E /* Sources */,
8DD76F660486A84900D96B5E /* Frameworks */,
8DD76F690486A84900D96B5E /* CopyFiles */,
);
buildRules = (
C3C58955218B5FE200DAC94C /* PBXBuildRule */,
);
dependencies = (
);
name = dining_philosophers;
productInstallPath = "$(HOME)/bin";
productName = dining_philosophers;
productReference = 8DD76F6C0486A84900D96B5E /* dining_philosophers */;
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 "dining_philosophers" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 08FB7794FE84155DC02AAC07 /* dining_philosophers */;
projectDirPath = "";
projectRoot = "";
targets = (
8DD76F620486A84900D96B5E /* dining_philosophers */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
8DD76F640486A84900D96B5E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A1F593A60B8F042A00073279 /* dining_philosophers.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)";
OTHER_LDFLAGS = (
"-m64",
"-ltbb_debug",
);
PRODUCT_NAME = dining_philosophers;
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)";
OTHER_LDFLAGS = (
"-m64",
"-ltbb",
);
PRODUCT_NAME = dining_philosophers;
ZERO_LINK = NO;
};
name = Release64;
};
A1F593C80B8F0E6E00073279 /* Debug64 */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_ENABLE_CPP_RTTI = YES;
GCC_MODEL_TUNING = "";
GCC_NO_COMMON_BLOCKS = YES;
GCC_VERSION = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(TBBROOT)/include",
/opt/intel/tbb/include,
);
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",
);
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;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ENABLE_CPP_RTTI = YES;
GCC_MODEL_TUNING = "";
GCC_NO_COMMON_BLOCKS = YES;
GCC_VERSION = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(TBBROOT)/include",
/opt/intel/tbb/include,
);
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",
);
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 "dining_philosophers" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A1F593C60B8F0E6E00073279 /* Debug64 */,
A1F593C70B8F0E6E00073279 /* Release64 */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release64;
};
1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "dining_philosophers" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A1F593C80B8F0E6E00073279 /* Debug64 */,
A1F593C90B8F0E6E00073279 /* Release64 */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release64;
};
/* End XCConfigurationList section */
};
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
}