mirror of
https://github.com/status-im/nim-codex.git
synced 2025-02-23 16:08:40 +00:00
refactor env
This commit is contained in:
parent
4aa45dadbd
commit
f609151cf8
@ -67,12 +67,12 @@ proc runRapidSnark(args: CircuitArgs, files: CircuitFiles) =
|
|||||||
|
|
||||||
echo "generating the witness..."
|
echo "generating the witness..."
|
||||||
|
|
||||||
proc runBenchmark(args: CircuitArgs) =
|
proc runBenchmark(args: CircuitArgs, env: CircuitEnv) =
|
||||||
## execute benchmarks given a set of args
|
## execute benchmarks given a set of args
|
||||||
## will create a folder in `benchmarks/circuit_bench_$(args)`
|
## will create a folder in `benchmarks/circuit_bench_$(args)`
|
||||||
##
|
##
|
||||||
|
|
||||||
let env = createCircuit(args)
|
let env = createCircuit(args, env)
|
||||||
|
|
||||||
## TODO: copy over testcircomcompat proving
|
## TODO: copy over testcircomcompat proving
|
||||||
let files = CircuitFiles(
|
let files = CircuitFiles(
|
||||||
@ -87,7 +87,9 @@ proc runBenchmark(args: CircuitArgs) =
|
|||||||
proc startBenchmarks*() =
|
proc startBenchmarks*() =
|
||||||
echo "Running benchmark"
|
echo "Running benchmark"
|
||||||
# setup()
|
# setup()
|
||||||
checkEnv()
|
var env = CircuitEnv.default()
|
||||||
|
env.check()
|
||||||
|
|
||||||
var args = CircuitArgs(
|
var args = CircuitArgs(
|
||||||
depth: 32, # maximum depth of the slot tree
|
depth: 32, # maximum depth of the slot tree
|
||||||
maxslots: 256, # maximum number of slots
|
maxslots: 256, # maximum number of slots
|
||||||
@ -101,7 +103,7 @@ proc startBenchmarks*() =
|
|||||||
ncells: 512, # number of cells in this slot
|
ncells: 512, # number of cells in this slot
|
||||||
)
|
)
|
||||||
|
|
||||||
for i in 1 .. 9:
|
for i in 1 .. 2:
|
||||||
args.nsamples = i
|
args.nsamples = i
|
||||||
stdout.styledWriteLine(fgYellow, "\nbenchmarking args: ", $args)
|
stdout.styledWriteLine(fgYellow, "\nbenchmarking args: ", $args)
|
||||||
args.runBenchmark()
|
args.runBenchmark()
|
||||||
|
@ -47,7 +47,7 @@ template runit(cmd: string) =
|
|||||||
echo "STATUS: ", cmdRes
|
echo "STATUS: ", cmdRes
|
||||||
assert cmdRes == 0
|
assert cmdRes == 0
|
||||||
|
|
||||||
proc checkEnv*(env: var CircuitEnv) =
|
proc check*(env: var CircuitEnv) =
|
||||||
## check that the CWD of script is in the codex parent
|
## check that the CWD of script is in the codex parent
|
||||||
let codexProjDir = findCodexProjectDir()
|
let codexProjDir = findCodexProjectDir()
|
||||||
echo "\n\nFound project dir: ", codexProjDir
|
echo "\n\nFound project dir: ", codexProjDir
|
||||||
@ -171,7 +171,7 @@ when isMainModule:
|
|||||||
echo "findCodexProjectDir: ", findCodexProjectDir()
|
echo "findCodexProjectDir: ", findCodexProjectDir()
|
||||||
## test run creating a circuit
|
## test run creating a circuit
|
||||||
var env = CircuitEnv.default()
|
var env = CircuitEnv.default()
|
||||||
checkEnv(env)
|
env.check()
|
||||||
|
|
||||||
let args = CircuitArgs(
|
let args = CircuitArgs(
|
||||||
depth: 32, # maximum depth of the slot tree
|
depth: 32, # maximum depth of the slot tree
|
||||||
|
Loading…
x
Reference in New Issue
Block a user