Skip to content

Commit

Permalink
try running the experiment twice
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfram77 committed Feb 12, 2025
1 parent 702e11e commit 5bc21a7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
7 changes: 4 additions & 3 deletions main.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ inline void testVisitCountBfs(const G& x, int steps) {
* @param x input graph
*/
template <class G>
inline void runExperiment(const G& x) {
inline void runExperiment(const G& x, int run) {
using K = typename G::key_type;
using V = typename G::vertex_value_type;
using E = typename G::edge_value_type;
printf("Running experiment ...\n");
printf("Running experiment %d ...\n", run);
// Create random number generator.
random_device dev;
default_random_engine rnd(dev());
Expand Down Expand Up @@ -251,7 +251,8 @@ int main(int argc, char **argv) {
LOG(""); println(xa);
printf("{%09.1fms} %s\n", ta, "duplicateArenaOmpW");

runExperiment(xa);
runExperiment(xa, 1);
runExperiment(xa, 2); // Try again.
}
printf("\n");
return 0;
Expand Down
28 changes: 24 additions & 4 deletions process.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const path = require('path');

const ROMPTH = /^OMP_NUM_THREADS=(\d+)/m;
const RGRAPH = /^Loading graph .*\/(.*?)\.mtx \.\.\./m;
const REXPER = /^Running experiment (\d+) .../m;
const RORDER = /^order: (\d+) size: (\d+) \[directed\] \{\}/m;
const RBATCH = /^Batch fraction: (.+)/m;
const RRESLT = /^\{(.+?)ms(?:; (.+?)ms duplicate)?\} (.+)/m;
Expand Down Expand Up @@ -31,13 +32,24 @@ function writeFile(pth, d) {
// -----

function writeCsv(pth, rows) {
var cols = Object.keys(rows[0]);
var cols = rowKeys(rows[0]);
var a = cols.join()+'\n';
for (var r of rows)
a += [...Object.values(r)].map(v => `"${v}"`).join()+'\n';
a += [...rowValues(r)].map(v => `"${v}"`).join()+'\n';
writeFile(pth, a);
}

function rowKeys(row) {
return Object.keys(row).filter(k => k!=='experiment');
}

function rowValues(row) {
var a = [];
for (var k of Object.keys(row))
if (k!=='experiment') a.push(row[k]);
return a;
}




Expand All @@ -49,6 +61,7 @@ function readLogLine(ln, data, state) {
if (ROMPTH.test(ln)) {
var [, omp_num_threads] = ROMPTH.exec(ln);
state.omp_num_threads = parseFloat(omp_num_threads);
state.experiment = 0;
state.graph = '';
state.order = 0;
state.size = 0;
Expand All @@ -57,6 +70,10 @@ function readLogLine(ln, data, state) {
state.duplicate_time = 0;
state.technique = '';
}
else if (REXPER.test(ln)) {
var [, experiment] = REXPER.exec(ln);
state.experiment = parseFloat(experiment);
}
else if (RGRAPH.test(ln)) {
var [, graph] = RGRAPH.exec(ln);
if (!data.has(graph)) data.set(graph, []);
Expand All @@ -73,6 +90,7 @@ function readLogLine(ln, data, state) {
}
else if (RRESLT.test(ln)) {
var [, time, duplicate_time, technique] = RRESLT.exec(ln);
if (technique==='transposeArenaOmp') state.batch_fraction = 0;
if (technique==='visitCountBfs') {
var last = data.get(state.graph).slice(-1)[0];
technique += last.technique.startsWith('add')? '+' : '-';
Expand Down Expand Up @@ -104,8 +122,10 @@ function readLog(pth) {

function processCsv(data) {
var a = [];
for (var rows of data.values())
a.push(...rows);
for (var rows of data.values()) {
for (var r of rows)
if (r.experiment != 1) a.push(r);
}
return a;
}

Expand Down

0 comments on commit 5bc21a7

Please sign in to comment.