Disabled external gits
This commit is contained in:
44
cs440-acg/ext/tbb/examples/graph/som/Makefile.windows
Normal file
44
cs440-acg/ext/tbb/examples/graph/som/Makefile.windows
Normal 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=som
|
||||
ARGS=
|
||||
LIGHT_ARGS=4
|
||||
|
||||
# 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) ./som_graph.cpp ./som.cpp /MD /O2 /D NDEBUG $(MYCXXFLAGS) /link tbb.lib $(LIBS) $(MYLDFLAGS) /OUT:$(PROG).exe
|
||||
debug:
|
||||
$(CXX) ./som_graph.cpp ./som.cpp /MDd /Od /Zi /D _DEBUG $(MYCXXFLAGS) /link tbb_debug.lib $(LIBS) $(MYLDFLAGS) /OUT:$(PROG).exe
|
||||
profile:
|
||||
$(CXX) ./som_graph.cpp ./som.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)
|
||||
|
391
cs440-acg/ext/tbb/examples/graph/som/readme.html
Normal file
391
cs440-acg/ext/tbb/examples/graph/som/readme.html
Normal file
@@ -0,0 +1,391 @@
|
||||
<!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® Threading Building Blocks. Self-Organizing Map (SOM) sample</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="banner">
|
||||
<img class="logo" src="data:image/png;base64,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
|
||||
9Or1LzUmVVz+HJXDAAAAAElFTkSuQmCC">
|
||||
<h1 class="title">Intel® Threading Building Blocks.<br>Self-Organizing Map (SOM) sample</h1>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The Self-Organizing Map demonstrates tbb::flow and the use of cancellation in scheduling multiple iterations of
|
||||
map updates.
|
||||
<br><br>
|
||||
For tutorials on Self-organizing Maps, see <a href="http://www.ai-junkie.com/ann/som/som1.html">here</a> and
|
||||
<a href="http://davis.wpi.edu/~matt/courses/soms/">here</a>.
|
||||
<br><br>
|
||||
The program trains the map with several examples, splitting the map into subsections and looking for best-match
|
||||
for multiple examples. When an example is used to update the map, the graphs examining the sections being
|
||||
updated for the next example are cancelled and restarted after the update.
|
||||
</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="som_graph.cpp">som_graph.cpp</a>
|
||||
<dd>The main program.
|
||||
<dt><a href="som.cpp">som.cpp</a>
|
||||
<dd>Utilities for handling the map.
|
||||
<dt><a href="som.h">som.h</a>
|
||||
<dd>Definitions and utilities.
|
||||
<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>© 2020, Intel Corporation
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
213
cs440-acg/ext/tbb/examples/graph/som/som.cpp
Normal file
213
cs440-acg/ext/tbb/examples/graph/som/som.cpp
Normal file
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
//
|
||||
// Self-organizing map in TBB flow::graph
|
||||
//
|
||||
// we will do a color map (the simple example.)
|
||||
//
|
||||
// serial algorithm
|
||||
//
|
||||
// initialize map with vectors (could be random, gradient, or something else)
|
||||
// for some number of iterations
|
||||
// update radius r, weight of change L
|
||||
// for each example V
|
||||
// find the best matching unit
|
||||
// for each part of map within radius of BMU W
|
||||
// update vector: W(t+1) = W(t) + w(dist)*L*(V - W(t))
|
||||
|
||||
#include "som.h"
|
||||
#include "tbb/task.h"
|
||||
|
||||
std::ostream& operator<<( std::ostream &out, const SOM_element &s) {
|
||||
out << "(";
|
||||
for(int i=0;i<(int)s.w.size();++i) {
|
||||
out << s.w[i];
|
||||
if(i < (int)s.w.size()-1) {
|
||||
out << ",";
|
||||
}
|
||||
}
|
||||
out << ")";
|
||||
return out;
|
||||
}
|
||||
|
||||
void remark_SOM_element(const SOM_element &s) {
|
||||
printf("(");
|
||||
for(int i=0;i<(int)s.w.size();++i) {
|
||||
printf("%g",s.w[i]);
|
||||
if(i < (int)s.w.size()-1) {
|
||||
printf(",");
|
||||
}
|
||||
}
|
||||
printf(")");
|
||||
}
|
||||
|
||||
std::ostream& operator<<( std::ostream &out, const search_result_type &s) {
|
||||
out << "<";
|
||||
out << get<RADIUS>(s);
|
||||
out << ", " << get<XV>(s);
|
||||
out << ", ";
|
||||
out << get<YV>(s);
|
||||
out << ">";
|
||||
return out;
|
||||
}
|
||||
|
||||
void remark_search_result_type(const search_result_type &s) {
|
||||
printf("<%g,%d,%d>", get<RADIUS>(s), get<XV>(s), get<YV>(s));
|
||||
}
|
||||
|
||||
double
|
||||
randval( double lowlimit, double highlimit) {
|
||||
return double(rand()) / double(RAND_MAX) * (highlimit - lowlimit) + lowlimit;
|
||||
}
|
||||
|
||||
void
|
||||
find_data_ranges(teaching_vector_type &teaching, SOM_element &max_range, SOM_element &min_range ) {
|
||||
if(teaching.size() == 0) return;
|
||||
max_range = min_range = teaching[0];
|
||||
for(int i = 1; i < (int)teaching.size(); ++i) {
|
||||
max_range.elementwise_max(teaching[i]);
|
||||
min_range.elementwise_min(teaching[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void add_fraction_of_difference( SOM_element &to, SOM_element const &from, double frac) {
|
||||
for(int i = 0; i < (int)from.size(); ++i) {
|
||||
to[i] += frac*(from[i] - to[i]);
|
||||
}
|
||||
}
|
||||
|
||||
double
|
||||
distance_squared(SOM_element x, SOM_element y) {
|
||||
double rval = 0.0; for(int i=0;i<(int)x.size();++i) {
|
||||
double diff = x[i] - y[i];
|
||||
rval += diff*diff;
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
void SOMap::initialize(InitializeType it, SOM_element &max_range, SOM_element &min_range) {
|
||||
for(int x = 0; x < xMax; ++x) {
|
||||
for(int y = 0; y < yMax; ++y) {
|
||||
for( int i = 0; i < (int)max_range.size(); ++i) {
|
||||
if(it == InitializeRandom) {
|
||||
my_map[x][y][i] = (randval(min_range[i], max_range[i]));
|
||||
}
|
||||
else if(it == InitializeGradient) {
|
||||
my_map[x][y][i] = ((double)(x+y)/(xMax+yMax)*(max_range[i]-min_range[i]) + min_range[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// subsquare [low,high)
|
||||
double
|
||||
SOMap::BMU_range( const SOM_element &s, int &xval, int &yval, subsquare_type &r) {
|
||||
double min_distance_squared = DBL_MAX;
|
||||
task &my_task = task::self();
|
||||
int min_x = -1;
|
||||
int min_y = -1;
|
||||
for(int x = r.rows().begin(); x != r.rows().end(); ++x) {
|
||||
for( int y = r.cols().begin(); y != r.cols().end(); ++y) {
|
||||
double dist = distance_squared(s,my_map[x][y]);
|
||||
if(dist < min_distance_squared) {
|
||||
min_distance_squared = dist;
|
||||
min_x = x;
|
||||
min_y = y;
|
||||
}
|
||||
if(cancel_test && my_task.is_cancelled()) {
|
||||
xval = r.rows().begin();
|
||||
yval = r.cols().begin();
|
||||
return DBL_MAX;
|
||||
}
|
||||
}
|
||||
}
|
||||
xval = min_x;
|
||||
yval = min_y;
|
||||
return sqrt(min_distance_squared);
|
||||
}
|
||||
|
||||
void
|
||||
SOMap::epoch_update_range( SOM_element const &s, int epoch, int min_x, int min_y, double radius, double learning_rate, blocked_range<int> &r) {
|
||||
int min_xiter = (int)((double)min_x - radius);
|
||||
if(min_xiter < 0) min_xiter = 0;
|
||||
int max_xiter = (int)((double)min_x + radius);
|
||||
if(max_xiter > (int)my_map.size()-1) max_xiter = (int)my_map.size()-1;
|
||||
for(int xx = r.begin(); xx <= r.end(); ++xx) {
|
||||
double xrsq = (xx-min_x)*(xx-min_x);
|
||||
double ysq = radius*radius - xrsq; // max extent of y influence
|
||||
double yd;
|
||||
if(ysq > 0) {
|
||||
yd = sqrt(ysq);
|
||||
int lb = (int)(min_y - yd);
|
||||
int ub = (int)(min_y + yd);
|
||||
for(int yy = lb; yy < ub; ++yy) {
|
||||
if(yy >= 0 && yy < (int)my_map[xx].size()) {
|
||||
// [xx, yy] is in the range of the update.
|
||||
double my_rsq = xrsq + (yy-min_y)*(yy-min_y); // distance from BMU squared
|
||||
double theta = exp(-(radius*radius) /(2.0* my_rsq));
|
||||
add_fraction_of_difference(my_map[xx][yy], s, theta * learning_rate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SOMap::teach(teaching_vector_type &in) {
|
||||
for(int i = 0; i < nPasses; ++i ) {
|
||||
int j = (int)(randval(0, (double)in.size())); // this won't be reproducible.
|
||||
if(j == in.size()) --j;
|
||||
|
||||
int min_x = -1;
|
||||
int min_y = -1;
|
||||
subsquare_type br2(0, (int)my_map.size(), 1, 0, (int)my_map[0].size(), 1);
|
||||
(void) BMU_range(in[j],min_x, min_y, br2); // just need min_x, min_y
|
||||
// radius of interest
|
||||
double radius = max_radius * exp(-(double)i*radius_decay_rate);
|
||||
// update circle is min_xiter to max_xiter inclusive.
|
||||
double learning_rate = max_learning_rate * exp( -(double)i * learning_decay_rate);
|
||||
epoch_update(in[j], i, min_x, min_y, radius, learning_rate);
|
||||
}
|
||||
}
|
||||
|
||||
void SOMap::debug_output() {
|
||||
printf("SOMap:\n");
|
||||
for(int i = 0; i < (int)(this->my_map.size()); ++i) {
|
||||
for(int j = 0; j < (int)(this->my_map[i].size()); ++j) {
|
||||
printf( "map[%d, %d] == ", i, j );
|
||||
remark_SOM_element( this->my_map[i][j] );
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define RED 0
|
||||
#define GREEN 1
|
||||
#define BLUE 2
|
||||
|
||||
void readInputData() {
|
||||
my_teaching.push_back(SOM_element());
|
||||
my_teaching.push_back(SOM_element());
|
||||
my_teaching.push_back(SOM_element());
|
||||
my_teaching.push_back(SOM_element());
|
||||
my_teaching.push_back(SOM_element());
|
||||
my_teaching[0][RED] = 1.0; my_teaching[0][GREEN] = 0.0; my_teaching[0][BLUE] = 0.0;
|
||||
my_teaching[1][RED] = 0.0; my_teaching[1][GREEN] = 1.0; my_teaching[1][BLUE] = 0.0;
|
||||
my_teaching[2][RED] = 0.0; my_teaching[2][GREEN] = 0.0; my_teaching[2][BLUE] = 1.0;
|
||||
my_teaching[3][RED] = 0.3; my_teaching[3][GREEN] = 0.3; my_teaching[3][BLUE] = 0.0;
|
||||
my_teaching[4][RED] = 0.5; my_teaching[4][GREEN] = 0.5; my_teaching[4][BLUE] = 0.9;
|
||||
}
|
157
cs440-acg/ext/tbb/examples/graph/som/som.h
Normal file
157
cs440-acg/ext/tbb/examples/graph/som/som.h
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
//
|
||||
// Self-organizing map
|
||||
//
|
||||
// support for self-ordering maps
|
||||
#ifndef __SOM_H__
|
||||
#define __SOM_H__
|
||||
|
||||
#include <vector>
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#include <cfloat>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
#include "tbb/flow_graph.h"
|
||||
#include "tbb/blocked_range2d.h"
|
||||
|
||||
using namespace tbb;
|
||||
using namespace tbb::flow;
|
||||
|
||||
typedef blocked_range2d<int> subsquare_type;
|
||||
typedef tuple<double,int,int> search_result_type;
|
||||
|
||||
std::ostream& operator<<( std::ostream &out, const search_result_type &s);
|
||||
|
||||
#define RADIUS 0 // for the std::gets
|
||||
#define XV 1
|
||||
#define YV 2
|
||||
|
||||
// to have single definitions of static variables, define _MAIN_C_ in the main program
|
||||
//
|
||||
#ifdef _MAIN_C_
|
||||
#define DEFINE // nothing
|
||||
#define INIT(n) = n
|
||||
#else // not in main file
|
||||
#define DEFINE extern
|
||||
#define INIT(n) // nothing
|
||||
#endif // _MAIN_C_
|
||||
|
||||
DEFINE int nElements INIT(3); // length of input vectors, matching vector in map
|
||||
DEFINE double max_learning_rate INIT(0.8); // decays exponentially
|
||||
DEFINE double radius_decay_rate;
|
||||
DEFINE double learning_decay_rate INIT(0.005);
|
||||
DEFINE double max_radius;
|
||||
DEFINE bool extra_debug INIT(false);
|
||||
DEFINE bool cancel_test INIT(false);
|
||||
|
||||
DEFINE int xMax INIT(100);
|
||||
DEFINE int yMax INIT(100);
|
||||
DEFINE int nPasses INIT(100);
|
||||
|
||||
enum InitializeType { InitializeRandom, InitializeGradient };
|
||||
#define RED 0
|
||||
#define GREEN 1
|
||||
#define BLUE 2
|
||||
class SOM_element;
|
||||
void remark_SOM_element(const SOM_element &s);
|
||||
|
||||
// all SOM_element vectors are the same length (nElements), so we do not have
|
||||
// to range-check the vector accesses.
|
||||
class SOM_element {
|
||||
std::vector<double> w;
|
||||
public:
|
||||
friend std::ostream& operator<<( std::ostream &out, const SOM_element &s);
|
||||
friend void remark_SOM_element(const SOM_element &s);
|
||||
SOM_element() : w(nElements,0.0) {}
|
||||
double &operator[](int indx) { return w.at(indx); }
|
||||
const double &operator[](int indx) const { return w.at(indx); }
|
||||
bool operator==(SOM_element const &other) const {
|
||||
for(size_t i=0;i<size();++i) {
|
||||
if(w[i] != other.w[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool operator!=(SOM_element const &other) const { return !operator==(other); }
|
||||
void elementwise_max(SOM_element const &other) {
|
||||
for(size_t i = 0; i < w.size(); ++i) if(w[i] < other.w[i]) w[i] = other.w[i];
|
||||
}
|
||||
void elementwise_min(SOM_element const &other) {
|
||||
for(size_t i = 0; i < w.size(); ++i) if(w[i] > other.w[i]) w[i] = other.w[i];
|
||||
}
|
||||
size_t size() const { return w.size(); }
|
||||
};
|
||||
|
||||
typedef std::vector<SOM_element> teaching_vector_type;
|
||||
|
||||
DEFINE SOM_element max_range;
|
||||
DEFINE SOM_element min_range;
|
||||
|
||||
extern double randval( double lowlimit, double highlimit);
|
||||
|
||||
extern void find_data_ranges(teaching_vector_type &teaching, SOM_element &max_range, SOM_element &min_range );
|
||||
|
||||
extern void add_fraction_of_difference( SOM_element &to, SOM_element &from, double frac);
|
||||
|
||||
DEFINE teaching_vector_type my_teaching;
|
||||
|
||||
class SOMap {
|
||||
std::vector< std::vector< SOM_element > > my_map;
|
||||
public:
|
||||
SOMap(int xSize, int ySize) {
|
||||
my_map.reserve(xSize);
|
||||
for(int i = 0; i < xSize; ++i) {
|
||||
my_map.push_back(teaching_vector_type());
|
||||
my_map[i].reserve(ySize);
|
||||
for(int j = 0; j < ySize;++j) {
|
||||
my_map[i].push_back(SOM_element());
|
||||
}
|
||||
}
|
||||
}
|
||||
size_t size() { return my_map.size(); }
|
||||
void initialize(InitializeType it, SOM_element &max_range, SOM_element &min_range);
|
||||
teaching_vector_type &operator[](int indx) { return my_map[indx]; }
|
||||
SOM_element &at(int xVal, int yVal) { return my_map[xVal][yVal]; }
|
||||
SOM_element &at(search_result_type const &s) { return my_map[flow::get<1>(s)][flow::get<2>(s)]; }
|
||||
void epoch_update( SOM_element const &s, int epoch, int min_x, int min_y, double radius, double learning_rate) {
|
||||
int min_xiter = (int)((double)min_x - radius);
|
||||
if(min_xiter < 0) min_xiter = 0;
|
||||
int max_xiter = (int)((double)min_x + radius);
|
||||
if(max_xiter > (int)my_map.size()-1) max_xiter = (int)(my_map.size()-1);
|
||||
blocked_range<int> br1(min_xiter, max_xiter, 1);
|
||||
epoch_update_range(s, epoch, min_x, min_y, radius, learning_rate, br1);
|
||||
}
|
||||
void epoch_update_range( SOM_element const &s, int epoch, int min_x, int min_y, double radius, double learning_rate, blocked_range<int> &r);
|
||||
void teach( teaching_vector_type &id);
|
||||
void debug_output();
|
||||
// find BMU given an input, returns distance
|
||||
double BMU_range(const SOM_element &s, int &xval, int &yval, subsquare_type &r);
|
||||
double BMU(const SOM_element &s, int &xval, int &yval) {
|
||||
subsquare_type br(0,(int)my_map.size(),1,0,(int)my_map[0].size(),1);
|
||||
return BMU_range(s, xval, yval, br);
|
||||
}
|
||||
};
|
||||
|
||||
extern double distance_squared(SOM_element x, SOM_element y);
|
||||
void remark_SOM_element(const SOM_element &s);
|
||||
|
||||
extern void readInputData();
|
||||
#endif // __SOM_H__
|
429
cs440-acg/ext/tbb/examples/graph/som/som_graph.cpp
Normal file
429
cs440-acg/ext/tbb/examples/graph/som/som_graph.cpp
Normal file
@@ -0,0 +1,429 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
//
|
||||
// Self-organizing map in TBB flow::graph
|
||||
//
|
||||
// This is an example of the use of cancellation in a graph. After a point in searching for
|
||||
// the best match for an example, two examples are looked for simultaneously. When the
|
||||
// earlier example is found and the update radius is determined, the affected searches
|
||||
// for the subsequent example are cancelled, and after the update they are restarted.
|
||||
// As the update radius shrinks fewer searches are cancelled, and by the last iterations
|
||||
// virtually all the work done for the speculating example is useful.
|
||||
//
|
||||
// first, a simple implementation with only one example vector
|
||||
// at a time.
|
||||
//
|
||||
// we will do a color map (the simple example.)
|
||||
//
|
||||
// graph algorithm
|
||||
//
|
||||
// for some number of iterations
|
||||
// update radius r, weight of change L
|
||||
// for each example V
|
||||
// use graph to find BMU
|
||||
// for each part of map within radius of BMU W
|
||||
// update vector: W(t+1) = W(t) + w(dist)*L*(V - W(t))
|
||||
|
||||
#define _MAIN_C_ 1
|
||||
#include "som.h"
|
||||
|
||||
#include "tbb/flow_graph.h"
|
||||
#include "tbb/blocked_range2d.h"
|
||||
#include "tbb/tick_count.h"
|
||||
#include "tbb/task_arena.h"
|
||||
#include "../../common/utility/utility.h"
|
||||
#include "../../common/utility/get_default_num_threads.h"
|
||||
|
||||
#define RED 0
|
||||
#define GREEN 1
|
||||
#define BLUE 2
|
||||
|
||||
static int xranges = 1;
|
||||
static int yranges = 1;
|
||||
static int xsize = -1;
|
||||
static int ysize = -1;
|
||||
|
||||
static int global_i = 0;
|
||||
static int speculation_start;
|
||||
std::vector<int> function_node_execs;
|
||||
static int xRangeMax = 3;
|
||||
static int yRangeMax = 3;
|
||||
static bool dont_speculate = false;
|
||||
static search_result_type last_update;
|
||||
|
||||
class BMU_search_body {
|
||||
SOMap &my_map;
|
||||
subsquare_type my_square;
|
||||
int &fn_tally;
|
||||
public:
|
||||
BMU_search_body(SOMap &_m, subsquare_type &_sq, int &fnt) : my_map(_m), my_square(_sq), fn_tally(fnt) { }
|
||||
BMU_search_body( const BMU_search_body &other) : my_map(other.my_map), my_square(other.my_square), fn_tally(other.fn_tally) { }
|
||||
search_result_type operator()(const SOM_element s) {
|
||||
int my_x;
|
||||
int my_y;
|
||||
double min_dist = my_map.BMU_range(s, my_x, my_y, my_square);
|
||||
++fn_tally; // count how many times this function_node executed
|
||||
return search_result_type(min_dist, my_x, my_y);
|
||||
}
|
||||
};
|
||||
|
||||
typedef function_node<SOM_element, search_result_type> search_node;
|
||||
typedef broadcast_node<SOM_element> b_node;
|
||||
typedef std::vector< search_node *> search_node_vector_type;
|
||||
typedef std::vector< search_node_vector_type > search_node_array_type;
|
||||
typedef std::vector< graph *> graph_vector_type;
|
||||
typedef std::vector< graph_vector_type > graph_array_type;
|
||||
|
||||
#define SPECULATION_CNT 2
|
||||
|
||||
graph *g[SPECULATION_CNT]; // main graph; there should only be one per epoch
|
||||
b_node *send_to[SPECULATION_CNT]; // broadcast node to send exemplar to all function_nodes
|
||||
queue_node<search_result_type> *q[SPECULATION_CNT]; // queue for function nodes to put their results in
|
||||
// each function_node should have its own graph
|
||||
search_node_array_type* s_array[SPECULATION_CNT]; // 2d array of function nodes
|
||||
graph_array_type* g_array[SPECULATION_CNT]; // 2d array of graphs
|
||||
|
||||
// All graphs must locate in the same arena.
|
||||
graph* construct_graph(task_arena& ta) {
|
||||
graph* result;
|
||||
ta.execute([&result]{result = new graph;});
|
||||
return result;
|
||||
}
|
||||
|
||||
// build a set of SPECULATION_CNT graphs, each of which consists of a broadcast_node,
|
||||
// xranges x yranges function_nodes, and one queue_node for output.
|
||||
// once speculation starts, if i % SPECULATION_CNT is the current graph, (i+1) % SPECULATION_CNT
|
||||
// is the first speculation, and so on.
|
||||
void
|
||||
build_BMU_graph(SOMap &map1, task_arena& ta) {
|
||||
// build current graph
|
||||
xsize = ((int)map1.size() + xranges - 1) / xranges;
|
||||
ysize = ((int)map1[0].size() + yranges - 1) / yranges;
|
||||
function_node_execs.clear();
|
||||
function_node_execs.reserve(xranges*yranges+1);
|
||||
for(int ii = 0; ii < xranges*yranges+1;++ii) function_node_execs.push_back(0);
|
||||
|
||||
for(int scnt = 0; scnt < SPECULATION_CNT; ++scnt) {
|
||||
g[scnt] = construct_graph(ta);
|
||||
send_to[scnt] = new b_node(*(g[scnt])); // broadcast node to the function_nodes
|
||||
q[scnt] = new queue_node<search_result_type>(*(g[scnt])); // output queue
|
||||
|
||||
// create the function_nodes, tie to the graph
|
||||
s_array[scnt] = new search_node_array_type;
|
||||
s_array[scnt]->reserve(xranges);
|
||||
g_array[scnt] = new graph_array_type;
|
||||
g_array[scnt]->reserve(xranges);
|
||||
for(int i = 0; i < (int)map1.size(); i += xsize) {
|
||||
int xindex = i / xsize;
|
||||
s_array[scnt]->push_back(search_node_vector_type());
|
||||
(*s_array[scnt])[xindex].reserve(yranges);
|
||||
g_array[scnt]->push_back(graph_vector_type());
|
||||
(*g_array[scnt])[xindex].reserve(yranges);
|
||||
for( int j = 0; j < (int)map1[0].size(); j += ysize) {
|
||||
int offset = (i/xsize)*yranges + (j / ysize);
|
||||
int xmax = (i + xsize) > (int)map1.size() ? (int)map1.size() : i + xsize;
|
||||
int ymax = (j + ysize) > (int)map1[0].size() ? (int)map1[0].size() : j + ysize;
|
||||
subsquare_type sst(i,xmax,1,j,ymax,1);
|
||||
BMU_search_body bb(map1,sst,function_node_execs[offset]);
|
||||
graph *g_local = construct_graph(ta);
|
||||
search_node *s = new search_node(*g_local, serial, bb); // copies Body
|
||||
(*g_array[scnt])[xindex].push_back(g_local);
|
||||
(*s_array[scnt])[xindex].push_back(s);
|
||||
make_edge(*(send_to[scnt]), *s); // broadcast_node -> function_node
|
||||
make_edge(*s, *(q[scnt])); // function_node -> queue_node
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for the 2D array of flow::graphs.
|
||||
void wait_for_all_graphs(int cIndex) { // cIndex ranges over [0 .. SPECULATION_CNT - 1]
|
||||
for(int x = 0; x < xranges; ++x) {
|
||||
for(int y = 0; y < yranges; ++y) {
|
||||
(*g_array[cIndex])[x][y]->wait_for_all();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
destroy_BMU_graph() {
|
||||
for(int scnt = 0; scnt < SPECULATION_CNT; ++scnt) {
|
||||
for( int i = 0; i < (int)(*s_array[scnt]).size(); ++i ) {
|
||||
for(int j = 0; j < (int)(*s_array[scnt])[i].size(); ++j) {
|
||||
delete (*s_array[scnt])[i][j];
|
||||
delete (*g_array[scnt])[i][j];
|
||||
}
|
||||
}
|
||||
(*s_array[scnt]).clear();
|
||||
delete s_array[scnt];
|
||||
(*g_array[scnt]).clear();
|
||||
delete g_array[scnt];
|
||||
delete q[scnt];
|
||||
delete send_to[scnt];
|
||||
delete g[scnt];
|
||||
}
|
||||
}
|
||||
|
||||
void find_subrange_overlap(int const &xval, int const &yval, double const &radius, int &xlow, int &xhigh, int &ylow, int &yhigh) {
|
||||
xlow = int((xval-radius)/xsize);
|
||||
xhigh = int((xval+radius)/xsize);
|
||||
ylow = int((yval-radius)/ysize);
|
||||
yhigh = int((yval+radius)/ysize);
|
||||
// circle may fall partly outside map
|
||||
if(xlow < 0) xlow = 0;
|
||||
if(xhigh >= xranges) xhigh = xranges - 1;
|
||||
if(ylow < 0) ylow = 0;
|
||||
if(yhigh >= yranges) yhigh = yranges - 1;
|
||||
}
|
||||
|
||||
bool overlap( int &xval, int &yval, search_result_type &sr) {
|
||||
int xlow, xhigh, ylow, yhigh;
|
||||
find_subrange_overlap(get<XV>(sr), get<YV>(sr), get<RADIUS>(sr), xlow, xhigh, ylow, yhigh);
|
||||
return xval >= xlow && xval <= xhigh && yval >= ylow && yval <= yhigh;
|
||||
}
|
||||
|
||||
void
|
||||
cancel_submaps(int &xval, int &yval, double &radius, int indx) {
|
||||
int xlow;
|
||||
int xhigh;
|
||||
int ylow;
|
||||
int yhigh;
|
||||
find_subrange_overlap(xval, yval, radius, xlow, xhigh, ylow, yhigh);
|
||||
for(int x = xlow; x <= xhigh; ++x) {
|
||||
for(int y = ylow; y <= yhigh; ++y) {
|
||||
(*g_array[indx])[x][y]->root_task()->cancel_group_execution();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
restart_submaps(int &xval, int &yval, double &radius, int indx, SOM_element &vector) {
|
||||
int xlow;
|
||||
int xhigh;
|
||||
int ylow;
|
||||
int yhigh;
|
||||
find_subrange_overlap(xval, yval, radius, xlow, xhigh, ylow, yhigh);
|
||||
for(int x = xlow; x <= xhigh; ++x) {
|
||||
for(int y = ylow; y <= yhigh; ++y) {
|
||||
// have to reset the graph
|
||||
(*g_array[indx])[x][y]->root_task()->context()->reset();
|
||||
// and re-submit the exemplar for search.
|
||||
(*s_array[indx])[x][y]->try_put(vector);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
search_result_type
|
||||
graph_BMU( int indx ) { // indx ranges over [0 .. SPECULATION_CNT -1]
|
||||
wait_for_all_graphs(indx); // wait for the array of subgraphs
|
||||
(g[indx])->wait_for_all();
|
||||
std::vector<search_result_type> all_srs(xRangeMax*yRangeMax,search_result_type(DBL_MAX,-1,-1));
|
||||
search_result_type sr;
|
||||
search_result_type min_sr;
|
||||
get<RADIUS>(min_sr) = DBL_MAX;
|
||||
int result_count = 0;
|
||||
while((q[indx])->try_get(sr)) {
|
||||
++result_count;
|
||||
// figure which submap this came from
|
||||
int x = get<XV>(sr) / xsize;
|
||||
int y = get<YV>(sr) / ysize;
|
||||
int offset = x*yranges+y; // linearized subscript
|
||||
all_srs[offset] = sr;
|
||||
if(get<RADIUS>(sr) < get<RADIUS>(min_sr))
|
||||
min_sr = sr;
|
||||
else if(get<RADIUS>(sr) == get<RADIUS>(min_sr)) {
|
||||
if(get<XV>(sr) < get<XV>(min_sr)) {
|
||||
min_sr = sr;
|
||||
}
|
||||
else if((get<XV>(sr) == get<XV>(min_sr) &&
|
||||
get<YV>(sr) < get<YV>(min_sr)))
|
||||
{
|
||||
min_sr = sr;
|
||||
}
|
||||
}
|
||||
}
|
||||
return min_sr;
|
||||
// end of one epoch
|
||||
}
|
||||
|
||||
void graph_teach(SOMap &map1, teaching_vector_type &in, task_arena& ta) {
|
||||
build_BMU_graph(map1, ta);
|
||||
// normally the training would pick random exemplars to teach the SOM. We need
|
||||
// the process to be reproducible, so we will pick the exemplars in order, [0, in.size())
|
||||
int next_j = 0;
|
||||
for(int epoch = 0; epoch < nPasses; ++epoch) {
|
||||
global_i = epoch;
|
||||
bool canceled_submaps = false;
|
||||
int j = next_j; // try to make reproducible
|
||||
next_j = (epoch+1) % in.size();
|
||||
search_result_type min_sr;
|
||||
if(epoch < speculation_start) {
|
||||
(send_to[epoch%SPECULATION_CNT])->try_put(in[j]);
|
||||
}
|
||||
else if(epoch == speculation_start) {
|
||||
(send_to[epoch%SPECULATION_CNT])->try_put(in[j]);
|
||||
if(epoch < nPasses-1) {
|
||||
(send_to[(epoch+1)%SPECULATION_CNT])->try_put(in[next_j]);
|
||||
}
|
||||
}
|
||||
else if(epoch < nPasses - 1) {
|
||||
(send_to[(epoch+1)%SPECULATION_CNT])->try_put(in[next_j]);
|
||||
}
|
||||
min_sr = graph_BMU(epoch % SPECULATION_CNT); //calls wait_for_all()
|
||||
double min_distance = get<0>(min_sr);
|
||||
double radius = max_radius * exp(-(double)epoch*radius_decay_rate);
|
||||
double learning_rate = max_learning_rate * exp(-(double)epoch * learning_decay_rate);
|
||||
if(epoch >= speculation_start && epoch < (nPasses - 1)) {
|
||||
// have to cancel the affected submaps
|
||||
cancel_submaps(get<XV>(min_sr), get<YV>(min_sr), radius, (epoch+1)%SPECULATION_CNT);
|
||||
canceled_submaps = true;
|
||||
}
|
||||
map1.epoch_update(in[j], epoch, get<1>(min_sr), get<2>(min_sr), radius, learning_rate);
|
||||
++global_i;
|
||||
if(canceled_submaps) {
|
||||
// do I have to wait for all the non-canceled speculative graph to complete first?
|
||||
// yes, in case a canceled task was already executing.
|
||||
wait_for_all_graphs((epoch+1) % SPECULATION_CNT); // wait for the array of subgraphs
|
||||
restart_submaps(get<1>(min_sr), get<2>(min_sr), radius, (epoch+1)%SPECULATION_CNT, in[next_j]);
|
||||
}
|
||||
|
||||
last_update = min_sr;
|
||||
get<RADIUS>(last_update) = radius; // not smallest value, but range of effect
|
||||
}
|
||||
destroy_BMU_graph();
|
||||
}
|
||||
|
||||
static const double serial_time_adjust = 1.25;
|
||||
static double radius_fraction = 3.0;
|
||||
|
||||
int
|
||||
main(int argc, char** argv) {
|
||||
int l_speculation_start;
|
||||
utility::thread_number_range threads(
|
||||
utility::get_default_num_threads,
|
||||
utility::get_default_num_threads() // run only the default number of threads if none specified
|
||||
);
|
||||
|
||||
utility::parse_cli_arguments(argc,argv,
|
||||
utility::cli_argument_pack()
|
||||
//"-h" option for for displaying help is present implicitly
|
||||
.positional_arg(threads,"n-of-threads","number of threads to use; a range of the form low[:high], where low and optional high are non-negative integers or 'auto' for the TBB default.")
|
||||
// .positional_arg(InputFileName,"input-file","input file name")
|
||||
// .positional_arg(OutputFileName,"output-file","output file name")
|
||||
.positional_arg(radius_fraction, "radius-fraction","size of radius at which to start speculating")
|
||||
.positional_arg(nPasses, "number-of-epochs","number of examples used in learning phase")
|
||||
.arg(cancel_test, "cancel-test", "test for cancel signal while finding BMU")
|
||||
.arg(extra_debug, "debug", "additional output")
|
||||
.arg(dont_speculate,"nospeculate","don't speculate in SOM map teaching")
|
||||
);
|
||||
|
||||
readInputData();
|
||||
max_radius = (xMax < yMax) ? yMax / 2 : xMax / 2;
|
||||
// need this value for the 1x1 timing below
|
||||
radius_decay_rate = -(log(1.0/(double)max_radius) / (double)nPasses);
|
||||
find_data_ranges(my_teaching, max_range, min_range );
|
||||
if(extra_debug) {
|
||||
printf( "Data range: ");
|
||||
remark_SOM_element(min_range);
|
||||
printf( " to ");
|
||||
remark_SOM_element(max_range);
|
||||
printf( "\n");
|
||||
}
|
||||
|
||||
// find how much time is taken for the single function_node case.
|
||||
// adjust nPasses so the 1x1 time is somewhere around serial_time_adjust seconds.
|
||||
// make sure the example test runs for at least 0.5 second.
|
||||
for(;;) {
|
||||
// Restrict max concurrency level via task_arena interface
|
||||
task_arena ta(1);
|
||||
SOMap map1(xMax,yMax);
|
||||
speculation_start = nPasses + 1; // Don't speculate
|
||||
|
||||
xranges = 1;
|
||||
yranges = 1;
|
||||
map1.initialize(InitializeGradient, max_range, min_range);
|
||||
tick_count t0 = tick_count::now();
|
||||
graph_teach(map1, my_teaching, ta);
|
||||
tick_count t1 = tick_count::now();
|
||||
double nSeconds = (t1-t0).seconds();
|
||||
if(nSeconds < 0.5) {
|
||||
xMax *= 2;
|
||||
yMax *= 2;
|
||||
continue;
|
||||
}
|
||||
double size_adjust = sqrt(serial_time_adjust / nSeconds);
|
||||
xMax = (int)((double)xMax * size_adjust);
|
||||
yMax = (int)((double)yMax * size_adjust);
|
||||
max_radius = (xMax < yMax) ? yMax / 2 : xMax / 2;
|
||||
radius_decay_rate = log((double)max_radius) / (double)nPasses;
|
||||
|
||||
if(extra_debug) {
|
||||
printf("original 1x1 case ran in %g seconds\n", nSeconds);
|
||||
printf(" Size of table == %d x %d\n", xMax, yMax);
|
||||
printf(" radius_decay_rate == %g\n", radius_decay_rate);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// the "max_radius" starts at 1/2*radius_fraction the table size. To start the speculation when the radius is
|
||||
// 1 / n * the table size, the constant in the log below should be n / 2. so 2 == 1/4, 3 == 1/6th,
|
||||
// et c.
|
||||
if(dont_speculate) {
|
||||
l_speculation_start = nPasses + 1;
|
||||
if ( extra_debug )printf("speculation will not be done\n");
|
||||
}
|
||||
else {
|
||||
if(radius_fraction < 1.0 ) {
|
||||
if ( extra_debug )printf("Warning: radius_fraction should be >= 1. Setting to 1.\n");
|
||||
radius_fraction = 1.0;
|
||||
}
|
||||
l_speculation_start = (int)((double)nPasses * log(radius_fraction) / log((double)nPasses));
|
||||
if ( extra_debug )printf( "We will start speculation at iteration %d\n", l_speculation_start );
|
||||
}
|
||||
double single_time; // for speedup calculations
|
||||
for(int p = threads.first; p <= threads.last; ++p) {
|
||||
// Restrict max concurrency level via task_arena interface
|
||||
task_arena ta(p);
|
||||
if ( extra_debug )printf( " -------------- Running with %d threads. ------------\n", p);
|
||||
// run the SOM build for a series of subranges
|
||||
for(xranges = 1; xranges <= xRangeMax; ++xranges) {
|
||||
for(yranges = xranges; yranges <= yRangeMax; ++yranges) {
|
||||
if(xranges == 1 && yranges == 1) {
|
||||
// don't pointlessly speculate if we're only running one subrange.
|
||||
speculation_start = nPasses + 1;
|
||||
}
|
||||
else {
|
||||
speculation_start = l_speculation_start;
|
||||
}
|
||||
SOMap map1(xMax, yMax);
|
||||
map1.initialize(InitializeGradient, max_range, min_range);
|
||||
|
||||
if(extra_debug) printf( "Start learning for [%d,%d] ----------- \n", xranges,yranges);
|
||||
tick_count t0 = tick_count::now();
|
||||
graph_teach(map1, my_teaching, ta);
|
||||
tick_count t1 = tick_count::now();
|
||||
|
||||
if ( extra_debug )printf( "Done learning for [%d,%d], which took %g seconds ", xranges,yranges, (t1-t0).seconds());
|
||||
if(xranges == 1 && yranges == 1) single_time = (t1-t0).seconds();
|
||||
if ( extra_debug )printf( ": speedup == %g\n", single_time / (t1-t0).seconds());
|
||||
|
||||
} // yranges
|
||||
} // xranges
|
||||
} // #threads p
|
||||
printf("done\n");
|
||||
return 0;
|
||||
}
|
@@ -0,0 +1,314 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
522FF8DD11F573FC00A587B2 /* som_graph.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 522FF8DB11F573FC00A587B2 /* som_graph.cpp */; };
|
||||
522FF8DE11F573FC00A587B2 /* som.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 522FF8DC11F573FC00A587B2 /* som.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXBuildRule section */
|
||||
C3C58957218B643900DAC94C /* 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 */
|
||||
522FF8DB11F573FC00A587B2 /* som_graph.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = som_graph.cpp; path = ../som_graph.cpp; sourceTree = SOURCE_ROOT; };
|
||||
522FF8DC11F573FC00A587B2 /* som.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = som.cpp; path = ../som.cpp; sourceTree = SOURCE_ROOT; };
|
||||
8DD76F6C0486A84900D96B5E /* som */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = som; 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 /* som */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
08FB7795FE84155DC02AAC07 /* Source */,
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */,
|
||||
);
|
||||
name = som;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
08FB7795FE84155DC02AAC07 /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
522FF8DB11F573FC00A587B2 /* som_graph.cpp */,
|
||||
522FF8DC11F573FC00A587B2 /* som.cpp */,
|
||||
);
|
||||
name = Source;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DD76F6C0486A84900D96B5E /* som */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
8DD76F620486A84900D96B5E /* som */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "som" */;
|
||||
buildPhases = (
|
||||
8DD76F640486A84900D96B5E /* Sources */,
|
||||
8DD76F660486A84900D96B5E /* Frameworks */,
|
||||
8DD76F690486A84900D96B5E /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
C3C58957218B643900DAC94C /* PBXBuildRule */,
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = som;
|
||||
productInstallPath = "$(HOME)/bin";
|
||||
productName = som;
|
||||
productReference = 8DD76F6C0486A84900D96B5E /* som */;
|
||||
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 "som" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 08FB7794FE84155DC02AAC07 /* som */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
8DD76F620486A84900D96B5E /* som */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
8DD76F640486A84900D96B5E /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
522FF8DD11F573FC00A587B2 /* som_graph.cpp in Sources */,
|
||||
522FF8DE11F573FC00A587B2 /* som.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_PREPROCESSOR_DEFINITIONS = _CONSOLE;
|
||||
GCC_VERSION = "";
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
ICC_CXX_LANG_DIALECT = "c++11";
|
||||
INSTALL_PATH = "$(HOME)/bin";
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
PRODUCT_NAME = som;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Debug64;
|
||||
};
|
||||
A1F593C70B8F0E6E00073279 /* Release64 */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = _CONSOLE;
|
||||
GCC_VERSION = "";
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
ICC_CXX_LANG_DIALECT = "c++11";
|
||||
INSTALL_PATH = "$(HOME)/bin";
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
PRODUCT_NAME = som;
|
||||
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 "som" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
A1F593C60B8F0E6E00073279 /* Debug64 */,
|
||||
A1F593C70B8F0E6E00073279 /* Release64 */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release64;
|
||||
};
|
||||
1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "som" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
A1F593C80B8F0E6E00073279 /* Debug64 */,
|
||||
A1F593C90B8F0E6E00073279 /* Release64 */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release64;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
|
||||
}
|
Reference in New Issue
Block a user