From a48f400f9132fc5e34dd2429269f51bd636b2920 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Keck <Jean-Baptiste.Keck@imag.fr> Date: Sat, 18 Apr 2020 16:58:24 +0200 Subject: [PATCH] lexicographical topological sort --- ci/docker_images/ubuntu/bionic/Dockerfile | 1 + hysop/core/graph/graph.py | 14 ++++++++------ hysop_examples/example_utils.py | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ci/docker_images/ubuntu/bionic/Dockerfile b/ci/docker_images/ubuntu/bionic/Dockerfile index 28363a675..bbacf57fa 100644 --- a/ci/docker_images/ubuntu/bionic/Dockerfile +++ b/ci/docker_images/ubuntu/bionic/Dockerfile @@ -55,6 +55,7 @@ RUN cd /tmp && \ ./install.sh --silent ./silent.cfg && \ cd /tmp && \ rm -Rf /tmp/intel +https://software.intel.com/en-us/articles/opencl-runtime-release-notes/#181 # Fix OpenCl ICD RUN ln -s /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 /usr/lib/x86_64-linux-gnu/libOpenCL.so diff --git a/hysop/core/graph/graph.py b/hysop/core/graph/graph.py index e7bcfbe2d..72d810e7e 100644 --- a/hysop/core/graph/graph.py +++ b/hysop/core/graph/graph.py @@ -25,7 +25,9 @@ def lexicographical_topological_sort(graph): # such that they are in the same topological order on each # MPI process. Else operators will not be executed in the same # order and everything deadlocks on MPI synchronization. - return tuple(networkx.algorithms.dag.lexicographical_topological_sort(graph)) + topo_sort = tuple(networkx.algorithms.dag.lexicographical_topological_sort( + graph, key=lambda x: int(x))) + return topo_sort def new_directed_graph(): return networkx.DiGraph() @@ -57,7 +59,7 @@ def generate_vertex_colors(): c0 = cm.get_cmap('tab20c').colors c1 = cm.get_cmap('tab20b').colors colors = [] - for i in (1,2,3,0): + for i in (2,3,0,1): colors += c0[i::4] + c1[i::4] colors = tuple(map(matplotlib.colors.to_hex, colors)) return colors @@ -161,7 +163,7 @@ class VertexAttributes(object): } def ifinfo(field, topo): - info = (field.name, topo.id) + info = (field.pretty_name, topo.id) if istates: assert field in istates istate = istates[field] @@ -170,7 +172,7 @@ class VertexAttributes(object): info+=(str(istate.tstate),) return ', '.join(map(str,info)) def ofinfo(field, topo): - info = (field.name, topo.id) + info = (field.pretty_name, topo.id) if ostates: assert field in ostates ostate = ostates[field] @@ -179,9 +181,9 @@ class VertexAttributes(object): info+=(str(ostate.tstate),) return ', '.join(map(str,info)) def ipinfo(param): - return param.name + return param.pretty_name def opinfo(param): - return param.name + return param.pretty_name prefix='  <b>' suffix='</b>  ' diff --git a/hysop_examples/example_utils.py b/hysop_examples/example_utils.py index ede181d4f..740379abd 100644 --- a/hysop_examples/example_utils.py +++ b/hysop_examples/example_utils.py @@ -1802,7 +1802,8 @@ class HysopArgParser(argparse.ArgumentParser): filtering_methods = { 'spectral': FilteringMethod.SPECTRAL, 'remesh': FilteringMethod.REMESH, - 'polynomial': FilteringMethod.POLYNOMIAL + 'polynomial': FilteringMethod.POLYNOMIAL, + 'subgrid': FilteringMethod.SUBGRID, } if allow_subgrid: filtering_methods['subgrid'] = FilteringMethod.SUBGRID -- GitLab