From 8bc14514d5dae672f92087fbd33d89d9e54aa13d Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.drung@cloud.ionos.com>
Date: Wed, 11 Nov 2020 10:43:35 +0100
Subject: Fix spelling error of tuple

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
---
 ibdm/ibdm/FatTree.cpp | 170 +++++++++++++++++++++---------------------
 1 file changed, 85 insertions(+), 85 deletions(-)

diff --git a/ibdm/ibdm/FatTree.cpp b/ibdm/ibdm/FatTree.cpp
index b61e5ca..678caff 100644
--- a/ibdm/ibdm/FatTree.cpp
+++ b/ibdm/ibdm/FatTree.cpp
@@ -51,16 +51,16 @@ FatTree Utilities:
 // highest value.
 //
 // The algorithm BFS from an arbitrary leaf switch.
-// It then allocates ID tupples to each switch ID[0..N].
+// It then allocates ID tuples to each switch ID[0..N].
 // Only one digit of the ID is allowed to change when going from
 // switch node to the other.
 //
 // We use the term "index" when we refer to
-// The digit indexed 0 ID[0] in the tupple is the rank number.
+// The digit indexed 0 ID[0] in the tuple is the rank number.
 // Going down the tree the digit that might change is D[from->rank+1]
 // Going up the tee the digit that might change is D[from->rank]
 //
-// During the BFS each node is assigned a tupple the first time it is
+// During the BFS each node is assigned a tuple the first time it is
 // visited. During the BFS we also collect the list of ports that connect to
 // each value of the changing D.
 //
@@ -69,8 +69,8 @@ FatTree Utilities:
 // number of sub hierarchy indexes with the exact same number of ports
 //
 
