Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replaced layouter #34

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions layouter_dir/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
!dist
.idea
package-lock.json
3,713 changes: 3,713 additions & 0 deletions layouter_dir/dist/layoutLib.js

Large diffs are not rendered by default.

4,414 changes: 4,414 additions & 0 deletions layouter_dir/dist/renderLib.js

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions layouter_dir/node_scripts/nodeLoader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require('lodash');
require('../dist/layoutLib');

module.exports = (name) => {
const path = require('path');
const url = path.resolve(__dirname, "../graphs/" + name + ".json");
const json = require(url);
const graph = layoutLib.Parser.parse(json);
// set node sizes
_.forEach(graph.allNodes(), (node) => {
node.updateSize({width: 100, height: 34});
});

return new Promise(resolve => {
resolve(graph);
});
}
6 changes: 6 additions & 0 deletions layouter_dir/node_scripts/runtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const load = require('./nodeLoader');
require('../dist/layoutLib');
const layouter = new layoutLib.layouter.DagreLayouter();
layoutLib.Bench.runtime(load, layouter).catch((e) => {
console.error(e);
});
6 changes: 6 additions & 0 deletions layouter_dir/node_scripts/validate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const load = require('./nodeLoader');
require('../dist/layoutLib');
const layouter = new layoutLib.layouter.SugiyamaLayouter({shuffles: 16, shuffleGlobal: false, preorderConnectors: true, bundle: true});
layoutLib.Bench.validate(load, layouter, layoutLib.Bench.GRAPHS_ALL).catch((e) => {
console.error(e);
});
29 changes: 29 additions & 0 deletions layouter_dir/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "sdfg",
"version": "1.0.0",
"description": "layouter and renderer",
"scripts": {
"test": "echo \\\"Error: no graphs specified\\\" && exit 1",
"build": "webpack --config webpack.config.js"
},
"author": "Thomas Leu",
"license": "ISC",
"devDependencies": {
"ts-loader": "^8.0.17",
"typescript": "^4.1.5",
"webpack": "^5.21.2",
"webpack-cli": "^4.5.0"
},
"dependencies": {
"@types/lodash": "^4.14.168",
"dagre": "^0.8.5",
"gpu.js": "^2.11.2",
"javascript-lp-solver": "^0.4.24",
"line-intersect": "^3.0.0",
"node-fetch": "^2.6.1",
"pixi-viewport": "^4.18.1",
"pixi.js": "^5.3.7",
"priorityqueuejs": "^2.0.0",
"seedrandom": "^3.0.5"
}
}
60 changes: 60 additions & 0 deletions layouter_dir/src/bench/bench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import DagreLayouter from "../layouter/dagreLayouter";
import LayoutAnalysis from "./layoutAnalysis";
import Layouter from "../layouter/layouter";
import PerformanceAnalysis from "./performanceAnalysis";
import RenderGraph from "../renderGraph/renderGraph";
import Serializer from "../util/serializer";

export default class Bench {
public static GRAPHS_SMALL = ["gemm_opt", "jacobi", "placement", "symm", "syrk", "trisolv", "trmm", "wrong"];
public static GRAPHS_MEDIUM = ["bert2", "encbwd", "unreadable", "VA-gpu"]
public static GRAPHS_LARGE = ["bert", "lulesh-with-maps", "rgf_dense"];
public static GRAPHS_ALL = ["bert", "bert2", "encbwd", "gemm_opt", "jacobi", "lulesh-with-maps", "placement", "rgf_dense", "symm", "syrk", "trisolv", "trmm", "unreadable", "VA-gpu", "wrong"];
public static GRAPHS_POLYBENCH = ["npbench/polybench/adi", "npbench/polybench/atax", "npbench/polybench/bicg", "npbench/polybench/cholesky", "npbench/polybench/correlation", "npbench/polybench/covariance", "npbench/polybench/deriche", "npbench/polybench/doitgen", "npbench/polybench/durbin", "npbench/polybench/fdtd_2d", "npbench/polybench/floyd_warshall", "npbench/polybench/gemm", "npbench/polybench/gemver", "npbench/polybench/gesummv", "npbench/polybench/gramschmidt", "npbench/polybench/heat_3d", "npbench/polybench/jacobi_1d", "npbench/polybench/jacobi_2d", "npbench/polybench/k2mm", "npbench/polybench/k3mm", "npbench/polybench/lu", "npbench/polybench/ludcmp", "npbench/polybench/mvt", "npbench/polybench/nussinov", "npbench/polybench/seidel_2d", "npbench/polybench/symm", "npbench/polybench/syr2k", "npbench/polybench/syrk", "npbench/polybench/trisolv", "npbench/polybench/trmm"];
public static GRAPHS_NPBENCH = ["npbench/pythran/arc_distance", "npbench/weather_stencils/vadv", "npbench/azimint_hist", "npbench/azimint_naive", "npbench/cavity_flow", "npbench/channel_flow", "npbench/compute", "npbench/go_fast", "npbench/mandelbrot1", "npbench/nbody", "npbench/scattering_self_energies", "npbench/stockham_fft"];

public static LAYOUTERS = [new DagreLayouter()];

public static validate(loadFunction: (name: string) => Promise<RenderGraph>, layouter: Layouter, graphs: Array<string> = Bench.GRAPHS_ALL) {
const promises = graphs.map(name => {
return loadFunction(name).then((renderGraph: RenderGraph) => {
const layoutGraph = layouter.layout(renderGraph);
const layoutAnalysis = new LayoutAnalysis(layoutGraph, layouter.getOptionsForAnalysis());
if (!layoutAnalysis.validate()) {
throw new Error('Layouter returned invalid layout for graph "' + name + '".');
}
});
})
return Promise.all(promises);
}

public static cost(loadFunction: (name: string) => Promise<RenderGraph>, layouter: Layouter, graphs: Array<string> = Bench.GRAPHS_ALL) {
const promises = graphs.map(name => {
return loadFunction(name).then((renderGraph: RenderGraph) => {
const layoutGraph = layouter.layout(renderGraph);
const layoutAnalysis = new LayoutAnalysis(layoutGraph, layouter.getOptionsForAnalysis());
return layoutAnalysis.cost();
});
});
return Serializer.serializePromises(promises);
}

public static crossings(loadFunction: (name: string) => Promise<RenderGraph>, layouter: Layouter, graphs: Array<string> = Bench.GRAPHS_ALL) {
const promises = graphs.map(name => {
return loadFunction(name).then((renderGraph: RenderGraph) => {
const layoutGraph = layouter.layout(renderGraph);
const layoutAnalysis = new LayoutAnalysis(layoutGraph, layouter.getOptionsForAnalysis());
return layoutAnalysis.segmentCrossings();
});
});
return Serializer.serializePromises(promises);
}

public static performance(loadFunction: (name: string) => Promise<RenderGraph>, layouter: Layouter, graphs: Array<string> = Bench.GRAPHS_ALL) {
const promises = graphs.map(name => {
const performanceAnalysis = new PerformanceAnalysis(layouter);
return performanceAnalysis.measure(name);
});
return Serializer.serializePromises(promises);
}
}
Loading