refactor env

This commit is contained in:
Jaremy Creechley 2024-05-02 15:48:49 +03:00
parent 4aa45dadbd
commit f609151cf8
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
2 changed files with 8 additions and 6 deletions

View File

@ -67,12 +67,12 @@ proc runRapidSnark(args: CircuitArgs, files: CircuitFiles) =
echo "generating the witness..."
proc runBenchmark(args: CircuitArgs) =
proc runBenchmark(args: CircuitArgs, env: CircuitEnv) =
## execute benchmarks given a set of args
## will create a folder in `benchmarks/circuit_bench_$(args)`
##
let env = createCircuit(args)
let env = createCircuit(args, env)
## TODO: copy over testcircomcompat proving
let files = CircuitFiles(
@ -87,7 +87,9 @@ proc runBenchmark(args: CircuitArgs) =
proc startBenchmarks*() =
echo "Running benchmark"
# setup()
checkEnv()
var env = CircuitEnv.default()
env.check()
var args = CircuitArgs(
depth: 32, # maximum depth of the slot tree
maxslots: 256, # maximum number of slots
@ -101,7 +103,7 @@ proc startBenchmarks*() =
ncells: 512, # number of cells in this slot
)
for i in 1 .. 9:
for i in 1 .. 2:
args.nsamples = i
stdout.styledWriteLine(fgYellow, "\nbenchmarking args: ", $args)
args.runBenchmark()

View File

@ -47,7 +47,7 @@ template runit(cmd: string) =
echo "STATUS: ", cmdRes
assert cmdRes == 0
proc checkEnv*(env: var CircuitEnv) =
proc check*(env: var CircuitEnv) =
## check that the CWD of script is in the codex parent
let codexProjDir = findCodexProjectDir()
echo "\n\nFound project dir: ", codexProjDir
@ -171,7 +171,7 @@ when isMainModule:
echo "findCodexProjectDir: ", findCodexProjectDir()
## test run creating a circuit
var env = CircuitEnv.default()
checkEnv(env)
env.check()
let args = CircuitArgs(
depth: 32, # maximum depth of the slot tree