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=binpack
ARGS= 4 N=1000
PERF_RUN_ARGS=auto N=1000 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 /D _CRT_SECURE_NO_DEPRECATE $(CXXFLAGS)
MYLDFLAGS =/INCREMENTAL:NO /NOLOGO /DEBUG /FIXED:NO $(LDFLAGS)
all: release test
release:
$(CXX) *.cpp /MD /O2 /D NDEBUG $(MYCXXFLAGS) /link tbb.lib $(LIBS) $(MYLDFLAGS) /OUT:$(PROG).exe
debug:
$(CXX) *.cpp /MDd /Od /Zi /D TBB_USE_DEBUG /D _DEBUG $(MYCXXFLAGS) /link tbb_debug.lib $(LIBS) $(MYLDFLAGS) /OUT:$(PROG).exe
profile:
$(CXX) *.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)
compiler_check:
@$(CXX) >nul 2>&1 || echo "$(CXX) command not found. Check if CXX=$(CXX) is set properly"
perf_build: release
perf_run:
$(PROG) $(PERF_RUN_ARGS)

View File

@@ -0,0 +1,289 @@
/*
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.
*/
/* Bin-packing algorithm that attempts to use minimal number of bins B of
size V to contain N items of varying sizes. */
#include <string>
#include <iostream>
#include <cmath>
#include <vector>
#include <atomic>
#include "tbb/tick_count.h"
#include "tbb/flow_graph.h"
#include "tbb/global_control.h"
#include "../../common/utility/utility.h"
#include "../../common/utility/get_default_num_threads.h"
using tbb::tick_count;
using namespace tbb::flow;
typedef size_t size_type; // to represent non-zero indices, capacities, etc.
typedef size_t value_type; // the type of items we are attempting to pack into bins
typedef std::vector<value_type> bin; // we use a simple vector to represent a bin
// Our bin packers will be function nodes in the graph that take value_type items and
// return a dummy value. They will also implicitly send packed bins to the bin_buffer
// node, and unused items back to the value_pool node:
typedef multifunction_node<value_type, tuple<value_type, bin>, rejecting> bin_packer;
// Items are placed into a pool that all bin packers grab from, represent by a queue_node:
typedef queue_node<value_type> value_pool;
// Packed bins are placed in this buffer waiting to be serially printed and/or accounted for:
typedef buffer_node<bin> bin_buffer;
// Packed bins are taken from the_bin_buffer and processed by the_writer:
typedef function_node<bin, continue_msg, rejecting> bin_writer;
// Items are injected into the graph when this node sends them to the_value_pool:
typedef input_node<value_type> value_source;
// User-specified globals with default values
size_type V = 42; // desired capacity for each bin
size_type N = 1000; // number of elements to generate
bool verbose = false; // prints bin details and other diagnostics to screen
bool silent = false; // suppress all output except for time
int num_bin_packers=-1; // number of concurrent bin packers in operation; default is #threads;
// larger values can result in more bins at less than full capacity
size_type optimality=1; // 1 (default) is highest the algorithm can obtain; larger numbers run faster
// Calculated globals
size_type min_B; // lower bound on the optimal number of bins
size_type B; // the answer, i.e. number of bins used by the algorithm
size_type *input_array; // stores randomly generated input values
value_type item_sum; // sum of all randomly generated input values
std::atomic<value_type> packed_sum; // sum of all values currently packed into all bins
std::atomic<size_type> packed_items; // number of values currently packed into all bins
std::atomic<size_type> active_bins; // number of active bin_packers
bin_packer **bins; // the array of bin packers
// This class is the Body type for bin_packer
class bin_filler {
typedef bin_packer::output_ports_type ports_type;
bin my_bin; // the current bin that this bin_filler is packing
size_type my_used; // capacity of bin used by current contents (not to be confused with my_bin.size())
size_type relax, relax_val; // relaxation counter for determining when to settle for a non-full bin
bin_packer* my_bin_packer; // ptr to the bin packer that this body object is associated with
size_type bin_index; // index of the encapsulating bin packer in the global bins array
value_type looking_for; // the minimum size of item this bin_packer will accept
value_pool* the_value_pool; // the queue of incoming values
bool done; // flag to indicate that this binpacker has been deactivated
public:
bin_filler(size_t bidx, value_pool* _q) :
my_used(0), relax(0), relax_val(0), my_bin_packer(NULL), bin_index(bidx), looking_for(V), the_value_pool(_q), done(false) {}
void operator()(const value_type& item, ports_type& p) {
if (!my_bin_packer) my_bin_packer = bins[bin_index];
if (done) get<0>(p).try_put(item); // this bin_packer is done packing items; put item back to pool
else if (item > V) { // signal that packed_sum has reached item_sum at some point
size_type remaining = active_bins--;
if (remaining == 1 && packed_sum == item_sum) { // this is the last bin and it has seen everything
// this bin_packer may not have seen everything, so stay active
if (my_used>0) get<1>(p).try_put(my_bin);
my_bin.clear();
my_used = 0;
looking_for = V;
++active_bins;
}
else if (remaining == 1) { // this is the last bin, but there are remaining items
get<0>(p).try_put(V+1); // send out signal
++active_bins;
}
else if (remaining > 1) { // this is not the last bin; deactivate
if (my_used < V/(1+optimality*.1)) { // this bin is ill-utilized; throw back items and deactivate
packed_sum -= my_used;
packed_items -= my_bin.size();
for (size_type i=0; i<my_bin.size(); ++i)
get<0>(p).try_put(my_bin[i]);
the_value_pool->remove_successor(*my_bin_packer); // deactivate
done = true;
get<0>(p).try_put(V+1); // send out signal
}
else { // this bin is well-utilized; send out bin and deactivate
the_value_pool->remove_successor(*my_bin_packer); // build no more bins
done = true;
if (my_used>0) get<1>(p).try_put(my_bin);
get<0>(p).try_put(V+1); // send out signal
}
}
}
else if (item <= V-my_used && item >= looking_for) { // this item can be packed
my_bin.push_back(item);
my_used += item;
packed_sum += item;
++packed_items;
looking_for = V-my_used;
relax = 0;
if (packed_sum == item_sum) {
get<0>(p).try_put(V+1); // send out signal
}
if (my_used == V) {
get<1>(p).try_put(my_bin);
my_bin.clear();
my_used = 0;
looking_for = V;
}
}
else { // this item can't be packed; relax constraints
++relax;
if (relax >= (N-packed_items)/optimality) { // this bin_packer has looked through enough items
relax = 0;
--looking_for; // accept a wider range of items
if (looking_for == 0 && my_used < V/(1+optimality*.1) && my_used > 0 && active_bins > 1) {
// this bin_packer is ill-utilized and can't find items; deactivate and throw back items
size_type remaining = active_bins--;
if (remaining > 1) { // not the last bin_packer
the_value_pool->remove_successor(*my_bin_packer); // deactivate
done = true;
}
else active_bins++; // can't deactivate last bin_packer
packed_sum -= my_used;
packed_items -= my_bin.size();
for (size_type i=0; i<my_bin.size(); ++i)
get<0>(p).try_put(my_bin[i]);
my_bin.clear();
my_used = 0;
}
else if (looking_for == 0 && (my_used >= V/(1+optimality*.1) || active_bins == 1)) {
// this bin_packer can't find items but is well-utilized, so send it out and reset
get<1>(p).try_put(my_bin);
my_bin.clear();
my_used = 0;
looking_for = V;
}
}
get<0>(p).try_put(item); // put unused item back to pool
}
}
};
// source node uses this to send the values to the value_pool
class item_generator {
size_type counter;
public:
item_generator() : counter(0) {}
bool operator()(value_type& m) {
if (counter<N) {
m = input_array[counter];
++counter;
return true;
}
return false;
}
};
// the terminal function_node uses this to gather stats and print bin information
class bin_printer {
value_type running_count;
size_type item_count;
value_type my_min, my_max;
double avg;
public:
bin_printer() : running_count(0), item_count(0), my_min(V), my_max(0), avg(0) {}
continue_msg operator()(bin b) {
value_type sum=0;
++B;
if (verbose)
std::cout << "[ ";
for (size_type i=0; i<b.size(); ++i) {
if (verbose)
std::cout << b[i] << " ";
sum+=b[i];
++item_count;
}
if (sum < my_min) my_min = sum;
if (sum > my_max) my_max = sum;
avg += sum;
running_count += sum;
if (verbose)
std::cout << "]=" << sum << "; Done/Packed/Total cap: " << running_count << "/" << packed_sum << "/" << item_sum
<< " items:" << item_count << "/" << packed_items << "/" << N << " B=" << B << std::endl;
if (item_count == N) { // should be the last; print stats
avg = avg/(double)B;
if (!silent)
std::cout << "SUMMARY: #Bins used: " << B << "; Avg size: " << avg << "; Max size: " << my_max
<< "; Min size: " << my_min << "\n Lower bound on optimal #bins: " << min_B
<< "; Start #bins: " << num_bin_packers << std::endl;
}
return continue_msg(); // need to return something
}
};
int main(int argc, char *argv[]) {
try {
utility::thread_number_range threads(utility::get_default_num_threads);
utility::parse_cli_arguments(argc, argv,
utility::cli_argument_pack()
//"-h" option for displaying help is present implicitly
.positional_arg(threads,"#threads",utility::thread_number_range_desc)
.arg(verbose,"verbose"," print diagnostic output to screen")
.arg(silent,"silent"," limits output to timing info; overrides verbose")
.arg(N,"N"," number of values to pack")
.arg(V,"V"," capacity of each bin")
.arg(num_bin_packers,"#packers"," number of concurrent bin packers to use "
"(default=#threads)")
.arg(optimality,"optimality","controls optimality of solution; 1 is highest, use\n"
" larger numbers for less optimal but faster solution")
);
if (silent) verbose = false; // make silent override verbose
// Generate random input data
srand(42);
input_array = new value_type[N];
item_sum = 0;
for (size_type i=0; i<N; ++i) {
input_array[i] = rand() % V + 1; // generate items that fit in a bin
item_sum += input_array[i];
}
min_B = (item_sum % V) ? item_sum/V + 1 : item_sum/V;
tick_count start = tick_count::now();
for(int p = threads.first; p <= threads.last; p = threads.step(p)) {
tbb::global_control c(tbb::global_control::max_allowed_parallelism, p);
packed_sum = 0;
packed_items = 0;
B = 0;
if (num_bin_packers == -1) num_bin_packers = p;
active_bins = num_bin_packers;
if (!silent)
std::cout << "binpack running with " << item_sum << " capacity over " << N << " items, optimality="
<< optimality << ", " << num_bin_packers << " bins of capacity=" << V << " on " << p
<< " threads.\n";
graph g;
value_source the_source(g, item_generator());
value_pool the_value_pool(g);
make_edge(the_source, the_value_pool);
bin_buffer the_bin_buffer(g);
bins = new bin_packer*[num_bin_packers];
for (int i=0; i<num_bin_packers; ++i) {
bins[i] = new bin_packer(g, 1, bin_filler(i, &the_value_pool));
make_edge(the_value_pool, *(bins[i]));
make_edge(output_port<0>(*(bins[i])), the_value_pool);
make_edge(output_port<1>(*(bins[i])), the_bin_buffer);
}
bin_writer the_writer(g, 1, bin_printer());
make_edge(the_bin_buffer, the_writer);
the_source.activate();
g.wait_for_all();
for (int i=0; i<num_bin_packers; ++i) {
delete bins[i];
}
delete[] bins;
}
utility::report_elapsed_time((tick_count::now() - start).seconds());
delete[] input_array;
return 0;
} catch(std::exception& e) {
std::cerr<<"error occurred. error text is :\"" <<e.what()<<"\"\n";
return 1;
}
}

