haskell-te: f935c4bf0c9efda89625428e1057fc00a0c7a6b7

     1: # Builds the environment in which to run a benchmark
     2: args:
     3: 
     4: with builtins;
     5: with import ./.. {};
     6: with lib;
     7: with rec {
     8:   noCompiling = writeScript "noCompilingDuringBenchmarking.nix" ''
     9:     with builtins; abort "Tried to build Nix env during a benchmark"
    10:   '';
    11: 
    12:   parameters = {
    13:     max_size      = 20;
    14: 
    15:     # NOTE: These numbers are one-less-than their corresponding samples, e.g.
    16:     # a specific rep '20' will run 'choose_sample SIZE 21'
    17:     repetitions   = 1;       # Repeat this many times unless specific_reps given
    18:     specific_reps = [ 30 ];  # Use instead of range(0, repetitions) unless empty
    19: 
    20:     timeout_secs  = 300;
    21:   };
    22: 
    23:   # NOTE: For historical reasons (implicit list indices), the "rep" parameter
    24:   # given to "choose_sample" is 1+ the index we use here (hence "repMinusOne")
    25:   samples =
    26:     listToAttrs
    27:       (map (size: {
    28:              name  = toString size;
    29:              value = listToAttrs
    30:                        (map (repMinusOne: {
    31:                               name  = toString repMinusOne;
    32:                               value = quickspecTip {
    33:                                 inherit size;
    34:                                 # For historical consistency, choose_sample is
    35:                                 # run with 1+ the JSON key
    36:                                 rep = repMinusOne + 1;
    37:                               };
    38:                             })
    39:                             # These are the numbers which appear in the JSON
    40:                             (if parameters.specific_reps == []
    41:                                 then range 0 (parameters.repetitions - 1)
    42:                                 else parameters.specific_reps));
    43:            })
    44:            (range 1 parameters.max_size));
    45: 
    46:   py             = nixpkgs-2016-09.python.withPackages
    47:                      (p: [ p.sexpdata p.subprocess32 ]);
    48:   quickspecTip   = callPackage ./quickspecTip.nix   { inherit sampleAnalyser; };
    49:   sampleAnalyser = callPackage ./sampleAnalyser.nix {};
    50: 
    51:   /*
    52:   hashspecTip   = callPackage ./hashspecTip.nix   {};
    53:   hashspecBench = callPackage ./hashspecBench.nix { inherit mlspecBench;   };
    54:   mlspecBench   = callPackage ./mlspecBench.nix   { inherit hashspecBench; };
    55:   hsTipSetup    = hs.sampled.genInput;
    56:   hsTipRunner   = hs.sampled.runner;
    57:   mlTipSetup    = ml.sampled.genInput;
    58:   mlTipRunner   = ml.sampled.runner;
    59:   hs = hashspecBench.benchVars;
    60:   ml = mlspecBench.benchVars;
    61:   */
    62: };
    63: 
    64: mkBin {
    65:   name  = "python";
    66:   paths = [ py tipBenchmarks.tools ];
    67:   vars  = nixEnv // {
    68:     HASKELL_PACKAGES      = noCompiling;
    69:     NIX_EVAL_HASKELL_PKGS = noCompiling;
    70: 
    71:     parameters   = toJSON parameters;
    72: 
    73:     qsStandalone = callPackage ./quickspecStandalone.nix {};
    74: 
    75:     quickspecTip = runCommand "qstip.json"
    76:       {
    77:         buildInputs = [ fail ];
    78:         passAsFile  = [ "content" ];
    79:         content     = toJSON samples;
    80:       }
    81:       ''
    82:         set -e
    83:         [[ -f "$contentPath" ]] || fail "No path '$contentPath'"
    84:         cp "$contentPath" "$out"
    85:       '';
    86: 
    87:     theoryFiles = toJSON {
    88:       list-full  = ./list-full.smt2;
    89:       nat-full   = ./nat-full.smt2;
    90:       nat-simple = ./nat-simple.smt2;
    91:     };
    92: 
    93:     theoryTruths = toJSON {
    94:       list-full  = ./ground-truth/list-full.smt2;
    95:       nat-full   = ./ground-truth/nat-full.smt2;
    96:       nat-simple = ./ground-truth/nat-simple.smt2;
    97:     };
    98:   };
    99:   script = ''
   100:     #!${bash}/bin/bash
   101:     exec python "$@"
   102:   '';
   103: }

Generated by git2html.