-// for comparing tupples
-struct FatTreeTuppleLess : public binary_function <vec_byte, vec_byte, bool> {
+// for comparing tuples
+struct FatTreeTupleLess : public binary_function <vec_byte, vec_byte, bool> {
   bool operator()(const vec_byte& x, const vec_byte& y) const {
     if (x.size() > y.size()) return false;
     if (y.size() > x.size()) return true;
@@ -166,15 +166,15 @@ bool FatTreeNode::goingDown(int lid)
   return false;
 }
 
-typedef map< vec_byte, class FatTreeNode, FatTreeTuppleLess > map_tupple_ftnode;
+typedef map< vec_byte, class FatTreeNode, FatTreeTupleLess > map_tuple_ftnode;
 
 class FatTree {
-  // the node tupple is built out of the following:
+  // the node tuple is built out of the following:
   // d[0] = rank
   // d[1..N-1] = ID digits
   IBFabric          *p_fabric;     // The fabric we attach to
-  map_pnode_vec_byte TuppleByNode;
-  map_tupple_ftnode  NodeByTupple;
+  map_pnode_vec_byte TupleByNode;
+  map_tuple_ftnode   NodeByTuple;
   vec_int            LidByIdx;     // store target HCA lid by its index
   unsigned int       N;            // number of levels in the fabric
   map_str_int        IdxByName;
@@ -187,11 +187,11 @@ class FatTree {
   // return NULL if this check is not met or no ranking available
   IBNode *getLowestLevelSwitchNode();
 
-  // get a free tupple given the reference one and the index to change:
-  vec_byte getFreeTupple(vec_byte refTupple, unsigned int changeIdx);
+  // get a free tuple given the reference one and the index to change:
+  vec_byte getFreeTuple(vec_byte refTuple, unsigned int changeIdx);
 
-  // convert tupple to string
-  string getTuppleStr(vec_byte tupple);
+  // convert tuple to string
+  string getTupleStr(vec_byte tuple);
 
   // simply dump out the FatTree data:
   void dump();
@@ -199,7 +199,7 @@ class FatTree {
   // track a connection to remote switch
   int trackConnection(
 		      FatTreeNode *p_ftNode,
-		      vec_byte     tupple,   // the connected node tupple
+		      vec_byte     tuple,    // the connected node tuple
 		      unsigned int rank,     // rank of the local node
 		      unsigned int remRank,  // rank of the remote node
 		      unsigned int portNum,  // the port number connecting to the remote node
@@ -249,9 +249,9 @@ public:
 
 FatTreeNode* FatTree::getFatTreeNodeByNode(IBNode *p_node) {
   FatTreeNode* p_ftNode;
-  vec_byte tupple(N, 0);
-  tupple = TuppleByNode[p_node];
-  p_ftNode = &NodeByTupple[tupple];
+  vec_byte tuple(N, 0);
+  tuple = TupleByNode[p_node];
+  p_ftNode = &NodeByTuple[tuple];
   return p_ftNode;
 }
 
@@ -310,31 +310,31 @@ IBNode *FatTree::getLowestLevelSwitchNode()
   return(p_leafSwitch);
 }
 
-// get a free tupple given the reference one and the index to change:
+// get a free tuple given the reference one and the index to change:
 // also track the max digit allocated per index
-vec_byte FatTree::getFreeTupple(vec_byte refTupple, unsigned int changeIdx)
+vec_byte FatTree::getFreeTuple(vec_byte refTuple, unsigned int changeIdx)
 {
-  vec_byte res = refTupple;
+  vec_byte res = refTuple;
   int rank = changeIdx - 1;
   for (uint8_t i = 0; i < 255; i++)
     {
       res[changeIdx] = i;
-      map_tupple_ftnode::const_iterator tI = NodeByTupple.find(res);
-      if (tI == NodeByTupple.end())
+      map_tuple_ftnode::const_iterator tI = NodeByTuple.find(res);
+      if (tI == NodeByTuple.end())
 	return res;
     }
-  cout << "ABORT: fail to get free tupple! (in 255 indexies)" << endl;
+  cout << "ABORT: fail to get free tuple! (in 255 indexies)" << endl;
   abort();
 }
 
-string FatTree::getTuppleStr(vec_byte tupple)
+string FatTree::getTupleStr(vec_byte tuple)
 {
   char buf[128];
   buf[0] = '\0';
-  for (unsigned int i = 0; i < tupple.size(); i++)
+  for (unsigned int i = 0; i < tuple.size(); i++)
     {
       if (i) strcat(buf,".");
-      sprintf(buf, "%s%d", buf, tupple[i]);
+      sprintf(buf, "%s%d", buf, tuple[i]);
     }
   return(string(buf));
 }
@@ -343,11 +343,11 @@ string FatTree::getTuppleStr(vec_byte tupple)
 // correct fat tree node childPorts and parentPorts
 int FatTree::trackConnection(
 			     FatTreeNode *p_ftNode, // the connected node
-			     vec_byte     tupple,   // the connected node tupple
+			     vec_byte     tuple,    // the connected node tuple
 			     unsigned int rank,     // rank of the local node
 			     unsigned int remRank,  // rank of the remote node
 			     unsigned int portNum,  // the port number connecting to the remote node
-			     unsigned int remDigit  // the digit of the tupple changing to the remote node
+			     unsigned int remDigit  // the digit of the tuple changing to the remote node
 			     )
 {
   if ( rank < remRank )
@@ -394,8 +394,8 @@ FatTree::extractCoefficients()
   int anyErr = 0;
 
   // go over all nodes
-  for (map_tupple_ftnode::iterator tI = NodeByTupple.begin();
-       tI != NodeByTupple.end();
+  for (map_tuple_ftnode::iterator tI = NodeByTuple.begin();
+       tI != NodeByTuple.end();
        tI++)
     {
       FatTreeNode *p_ftNode = &((*tI).second);
@@ -454,11 +454,11 @@ FatTree::extractCoefficients()
 
   if (anyErr) return 1;
 
-  vec_byte firstLeafTupple(N, 0);
-  firstLeafTupple[0] = N-1;
+  vec_byte firstLeafTuple(N, 0);
+  firstLeafTuple[0] = N-1;
   maxHcasPerLeafSwitch = 0;
-  for (map_tupple_ftnode::iterator tI = NodeByTupple.find(firstLeafTupple);
-       tI != NodeByTupple.end();
+  for (map_tuple_ftnode::iterator tI = NodeByTuple.find(firstLeafTuple);
+       tI != NodeByTuple.end();
        tI++)
     {
       FatTreeNode *p_ftNode = &((*tI).second);
@@ -506,24 +506,24 @@ FatTree::FatTree(IBFabric *p_f)
   bfsQueue.push_back(p_node);
 
   // also we always allocate the address 0..0 with "rank" digits to the node:
-  vec_byte tupple(N, 0);
+  vec_byte tuple(N, 0);
 
   // adjust the level:
-  tupple[0] = p_node->rank;
-  TuppleByNode[p_node] = tupple;
-  NodeByTupple[tupple] = FatTreeNode(p_node);
+  tuple[0] = p_node->rank;
+  TupleByNode[p_node] = tuple;
+  NodeByTuple[tuple] = FatTreeNode(p_node);
   if (FabricUtilsVerboseLevel & FABU_LOG_VERBOSE)
-    cout << "-I- Assigning tupple:" << getTuppleStr(tupple) << " to:"
+    cout << "-I- Assigning tuple:" << getTupleStr(tuple) << " to:"
 	 << p_node->name << endl;
 
   while (! bfsQueue.empty())
     {
       p_node = bfsQueue.front();
       bfsQueue.pop_front();
-      // we must have a tupple stored - get it
-      tupple = TuppleByNode[p_node];
+      // we must have a tuple stored - get it
+      tuple = TupleByNode[p_node];
       // we also need to get the fat tree node...
-      p_ftNode = &NodeByTupple[tupple];
+      p_ftNode = &NodeByTuple[tuple];
 
       // go over all the node ports
       for (unsigned int pn = 1; pn <= p_node->numPorts; pn++)
@@ -543,7 +543,7 @@ FatTree::FatTree(IBFabric *p_f)
 	    }
 
 	  // now try to see if this node has already a map:
-	  map_pnode_vec_byte::iterator tI = TuppleByNode.find(p_remNode);
+	  map_pnode_vec_byte::iterator tI = TupleByNode.find(p_remNode);
 
 	  // we are allowed to change the digit based on the direction we go:
 	  unsigned int changingDigitIdx;
@@ -563,28 +563,28 @@ FatTree::FatTree(IBFabric *p_f)
 	      return;
 	    }
 
-	  // do we need to allocate a new tupple?
-	  if (tI == TuppleByNode.end())
+	  // do we need to allocate a new tuple?
+	  if (tI == TupleByNode.end())
 	    {
 
-	      // the node is new - so get a new tupple for it:
-	      vec_byte newTupple = tupple;
+	      // the node is new - so get a new tuple for it:
+	      vec_byte newTuple = tuple;
 	      // change the level accordingly
-	      newTupple[0] = p_remNode->rank;
+	      newTuple[0] = p_remNode->rank;
 	      // obtain a free one
-	      newTupple = getFreeTupple(newTupple, changingDigitIdx);
+	      newTuple = getFreeTuple(newTuple, changingDigitIdx);
 
-	      // assign the new tupple and add to next steps:
+	      // assign the new tuple and add to next steps:
 	      if (FabricUtilsVerboseLevel & FABU_LOG_VERBOSE)
-		cout << "-I- Assigning tupple:" << getTuppleStr(newTupple)
+		cout << "-I- Assigning tuple:" << getTupleStr(newTuple)
 		     << " to:" << p_remNode->name << " changed idx:"
-		     << changingDigitIdx << " from:" << getTuppleStr(tupple)
+		     << changingDigitIdx << " from:" << getTupleStr(tuple)
 		     << endl;
 
-	      TuppleByNode[p_remNode] = newTupple;
-	      NodeByTupple[newTupple] = FatTreeNode(p_remNode);
+	      TupleByNode[p_remNode] = newTuple;
+	      NodeByTuple[newTuple] = FatTreeNode(p_remNode);
 
-	      unsigned int digit = newTupple[changingDigitIdx];
+	      unsigned int digit = newTuple[changingDigitIdx];
 
 	      // track the connection
 	      if (FabricUtilsVerboseLevel & FABU_LOG_VERBOSE)
@@ -592,25 +592,25 @@ FatTree::FatTree(IBFabric *p_f)
 		     << p_remNode->name << " through port:" << pn
 		     << " remDigit:" << digit << endl;
 	      if (trackConnection(
-				  p_ftNode, tupple, p_node->rank, p_remNode->rank, pn, digit))
+				  p_ftNode, tuple, p_node->rank, p_remNode->rank, pn, digit))
 		return;
 
 	      bfsQueue.push_back(p_remNode);
 	    }
 	  else
 	    {
-	      // other side already has a tupple - so just track the connection
-	      vec_byte remTupple = (*tI).second;
-	      vec_byte mergedTupple = remTupple;
+	      // other side already has a tuple - so just track the connection
+	      vec_byte remTuple = (*tI).second;
+	      vec_byte mergedTuple = remTuple;
 
-	      unsigned int digit = remTupple[changingDigitIdx];
+	      unsigned int digit = remTuple[changingDigitIdx];
 
 	      if (FabricUtilsVerboseLevel & FABU_LOG_VERBOSE)
 		cout << "-I- Connecting:" << p_node->name  << " to:"
 		     << p_remNode->name << " through port:" << pn
 		     << " remDigit:" << digit  << endl;
 	      if (trackConnection(
-				  p_ftNode, tupple, p_node->rank, p_remNode->rank, pn, digit))
+				  p_ftNode, tuple, p_node->rank, p_remNode->rank, pn, digit))
 		return;
 	    }
 
@@ -624,18 +624,18 @@ FatTree::FatTree(IBFabric *p_f)
   // We need to decide what will be the K of the lowest switches level.
   // It is possible that for all of them the number of HCAs is < num
   // left ports thus we should probably use the lowest number of all
-  vec_byte firstLeafTupple(N, 0);
-  firstLeafTupple[0] = N-1;
+  vec_byte firstLeafTuple(N, 0);
+  firstLeafTuple[0] = N-1;
 
-  // now restart going over all leaf switches by their tupple order and
+  // now restart going over all leaf switches by their tuple order and
   // allocate mapping
   int hcaIdx = 0;
-  for (map_tupple_ftnode::iterator tI = NodeByTupple.find(firstLeafTupple);
-       tI != NodeByTupple.end();
+  for (map_tuple_ftnode::iterator tI = NodeByTuple.find(firstLeafTuple);
+       tI != NodeByTuple.end();
        tI++)
     {
       // we collect HCAs connected to the leaf switch and set their childPort
-      // starting at the index associated with the switch tupple.
+      // starting at the index associated with the switch tuple.
       FatTreeNode *p_ftNode = &((*tI).second);
       IBNode *p_node = p_ftNode->p_node;
       unsigned int pIdx = 0;
@@ -917,10 +917,10 @@ int FatTree::route()
   int lid; // the target LID we propagate for this time
 
   // go over all fat tree nodes of the lowest level
-  vec_byte firstLeafTupple(N, 0);
-  firstLeafTupple[0] = N-1;
-  for (map_tupple_ftnode::iterator tI = NodeByTupple.find(firstLeafTupple);
-       tI != NodeByTupple.end();
+  vec_byte firstLeafTuple(N, 0);
+  firstLeafTuple[0] = N-1;
+  for (map_tuple_ftnode::iterator tI = NodeByTuple.find(firstLeafTuple);
+       tI != NodeByTuple.end();
        tI++)
     {
 
@@ -963,8 +963,8 @@ int FatTree::route()
     }
 
   // now go over all switches and route to them
-  for (map_tupple_ftnode::iterator tI = NodeByTupple.begin();
-       tI != NodeByTupple.end();
+  for (map_tuple_ftnode::iterator tI = NodeByTuple.begin();
+       tI != NodeByTuple.end();
        tI++)
     {
 
@@ -1051,9 +1051,9 @@ int FatTree::permRoute(vector<string> src, vector<string> dst)
   int hcaIdx = 0;
   int lid; // the target LID we propagate for this time
   // extract radix
-  vec_byte tmpLeafTupple(N,0);
-  tmpLeafTupple[0] = N-1;
-  FatTreeNode* p_ftN = &NodeByTupple[tmpLeafTupple];
+  vec_byte tmpLeafTuple(N,0);
+  tmpLeafTuple[0] = N-1;
+  FatTreeNode* p_ftN = &NodeByTuple[tmpLeafTuple];
   int radix = 0;
   for (int i = 0; i < p_ftN->parentPorts.size(); i++)
     if(p_ftN->parentPorts[i].size())
@@ -1078,10 +1078,10 @@ int FatTree::permRoute(vector<string> src, vector<string> dst)
 
   // build the LFTs
   // go over all fat tree nodes of the lowest level
-  vec_byte firstLeafTupple(N, 0);
-  firstLeafTupple[0] = N-1;
+  vec_byte firstLeafTuple(N, 0);
+  firstLeafTuple[0] = N-1;
   // First prepare downwards routing
-  for (map_tupple_ftnode::iterator tI = NodeByTupple.find(firstLeafTupple); tI != NodeByTupple.end(); tI++) {
+  for (map_tuple_ftnode::iterator tI = NodeByTuple.find(firstLeafTuple); tI != NodeByTuple.end(); tI++) {
     FatTreeNode *p_ftNode = &((*tI).second);
     IBNode *p_node = p_ftNode->p_node;
     // we need to track the number of ports to handle case of missing HCAs
@@ -1124,7 +1124,7 @@ int FatTree::permRoute(vector<string> src, vector<string> dst)
 
   // Now prepare upwards routing
   hcaIdx = 0;
-  for (map_tupple_ftnode::iterator tI = NodeByTupple.find(firstLeafTupple); tI != NodeByTupple.end(); tI++) {
+  for (map_tuple_ftnode::iterator tI = NodeByTuple.find(firstLeafTuple); tI != NodeByTuple.end(); tI++) {
     FatTreeNode *p_ftNode = &((*tI).second);
     IBNode *p_node = p_ftNode->p_node;
 
@@ -1156,8 +1156,8 @@ int FatTree::permRoute(vector<string> src, vector<string> dst)
   }
 
   // now go over all switches and route to them
-  for (map_tupple_ftnode::iterator tI = NodeByTupple.begin();
-       tI != NodeByTupple.end();
+  for (map_tuple_ftnode::iterator tI = NodeByTuple.begin();
+       tI != NodeByTuple.end();
        tI++)
     {
 
@@ -1222,8 +1222,8 @@ void FatTree::dump()
 {
   unsigned int level, prevLevel = 2;
   cout << "---------------------------------- FAT TREE DUMP -----------------------------" << endl;
-  for (map_tupple_ftnode::const_iterator tI = NodeByTupple.begin();
-       tI != NodeByTupple.end();
+  for (map_tuple_ftnode::const_iterator tI = NodeByTuple.begin();
+       tI != NodeByTuple.end();
        tI++)
     {
       level = (*tI).first[0];
@@ -1234,7 +1234,7 @@ void FatTree::dump()
 	}
 
       FatTreeNode const *p_ftNode = &((*tI).second);
-      cout << "    " << p_ftNode->p_node->name << " tupple:" << getTuppleStr((*tI).first) << endl;
+      cout << "    " << p_ftNode->p_node->name << " tuple:" << getTupleStr((*tI).first) << endl;
       for (unsigned int i = 0; i < p_ftNode->parentPorts.size(); i++)
 	{
 	  if (p_ftNode->parentPorts[i].size())
-- 
2.25.1

