[ofa-general] [PATCH] opensm/osm_mesh.c: Remove edges in lash matrix

Hal Rosenstock hnrose at comcast.net
Wed Aug 5 15:06:13 PDT 2009


The intent of this change to remove edge nodes is to *not* count
them.

The point of this heuristic is to deal with the case of small
lattices which can easily have more surface than interior leading to
choosing a non representative seed. This causes impossible counts to
get reported.

Signed-off-by: Robert Pearson <rpearson at systemfabricworks.com>
Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
---
diff --git a/opensm/opensm/osm_mesh.c b/opensm/opensm/osm_mesh.c
index 72a9aa9..b5d141d 100644
--- a/opensm/opensm/osm_mesh.c
+++ b/opensm/opensm/osm_mesh.c
@@ -170,6 +170,11 @@ static const struct mesh_info {
 
 	{8, {2, 2, 2, 2, 2, 2, 2, 2},	8, {-1792, -6144, -8960, -7168, -3360, -896, -112, 0, 1},	},
 
+	/*
+	 * mesh errors
+	 */
+	{2, {6, 6},                     4, {-192, -256, -80, 0, 1}, },
+
 	{-1, {0,}, 0, {0, },					},
 };
 
@@ -727,6 +732,36 @@ done:
 }
 
 /*
+ * remove_edges
+ *
+ * remove type from nodes that have fewer links
+ * than adjacent nodes
+ */
+static void remove_edges(lash_t *p_lash)
+{
+	int sw;
+	mesh_node_t *n, *nn;
+	int i;
+
+	for (sw = 0; sw < p_lash->num_switches; sw++) {
+		n = p_lash->switches[sw]->node;
+		if (!n->type)
+			continue;
+
+		for (i = 0; i < n->num_links; i++) {
+			nn = p_lash->switches[n->links[i]->switch_id]->node;
+
+			if (nn->num_links > n->num_links) {
+				printf("removed edge switch %s\n",
+				       p_lash->switches[sw]->p_sw->p_node->print_desc);
+				n->type = -1;
+				break;
+			}
+		}
+	}
+}
+
+/*
  * get_local_geometry
  *
  * analyze the local geometry around each switch
@@ -735,6 +770,7 @@ static int get_local_geometry(lash_t *p_lash, mesh_t *mesh)
 {
 	osm_log_t *p_log = &p_lash->p_osm->log;
 	int sw;
+	int status = 0;
 
 	OSM_LOG_ENTER(p_log);
 
@@ -747,15 +783,38 @@ static int get_local_geometry(lash_t *p_lash, mesh_t *mesh)
 			continue;
 
 		if (get_switch_metric(p_lash, sw)) {
-			OSM_LOG_EXIT(p_log);
-			return -1;
+			status = -1;
+			goto Exit;
 		}
-		classify_switch(p_lash, mesh, sw);
 		classify_mesh_type(p_lash, sw);
 	}
 
+	remove_edges(p_lash);
+
+	for (sw = 0; sw < p_lash->num_switches; sw++) {
+		if (p_lash->switches[sw]->node->type < 0)
+			continue;
+		classify_switch(p_lash, mesh, sw);
+	}
+
+Exit:
 	OSM_LOG_EXIT(p_log);
-	return 0;
+	return status;
+}
+
+static void print_axis(lash_t *p_lash, int sw, int port)
+{
+	mesh_node_t *node = p_lash->switches[sw]->node;
+	char *name = p_lash->switches[sw]->p_sw->p_node->print_desc;
+	int c = node->axes[port];
+
+	printf("%s[%d] = ", name, port);
+	if (c)
+		printf("%s%c -> ", ((c - 1) & 1) ? "-" : "+", 'X' + (c - 1)/2);
+	else
+		printf("N/A -> ");
+	printf("%s\n",
+	       p_lash->switches[node->links[port]->switch_id]->p_sw->p_node->print_desc);
 }
 
 /*
@@ -805,6 +864,11 @@ static void seed_axes(lash_t *p_lash, int sw)
 		}
 	}
 
+	for (i = 0; i < n; i++) {
+		printf("seed: ");
+		print_axis(p_lash, sw, i);
+	}
+
 done:
 	OSM_LOG_EXIT(p_log);
 }
@@ -878,6 +942,12 @@ static void make_geometry(lash_t *p_lash, int sw)
 			n = s1->node->num_links;
 
 			/*
+			 * ignore chain fragments
+			 */
+			if (n < seed->node->num_links && n <= 2)
+				continue;
+
+			/*
 			 * only process 'mesh' switches
 			 */
 			if (!s1->node->matrix)
@@ -908,7 +978,8 @@ static void make_geometry(lash_t *p_lash, int sw)
 					if (j == i)
 						continue;
 
-					if (s1->node->matrix[i][j] != 2) {
+					if (s1->node->matrix[i][j] != 2 &&
+						s1->node->matrix[i][j] <= 4) {
 						if (s1->node->axes[j]) {
 							if (s1->node->axes[j] != opposite(seed, s1->node->axes[i])) {
 								OSM_LOG(p_log, OSM_LOG_DEBUG, "phase 1 mismatch\n");



More information about the general mailing list