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

Library Request: GNUPlot Library #12907

Closed
LouisJenkinsCS opened this issue Apr 27, 2019 · 5 comments
Closed

Library Request: GNUPlot Library #12907

LouisJenkinsCS opened this issue Apr 27, 2019 · 5 comments

Comments

@LouisJenkinsCS
Copy link
Member

I think that it would be very cool to have a GNUPlot library that provides context objects that keep track of a mapping of all requested user settings, and then at the end generates the GNUPlot script. As well, a way to read in a GNUPlot script into memory and back into a context object so that it can be easily modified would be great too, in that it provides ways to create templates.

What I envision it would look like

class GNUPlotFigure {
   var labels : domain(string);
   var points : [labels] Vector(real);
}

proc GNUPlotFigure.createAxis(name : string, logscale = 1.0) throws : void {}
proc GNUPlotFigure.addPoint(name : string, point : real) {}
proc GNUPlotFigure.addPoints(name : string, points...?N : real) {}
proc GNUPlotFigure.addPoints(name : string, points : _iteratorRecord) {}

class GNUPlotContext {
   var figureNames : domain(string);
   var figures : [figureNames] owned GNUPlotFigure;
}

proc GNUPlotContext.createFigure(name : string) throws : GNUPlotFigure {}
proc GNUPlotContext.getFigure(name : string) throws : GNUPlotFigure {}
proc GNUPlotContext.removeFigure(name : string) throws : void {}
proc GNUPlotContext.plot(name : string) throws : void {}

What I envision using it would look like

Creating a log-log (base 2) figure...

var gp = new GNUPlotContext();
var fig = gp.createFigure("Example");
fig.createAxis("Locales", logscale = 2);
fig.createAxis("Time (s)", logscale = 2);

var timer = new Timer();
for i in 0..#numLocales {
   timer.start();
   coforall loc in Locales[0..i] do on loc {
      coforall tid in 1..here.maxTaskPar {
         computationalWork(loc.id, tid);
      }
   }
   timer.end();
   fig.addPoint("Locales", i);
   fig.addPoint("Time (s)", timer.elapsed());
   timer.clear();
}
gp.plot("Example.plot");

I think something like this can possibly save a lot of time when collecting benchmarks. Why? All of the data can be directly deposited into the GNUPlot figures and context object rather than outputting to file and then having to manually parse it later. As well it eliminates quite a bit of boilerplate and can provide useful defaults.

As mentioned before, the ability to read in a template file would be very cool and even more time consuming so you waste less time having to rewrite the same configuration, and instead you can write-once-use-anytime!

Why not make/contribute this yourself?

I genuinely don't have time, but that doesn't make something like this any less cool! It would be cool if someone who wants something similar with a bit more time, or for someone trying to break into Chapel and get their first library going, to implement something like this!

@LouisJenkinsCS
Copy link
Member Author

A good list of example and high-quality GNUPLot templates: https://github.com/hesstobi/Gnuplot-Templates

@ben-albrecht
Copy link
Member

@marcoscleison started a project here: https://github.com/marcoscleison/chapel-gnuplot

Perhaps a good first step to would be publishing this package to the mason registry.

@LouisJenkinsCS
Copy link
Member Author

It looks pretty nice, although I definitely have a few suggestion w.r.t API changes.

@ben-albrecht
Copy link
Member

It looks pretty nice, although I definitely have a few suggestion w.r.t API changes.

It might be best to express these as issues on that repo.

@oplambeck
Copy link
Contributor

oplambeck commented Jul 2, 2019

Gnuplot is now a package that is available on the mason-registry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants