lib.dh 6.54 KB
Newer Older
1
  λ(dataDir : Text)
Valentin Reis's avatar
Valentin Reis committed
2
→ λ(manifestDir : Text)
Valentin Reis's avatar
Valentin Reis committed
3
→ let values = ./resources/package.dh
Valentin Reis's avatar
Valentin Reis committed
4
  
Valentin Reis's avatar
Valentin Reis committed
5
  let types = ./resources/types.dh
Valentin Reis's avatar
Valentin Reis committed
6
  
Valentin Reis's avatar
Valentin Reis committed
7
  let argotypes = ./argo/types.dh
Valentin Reis's avatar
Valentin Reis committed
8
  
Valentin Reis's avatar
Valentin Reis committed
9
  let argo = ./argo/package.dh
Valentin Reis's avatar
Valentin Reis committed
10
  
11
  let assetDir = dataDir ++ "assets/"
Valentin Reis's avatar
Valentin Reis committed
12
  
13
  let openmcDir = assetDir ++ "openmc/"
Valentin Reis's avatar
Valentin Reis committed
14
  
15
  let lammpsDir = assetDir
Valentin Reis's avatar
Valentin Reis committed
16
  
17
  let qmcPackDir = assetDir
Valentin Reis's avatar
Valentin Reis committed
18
  
19
  let Powercap = < Cap : Text | NoCap : {} >
Valentin Reis's avatar
Valentin Reis committed
20 21 22 23 24 25
  
  let id = λ(a : Type) → λ(x : a) → x
  
  let idCmd = id types.Cmd
  
  let makeExtended =
Valentin Reis's avatar
Valentin Reis committed
26
          λ(daemonArg : argotypes.MkDaemon)
Valentin Reis's avatar
Valentin Reis committed
27
        → λ(daemonOverrides : types.Cmd → types.Cmd)
Valentin Reis's avatar
Valentin Reis committed
28
        → λ(runArg : argotypes.MkRun)
Valentin Reis's avatar
Valentin Reis committed
29 30
        → λ(runOverrides : types.Cmd → types.Cmd)
        → λ(extraCmds : List types.Cmd)
31
        →   { cmds =
Valentin Reis's avatar
Valentin Reis committed
32 33 34 35
                  [ daemonOverrides (argo.nrmd.mk daemonArg)
                  , runOverrides (argo.run.mk runArg)
                  ]
                # extraCmds
36 37 38 39 40 41 42 43 44 45 46 47
            , verbose =
                True
            , cleaning =
                True
            , workdir =
                "./_output"
            , pre =
                [] : List Text
            , post =
                [] : List Text
            }
          : types.Config
Valentin Reis's avatar
Valentin Reis committed
48
  
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
  let FilterTestArgs =
        { manifestname :
            Text
        , filter :
            Text
        , cmd :
            Text
        , args :
            List Text
        , vars :
            List types.EnvVar
        , passvars :
            List Text
        , cmdavoids :
            List Text
        , isTest :
            Bool
        , timeout :
            Optional Natural
        , powercap :
            Powercap
        }
Valentin Reis's avatar
Valentin Reis committed
71
  
72 73 74 75 76
  let emptyFilterTestArgs =
          λ(filter : Text)
        → λ(cmd : Text)
        →   { cmd =
                cmd
Valentin Reis's avatar
Valentin Reis committed
77
            , manifestname =
Valentin Reis's avatar
yaml  
Valentin Reis committed
78
                "perfwrap.yml"
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
            , filter =
                filter
            , args =
                [] : List Text
            , vars =
                values.emptyVars
            , passvars =
                [] : List Text
            , cmdavoids =
                [] : List Text
            , isTest =
                False
            , timeout =
                [] : Optional Natural
            , powercap =
                < NoCap = {=} | Cap : Text >
            }
          : FilterTestArgs
Valentin Reis's avatar
Valentin Reis committed
97
  
98
  let appTest =
Valentin Reis's avatar
Valentin Reis committed
99 100
        let cn = "containerName"
        
Valentin Reis's avatar
Valentin Reis committed
101 102
        in    λ(args : FilterTestArgs)
            → makeExtended
Valentin Reis's avatar
Valentin Reis committed
103 104 105 106 107 108 109 110 111 112
              { powercap =
                  args.powercap
              , verbose =
                  True
              , singularity =
                  False
              , daemonavoids =
                  [ "Traceback", "ValueError" ]
              }
              idCmd
113 114 115
              { manifest =
                      manifestDir
                  ++  (       if args.isTest
Valentin Reis's avatar
Valentin Reis committed
116
                        
117
                        then  args.manifestname
Valentin Reis's avatar
Valentin Reis committed
118
                        
Valentin Reis's avatar
yaml  
Valentin Reis committed
119
                        else  "parallel.yml"
120 121 122 123 124 125 126 127 128 129 130 131 132 133
                      )
              , containerName =
                  cn
              , cmd =
                  args.cmd
              , args =
                  args.args
              , cmdwants =
                  [] : List Text
              , cmdavoids =
                  args.cmdavoids
              , passvars =
                  args.passvars
              }
