Commit 65ee4b3e authored by Jonathon Duerig's avatar Jonathon Duerig

Removed dead code. Added a comment.

parent 54c4a641
......@@ -8,12 +8,11 @@ export LINK_FLAGS=-g
${CC} ${COMPILE_FLAGS} -c -o tmp/ipassign.o -I${EXTRA_INCLUDE_PATH} -DROUTECALC=\"bin/routecalc\" src/ipassign.cc
${CC} ${COMPILE_FLAGS} -c -o tmp/bitmath.o -I${EXTRA_INCLUDE_PATH} -DROUTECALC=\"bin/routecalc\" src/bitmath.cc
${CC} ${COMPILE_FLAGS} -c -o tmp/Assigner.o -I${EXTRA_INCLUDE_PATH} -DROUTECALC=\"bin/routecalc\" src/Assigner.cc
${CC} ${COMPILE_FLAGS} -c -o tmp/ConservativeAssigner.o -I${EXTRA_INCLUDE_PATH} -DROUTECALC=\"bin/routecalc\" src/ConservativeAssigner.cc
${CC} ${COMPILE_FLAGS} -c -o tmp/HierarchicalAssigner.o -I${EXTRA_INCLUDE_PATH} -DROUTECALC=\"bin/routecalc\" src/HierarchicalAssigner.cc
${CC} ${COMPILE_FLAGS} -c -o tmp/Framework.o -I${EXTRA_INCLUDE_PATH} -DROUTECALC=\"bin/routecalc\" src/Framework.cc
${CC} ${COMPILE_FLAGS} -c -o tmp/coprocess.o -I${EXTRA_INCLUDE_PATH} -DROUTECALC=\"bin/routecalc\" src/coprocess.cc
${CC} ${LINK_FLAGS} -o bin/ipassign -L${EXTRA_LIB_PATH}/ tmp/ipassign.o tmp/bitmath.o tmp/Assigner.o tmp/ConservativeAssigner.o tmp/HierarchicalAssigner.o tmp/Framework.o tmp/coprocess.o -lmetis -lm
${CC} ${LINK_FLAGS} -o bin/ipassign -L${EXTRA_LIB_PATH}/ tmp/ipassign.o tmp/bitmath.o tmp/ConservativeAssigner.o tmp/HierarchicalAssigner.o tmp/Framework.o tmp/coprocess.o -lmetis -lm
#${CC} -o bin/difference src/difference.cc
#${CC} -o bin/add-x src/add-x.cc
......@@ -26,3 +25,4 @@ ${CC} -o bin/graph2single-source src/graph2single-source.cc -lm
${CC} -o bin/single-source src/single-source.cc -lm
${CC} -o bin/route2dist src/route2dist.cc -lm
${CC} -o bin/route2lan src/route2lan.cc -lm
// Assigner.cc
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2003 University of Utah and the Flux Group.
* All rights reserved.
*/
#include "lib.h"
#include "Assigner.h"
Assigner::~Assigner()
{
}
......@@ -61,7 +61,8 @@ public:
// as named temporaries to try to make this conceptually simple.
public:
virtual ~Assigner();
Assigner() {}
virtual ~Assigner() {}
// Create a copy of the current object polymorphically.
virtual std::auto_ptr<Assigner> clone(void) const=0;
......@@ -87,19 +88,6 @@ public:
virtual NodeLookup & getHosts(void)=0;
/* TODO: Remove this when the changes are debugged
// Populate the argument vectors with our state so that routes can
// be calculated. For the explanation of these arguments, see
// Router.h
virtual void graph(std::vector<NodeLookup> & nodeToLevel,
std::vector<MaskTable> & levelMaskSize,
std::vector<PrefixTable> & levelPrefix,
std::vector<LevelLookup> & levelMakeup,
std::vector<int> & lanWeights) const=0;
*/
public:
struct Lan
{
......@@ -124,5 +112,3 @@ private:
};
#endif
......@@ -177,23 +177,6 @@ void ConservativeAssigner::ipAssign(void)
}
/* TODO: Remove this once the new code has been debugged
// If there are disconnected partitions, turn them into different
// partitions.
// m_partitionCount may increase during this loop
int loop = 0;
while (loop < m_partitionCount)
{
// Each time a breadth-first walk from a LAN in a partition fails
// to reach every LAN in that partition, the remainder is slopped
// together into a new partition which is m_partitionCount+1.
// Then m_partitionCount is incremented.
makeConnected(loop);
++loop;
}
*/
// Calculate the list of super-partitions. These are the
// fully-connected subgraphs in the possibly disconnected
// super-graph. There should usually only be one super-partition.
......@@ -336,169 +319,6 @@ Assigner::NodeLookup & ConservativeAssigner::getHosts(void)
return m_nodeToLan;
}
/* TODO: Remove this when changes are debugged
void ConservativeAssigner::graph(vector<Assigner::NodeLookup> & nodeToLevel,
vector<Assigner::MaskTable> & levelMaskSize,
vector<Assigner::PrefixTable> & levelPrefix,
vector<Assigner::LevelLookup> & levelMakeup,
vector<int> & lanWeights) const
{
// we only have two layers of hierarchies with this method (LAN and
// partition), so the first element of all of these vectors will
// represent the LAN level and the second element is the partition layer.
size_t i;
// make sure that the output stuff is in a sane state.
nodeToLevel.clear();
levelMaskSize.clear();
levelPrefix.clear();
levelMakeup.clear();
lanWeights.clear();
// set up the nodeToLan table in the output
nodeToLevel.push_back(m_nodeToLan);
// set up the nodeToPartition table in the output
nodeToLevel.push_back(NodeLookup());
nodeToLevel.back().resize(m_nodeToLan.size());
for (i = 0; i < nodeToLevel.back().size(); ++i)
{
set<size_t> partitions;
for (size_t j = 0; j < m_nodeToLan[i].size(); ++j)
{
partitions.insert(m_lanList[m_nodeToLan[i][j]].partition);
}
(nodeToLevel.back())[i].reserve(partitions.size());
set<size_t>::iterator pos = partitions.begin();
for ( ; pos != partitions.end(); ++pos)
{
(nodeToLevel.back())[i].push_back(*pos);
}
}
nodeToLevel.push_back(NodeLookup());
nodeToLevel.back().resize(m_nodeToLan.size());
for (i = 0; i < nodeToLevel.back().size(); ++i)
{
(nodeToLevel.back())[i].push_back(0);
}
// set up the netmasks. Since we are being conservative, they will
// all be the same.
levelMaskSize.push_back(MaskTable());
levelMaskSize.back().resize(m_lanList.size());
fill(levelMaskSize.back().begin(), levelMaskSize.back().end(),
m_lanMaskSize);
levelMaskSize.push_back(MaskTable());
levelMaskSize.back().resize(m_partitionCount);
fill(levelMaskSize.back().begin(), levelMaskSize.back().end(),
m_netMaskSize);
levelMaskSize.push_back(MaskTable());
levelMaskSize.back().push_back(0);
// set up the prefixes. These are the ip numbers of the LANS and
// partitions, respectively.
levelPrefix.push_back(PrefixTable());
levelPrefix.back().resize(m_lanList.size());
for (i = 0; i < m_lanList.size(); ++i)
{
(levelPrefix.back())[i] = m_lanList[i].ip;
}
levelPrefix.push_back(m_partitionIPList);
levelPrefix.push_back(PrefixTable());
levelPrefix.back().push_back(0);
// set up levelMakeup. This is which nodes make up each LAN and which LANs
// make up each partition in the partition-graph, respectively.
levelMakeup.push_back(LevelLookup());
levelMakeup.back().resize(m_lanList.size());
for (i = 0; i < m_lanList.size(); ++i)
{
(levelMakeup.back())[i] = m_lanList[i].nodes;
}
levelMakeup.push_back(LevelLookup());
levelMakeup.back().resize(m_partitionCount);
for (i = 0; i < m_lanList.size(); ++i)
{
(levelMakeup.back())[m_lanList[i].partition].push_back(i);
}
// Add our super-partitions to the hierarchy. Each super-partition
// is a fully-connected sub-graph in a possibly disconnected
// graph.
levelMakeup.push_back(m_superPartitionList);
// set up the lan weights.
lanWeights.resize(m_lanList.size());
for (size_t i = 0; i < lanWeights.size(); ++i)
{
lanWeights[i] = m_lanList[i].weight;
}
}
*/
/*
void ConservativeAssigner::convert(std::vector<int> & indexes,
std::vector<int> & neighbors,
std::vector<int> & weights) const
{
// ensure that there is no garbage in the output references.
indexes.clear();
neighbors.clear();
weights.clear();
indexes.reserve(m_lanList.size() + 1);
// fill them up with the graph.
// See the METIS manual, section [5.1 Graph Data Structure], page 18
vector<Lan>::const_iterator lanPos = m_lanList.begin();
for ( ; lanPos != m_lanList.end(); ++lanPos)
{
// neighbors.size() is the total number of edges pushed on so
// far. This is one greater than the max index. Which is the
// starting index for that LAN's set of edges.
indexes.push_back(neighbors.size());
convertAddLan(*lanPos, neighbors, weights);
}
indexes.push_back(neighbors.size());
}
// The following two functions are auxilliary to the 'convert' function
// They were seperated out into different functions for conceptual simplicity.
void ConservativeAssigner::convertAddLan(Lan const & lanToAdd,
std::vector<int> & neighbors,
std::vector<int> & weights) const
{
vector<size_t>::const_iterator nodePos = lanToAdd.nodes.begin();
for ( ; nodePos != lanToAdd.nodes.end(); ++nodePos)
{
convertAddNode(lanToAdd, *nodePos, neighbors, weights);
}
}
void ConservativeAssigner::convertAddNode(Lan const & info, int currentNode,
std::vector<int> & neighbors,
std::vector<int> & weights) const
{
vector<size_t>::const_iterator pos = m_nodeToLan[currentNode].begin();
for ( ; pos != m_nodeToLan[currentNode].end(); ++pos)
{
if (*pos != info.number)
{
neighbors.push_back(*pos);
weights.push_back(info.weight + m_lanList[*pos].weight);
}
}
}
*/
int ConservativeAssigner::getBits(int num)
{
return roundUp(log(static_cast<double>(num))/log(2.0));
......@@ -649,80 +469,6 @@ bool ConservativeAssigner::isConnected(int whichPartition)
return num == numInPartition;
}
/* TODO: Remove this when new code is debugged.
void ConservativeAssigner::makeConnected(int whichPartition)
{
// breadth first search.
queue<size_t> nextConnection;
size_t first = 0;
size_t numInPartition = 0;
size_t i = 0;
vector<bool> connected;
connected.resize(m_lanList.size());
// Set all LANs in whichPartition to false. All others to true.
for (i = 0; i < connected.size(); ++i)
{
if (m_lanList[i].partition == whichPartition)
{
connected[i] = false;
first = i;
++numInPartition;
}
else
{
connected[i] = true;
}
}
// Starting with a random LAN in whichPartition, set all neighbors
// to true. Repeat until all connected LANs are true.
nextConnection.push(first);
connected[first] = true;
if (m_lanList.size() > 0)
{
while (!(nextConnection.empty()))
{
size_t current = nextConnection.front();
nextConnection.pop();
for (i = 0; i < m_lanList[current].nodes.size(); ++i)
{
size_t currentNode = m_lanList[current].nodes[i];
for (size_t j = 0; j < m_nodeToLan[currentNode].size(); ++j)
{
size_t destLan = m_nodeToLan[currentNode][j];
if (m_lanList[destLan].partition == whichPartition)
{
if (!(connected[destLan]))
{
connected[destLan] = true;
nextConnection.push(destLan);
}
}
}
}
}
}
// If any LANs are false, put them in a new partition because
// they are not connected.
bool newPartition = false;
for (i = 0; i < connected.size(); ++i)
{
if (!(connected[i]))
{
newPartition = true;
m_lanList[i].partition = m_partitionCount;
}
}
if (newPartition)
{
++m_partitionCount;
}
}
*/
namespace
{
enum TouchedT
......@@ -813,5 +559,3 @@ void ConservativeAssigner::calculateSuperPartitions(void)
}
}
}
......@@ -51,22 +51,6 @@ private:
void populatePartitionTree(size_t partition,
ptree::Branch * tree,
std::vector<ptree::LeafLan> & outLan);
/*
// populate arguments with the METIS graph format
void convert(std::vector<int> & indexes, std::vector<int> & neighbors,
std::vector<int> & weights) const;
// Given a lan, add the appropriate adjacency and weight information
// to arrays.
void convertAddLan(Lan const & lanToAdd, std::vector<int> & neighbors,
std::vector<int> & weights) const;
// Given the number of a node, calculate the adjacencies and weights
// and put them into arrays.
void convertAddNode(Lan const & info, int currentNode,
std::vector<int> & neighbors,
std::vector<int> & weights) const;
*/
// Given a number, how many bits are required to represent up to and
// including that number?
......@@ -119,5 +103,3 @@ private:
};
#endif
......@@ -21,7 +21,7 @@ LIBEXEC_STUFF = ipassign
BIN_STUFF = difference add-x inet2graph brite2graph top2graph
IPASSIGN_OBJECTS = Assigner.o ConservativeAssigner.o Framework.o \
IPASSIGN_OBJECTS = ConservativeAssigner.o Framework.o \
HierarchicalAssigner.o bitmath.o \
coprocess.o ipassign.o
......
......@@ -9,6 +9,9 @@
#ifndef GRAPH_CONVERTER_H_IP_ASSIGN_2
#define GRAPH_CONVERTER_H_IP_ASSIGN_2
// The purpose of GraphConverter is to convert the graph to the
// representation required by METIS.
// GraphConverter uses a GraphData as a representation of the source graph.
// The interface of GraphData must be as follows:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment