go-hep.org/x/hep@v0.38.1/fwk/README.md (about)

     1  fwk
     2  ===
     3  
     4  [![GoDoc](https://godoc.org/go-hep.org/x/hep/fwk?status.svg)](https://godoc.org/go-hep.org/x/hep/fwk)
     5  
     6  `fwk` is a HEP oriented concurrent framework written in `Go`.
     7  `fwk` should be easy to pick up and use for small and fast analyses but should also support reconstruction, simulation, ... use cases.
     8  
     9  ## Installation
    10  
    11  `fwk`, like any pure-Go package, is `go get` able:
    12  
    13  ```sh
    14  $ go get go-hep.org/x/hep/fwk/...
    15  ```
    16  
    17  (yes, with the ellipsis after the slash, to install all the "sub-packages")
    18  
    19  
    20  ## Documentation
    21  
    22  The documentation is available on `godoc`:
    23  
    24   https://godoc.org/go-hep.org/x/hep/fwk
    25  
    26  
    27  ## Examples
    28  
    29  
    30  ### `fwk` tuto examples
    31  
    32  The [examples](https://codeberg.org/go-hep/hep/src/branch/main/fwk/examples)
    33  directory contains a few simple applications which exercize the `fwk`
    34  toolkit.
    35  
    36  The examples/tutorials should be readily available as soon as you've
    37  executed:
    38  
    39  ```sh
    40  $ go get go-hep.org/x/hep/fwk/examples/...
    41  ```
    42  
    43  *e.g.:*
    44  
    45  ```sh
    46  $ fwk-ex-tuto-1 -help
    47  Usage: fwk-ex-tuto1 [options]
    48  
    49  ex:
    50   $ fwk-ex-tuto-1 -l=INFO -evtmax=-1
    51  
    52  options:
    53    -evtmax=10: number of events to process
    54    -l="INFO": message level (DEBUG|INFO|WARN|ERROR)
    55    -nprocs=0: number of events to process concurrently
    56  ```
    57  
    58  ```sh
    59  $ fwk-ex-tuto-1
    60  ::: fwk-ex-tuto-1...
    61  t2                   INFO configure...
    62  t2                   INFO configure... [done]
    63  t1                   INFO configure ...
    64  t1                   INFO configure ... [done]
    65  t2                   INFO start...
    66  t1                   INFO start...
    67  app                  INFO >>> running evt=0...
    68  t1                   INFO proc... (id=0|0) => [10, 20]
    69  t2                   INFO proc... (id=0|0) => [10 -> 100]
    70  app                  INFO >>> running evt=1...
    71  t1                   INFO proc... (id=1|0) => [10, 20]
    72  t2                   INFO proc... (id=1|0) => [10 -> 100]
    73  app                  INFO >>> running evt=2...
    74  t1                   INFO proc... (id=2|0) => [10, 20]
    75  t2                   INFO proc... (id=2|0) => [10 -> 100]
    76  app                  INFO >>> running evt=3...
    77  t1                   INFO proc... (id=3|0) => [10, 20]
    78  t2                   INFO proc... (id=3|0) => [10 -> 100]
    79  app                  INFO >>> running evt=4...
    80  t1                   INFO proc... (id=4|0) => [10, 20]
    81  t2                   INFO proc... (id=4|0) => [10 -> 100]
    82  app                  INFO >>> running evt=5...
    83  t1                   INFO proc... (id=5|0) => [10, 20]
    84  t2                   INFO proc... (id=5|0) => [10 -> 100]
    85  app                  INFO >>> running evt=6...
    86  t1                   INFO proc... (id=6|0) => [10, 20]
    87  t2                   INFO proc... (id=6|0) => [10 -> 100]
    88  app                  INFO >>> running evt=7...
    89  t1                   INFO proc... (id=7|0) => [10, 20]
    90  t2                   INFO proc... (id=7|0) => [10 -> 100]
    91  app                  INFO >>> running evt=8...
    92  t1                   INFO proc... (id=8|0) => [10, 20]
    93  t2                   INFO proc... (id=8|0) => [10 -> 100]
    94  app                  INFO >>> running evt=9...
    95  t1                   INFO proc... (id=9|0) => [10, 20]
    96  t2                   INFO proc... (id=9|0) => [10 -> 100]
    97  t2                   INFO stop...
    98  t1                   INFO stop...
    99  app                  INFO cpu: 432.039us
   100  app                  INFO mem: alloc:             68 kB
   101  app                  INFO mem: tot-alloc:         79 kB
   102  app                  INFO mem: n-mallocs:        410
   103  app                  INFO mem: n-frees:           60
   104  app                  INFO mem: gc-pauses:          0 ms
   105  ::: fwk-ex-tuto-1... [done] (cpu=625.918us)
   106  ```
   107  
   108  ### Physics-oriented demonstrator
   109  
   110  There is also a more physics-oriented example/demonstrator: [fads](https://go-hep.org/x/hep/fads)
   111  
   112  
   113  ## Tools
   114  
   115  ### `fwk-new-comp`
   116  
   117  `fwk-new-comp` is a small tool to generate most of the boilerplate
   118  code to bootstrap the creation of new `fwk.Component`s (either
   119  `fwk.Task` or `fwk.Svc`)
   120  
   121  ```sh
   122  $ fwk-new-comp -help
   123  Usage: fwk-new-comp [options] <component-name>
   124  
   125  ex:
   126   $ fwk-new-comp -c=task -p=mypackage mytask
   127   $ fwk-new-comp -c=task -p mypackage mytask >| mytask.go
   128   $ fwk-new-comp -c=svc  -p mypackage mysvc  >| mysvc.go
   129  
   130  options:
   131    -c="task": type of component to generate (task|svc)
   132    -p="": name of the package holding the component
   133  ```
   134  
   135  
   136  ### `fwk-list-components`
   137  
   138  `fwk-list-components` lists all the currently available components.
   139  
   140  ```sh
   141  $ fwk-list-components
   142  ::: components... (5)
   143  [0000/0005] go-hep.org/x/hep/fwk.InputStream
   144  [0001/0005] go-hep.org/x/hep/fwk.OutputStream
   145  [0002/0005] go-hep.org/x/hep/fwk.appmgr
   146  [0003/0005] go-hep.org/x/hep/fwk.datastore
   147  [0004/0005] go-hep.org/x/hep/fwk.dflowsvc
   148  ```