Valentin Reis's avatar
Valentin Reis committed
134 135 136 137 138 139 140
              (   λ(c : types.Cmd)
                → c ⫽ { timeout = args.timeout, vars = args.vars }
              )
              [ argo.listen.mk
                (argo.listen.defarg cn ⫽ { filter = args.filter })
              ]
  
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
  let ProgressAppTestArg =
        { cmd :
            Text
        , args :
            List Text
        , vars :
            List types.EnvVar
        , passvars :
            List Text
        , cmdavoids :
            List Text
        , isTest :
            Bool
        , timeout :
            Optional Natural
        , powercap :
            Powercap
        }
Valentin Reis's avatar
Valentin Reis committed
159
  
160 161 162 163 164 165 166
  let emptyProgressAppTestArg =
          λ(cmd : Text)
        → λ(args : List Text)
        →   { cmd =
                cmd
            , args =
                args
Valentin Reis's avatar
Valentin Reis committed
167
            , vars =
168
                [] : List types.EnvVar
Valentin Reis's avatar
Valentin Reis committed
169
            , passvars =
170
                [] : List Text
Valentin Reis's avatar
Valentin Reis committed
171
            , cmdavoids =
172
                [] : List Text
Valentin Reis's avatar
Valentin Reis committed
173
            , isTest =
174
                False
Valentin Reis's avatar
Valentin Reis committed
175
            , timeout =
176
                [] : Optional Natural
Valentin Reis's avatar
Valentin Reis committed
177
            , powercap =
178
                < NoCap = {=} | Cap : Text >
Valentin Reis's avatar
Valentin Reis committed
179
            }
180
          : ProgressAppTestArg
Valentin Reis's avatar
Valentin Reis committed
181
  
182 183 184 185 186 187 188
  let progressAppTest =
          λ(args : ProgressAppTestArg)
        → appTest
          (   emptyFilterTestArgs "progress" args.cmd
            ⫽ { args =
                  args.args
              , manifestname =
Valentin Reis's avatar
yaml  
Valentin Reis committed
189
                  "basic.yml"
190 191 192 193 194 195 196 197 198 199 200 201
              , vars =
                  args.vars
              , passvars =
                  args.passvars
              , cmdavoids =
                  args.cmdavoids
              , isTest =
                  args.isTest
              , timeout =
                  args.timeout
              , powercap =
                  args.powercap
Valentin Reis's avatar
Valentin Reis committed
202
              }
203
          )
Valentin Reis's avatar
Valentin Reis committed
204
  
Valentin Reis's avatar
Valentin Reis committed
205 206 207 208 209 210 211 212 213 214 215 216
  let mkListen =
          λ(cn : Text)
        → λ(filter : Text)
        → let b =
                values.emptyCmd
                { name =
                    "nrm"
                , outfile =
                    filter ++ ".out"
                , errfile =
                    filter ++ ".err"
                }
Valentin Reis's avatar
Valentin Reis committed
217
          
Valentin Reis's avatar
Valentin Reis committed
218
          in  b ⫽ { args = [ "listen", "-u", cn, "--filter", filter ] }
Valentin Reis's avatar
Valentin Reis committed
219
  
220
  let powerexpeCmds =
Valentin Reis's avatar
Valentin Reis committed
221 222 223 224 225 226 227 228 229
        let cn = "containerName"
        
        in    [ argo.listen.mk (argo.listen.defarg cn ⫽ { filter = "power" })
              , argo.listen.mk
                (argo.listen.defarg cn ⫽ { filter = "performance" })
              , argo.listen.mk (argo.listen.defarg cn ⫽ { filter = "control" })
              ]
            : List types.Cmd
  
230 231 232 233
  let extendApp =
          λ(c : types.Config)
        → λ(isTest : Bool)
        → if isTest then c else c ⫽ { cmds = c.cmds # powerexpeCmds }
Valentin Reis's avatar
Valentin Reis committed
234
  
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
  in  { values =
          values
      , makeExtended =
          makeExtended
      , appTest =
          appTest
      , progressAppTest =
          progressAppTest
      , emptyFilterTestArgs =
          emptyFilterTestArgs
      , qmcPackDir =
          qmcPackDir
      , openmcDir =
          openmcDir
      , lammpsDir =
          lammpsDir
      , manifestDir =
          manifestDir
      , emptyProgressAppTestArg =
          emptyProgressAppTestArg
      , powerexpeCmds =
          powerexpeCmds
      , extendApp =
          extendApp
Valentin Reis's avatar
Valentin Reis committed
259 260
      , idCmd =
          id types.Cmd
261
      }