snarkify / sirius

A Plonkish folding framework for Incrementally Verifiable Computation (IVC).
MIT License
106 stars 15 forks source link

feat(example): cli #275

Closed cyphersnake closed 1 month ago

cyphersnake commented 1 month ago

Motivation Now we have a default path for time-profling & mem-profiling, but it is not very convenient to vary the runtime parameters by hand. That's why I put all runtime parameters in a separate cli example. This allows us to do time-profiling & mem-profiling on different parameters directly on the command line Part of #272

Overview Fairly simple code that parses parameters with clap and runs circuit. Covers all our examples

Once mem-profiling is in main, I'll add its description to the README along with this example

Usage: cli [OPTIONS] [PRIMARY_CIRCUIT] [SECONDARY_CIRCUIT]

Arguments:
  [PRIMARY_CIRCUIT]    [default: poseidon] [possible values: poseidon, trivial]
  [SECONDARY_CIRCUIT]  [default: trivial] [possible values: poseidon, trivial]

Options:
      --primary-circuit-k-table-size <PRIMARY_CIRCUIT_K_TABLE_SIZE>      [default: 17]
      --primary-commitment-key-size <PRIMARY_COMMITMENT_KEY_SIZE>        [default: 21]
      --primary-repeat-count <PRIMARY_REPEAT_COUNT>                      [default: 1]
      --primary-r-f <PRIMARY_R_F>                                        [default: 10]
      --primary-r-p <PRIMARY_R_P>                                        [default: 10]
      --secondary-circuit-k-table-size <SECONDARY_CIRCUIT_K_TABLE_SIZE>  [default: 17]
      --secondary-commitment-key-size <SECONDARY_COMMITMENT_KEY_SIZE>    [default: 21]
      --secondary-repeat-count <SECONDARY_REPEAT_COUNT>                  [default: 1]
      --secondary-r-f <SECONDARY_R_F>                                    [default: 10]
      --secondary-r-p <SECONDARY_R_P>                                    [default: 10]
      --limb-width <LIMB_WIDTH>                                          [default: 32]
      --limbs-count <LIMBS_COUNT>                                        [default: 10]
      --debug-mode
      --fold-step-count <FOLD_STEP_COUNT>                                [default: 1]
      --json-logs
  -h, --help                                                             Print help
  -V, --version                                                          Print version
cyphersnake commented 1 month ago

IIUC, this cli example is to profile one specific combination of parameters (i.e. specify one table size, one commitment key size etc) while the bench folder will profile different combinations of parameters(i.e. specify various table sizes and key sizes combinations)?

Memory profiling with dhat works on the whole process, so you have to run one process many times and there is no convenient benchmark option. If it were not for this limitation, we would just do the same as in the benchs folder