View File

@@ -0,0 +1,415 @@
<!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. Binpack 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
+KGUM2JEBtpz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4D+bjTQbc1i9demreDu8Ch0ffG6hdnmDMrvFbsSsAXczIGk3fwb4VYe+pwBB9Angkd83ADtqgkq
AjetdTTV1icDlfl+Qi3AP4elHEjaDXscHgFjPdNt4ID6S9B9sNLiKoelmuFuJbCpDJi+hvqz2qFw
iIfWc2AQusxPgvq484vH2eUgtpYHH0Hteeqb75ZwMQ+j+cDg9PlwFDwd6o9sr0KtbWI/tSPgp32M
76H+s6mNX3030df5neGq1OtbZDUbOIlFoFaha0L9j0qfCHeAerDqVtODU8+hNThZfR1fHHbpG6kx
9Or1LzUmVVz+HJXDAAAAAElFTkSuQmCC">
<h1 class="title">Intel&reg; Threading Building Blocks.<br>Binpack sample</h1>
</div>
<p>
This directory contains a simple tbb::flow example that performs
binpacking of N integer values into a near-optimal number of bins
of capacity V.
<br><br>
It features a source_node which passes randomly
generated integer values of size&lt;=V to a queue_node. Multiple
function_nodes set about taking values from this queue_node and
packing them into bins according to a best-fit policy. Items that
cannot be made to fit are rejected and returned to the queue. When
a bin is packed as well as it can be, it is passed to a buffer_node
where it waits to be picked up by another function_node. This final
function nodes gathers stats about the bin and optionally prints its
contents. When all bins are accounted for, it optionally prints a
summary of the quality of the bin-packing.
</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="binpack.cpp">binpack.cpp</a>
<dd>Driver.
<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 with the Intel&reg; C++ Compiler (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>binpack <i>-h</i></tt>
<dd>Prints the help for command line options
<dt><tt>binpack [<i>#threads</i>=value] [<i>verbose</i>] [<i>silent</i>] [<i>N</i>=value] [<i>V</i>=value] [<i>#packers</i>=value] [<i>optimality</i>=value] [<i>#threads</i>]</tt>
<dd><tt><i>#threads</i></tt> 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>
<tt><i>verbose</i></tt> print diagnostic output to screen<br>
<tt><i>silent</i></tt> limits output to timing info; overrides verbose<br>
<tt><i>N</i></tt> number of values to pack<br>
<tt><i>V</i></tt> capacity of each bin<br>
<tt><i>#packers</i></tt> number of concurrent bin packers to use (default=#threads)<br>
<tt><i>optimality</i></tt> controls optimality of solution; 1 is highest, use larger numbers for less optimal but faster solution<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>binpack&nbsp;4&nbsp;N=100</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,310 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
A1F593A60B8F042A00073279 /* binpack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1F593A50B8F042A00073279 /* binpack.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXBuildRule section */
C3C58950218B599300DAC94C /* 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 /* Binpack */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Binpack; sourceTree = BUILT_PRODUCTS_DIR; };
A1F593A50B8F042A00073279 /* binpack.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = binpack.cpp; path = ../binpack.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 /* Binpack */ = {
isa = PBXGroup;
children = (
08FB7795FE84155DC02AAC07 /* Source */,
1AB674ADFE9D54B511CA2CBB /* Products */,
);
name = Binpack;
sourceTree = "<group>";
};
08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
A1F593A50B8F042A00073279 /* binpack.cpp */,
);
name = Source;
sourceTree = "<group>";
};
1AB674ADFE9D54B511CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8DD76F6C0486A84900D96B5E /* Binpack */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8DD76F620486A84900D96B5E /* Binpack */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "Binpack" */;
buildPhases = (
8DD76F640486A84900D96B5E /* Sources */,
8DD76F660486A84900D96B5E /* Frameworks */,
8DD76F690486A84900D96B5E /* CopyFiles */,
);
buildRules = (
C3C58950218B599300DAC94C /* PBXBuildRule */,
);
dependencies = (
);
name = Binpack;
productInstallPath = "$(HOME)/bin";
productName = Binpack;
productReference = 8DD76F6C0486A84900D96B5E /* Binpack */;
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 "binpack" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 08FB7794FE84155DC02AAC07 /* Binpack */;
projectDirPath = "";
projectRoot = "";
targets = (
8DD76F620486A84900D96B5E /* Binpack */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
8DD76F640486A84900D96B5E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A1F593A60B8F042A00073279 /* binpack.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 = Binpack;
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 = Binpack;
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,
);
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",
);
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,
);
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",
);
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 "Binpack" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A1F593C60B8F0E6E00073279 /* Debug64 */,
A1F593C70B8F0E6E00073279 /* Release64 */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release64;
};
1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "binpack" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A1F593C80B8F0E6E00073279 /* Debug64 */,
A1F593C90B8F0E6E00073279 /* Release64 */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release64;
};
/* End XCConfigurationList section */
};
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
}