Skip to content

Conversation

FrederickPu
Copy link

Able to process multiple commands at once using

{ "cmds": ["theorem womp : 2 + 2 = 4 := by rfl", "#eval 0 = 2"]}

Also added multithreading parallelism using Task monad as well as option to garbage collect command snapshots (this overlaps with #83.

Batch commands have timeouts to prevent one bad proof from stalling the batch which overlaps with #92.
Timeouts are in milliseconds and can be set using an option

{ "cmds": ["theorem womp : 2 + 2 = 4 := by rfl", "#eval 0 = 2"], "timeout": 6000}

Right now, there is no command snapshotting for batch commands.

@FrederickPu
Copy link
Author

see README.md for more details about all of the available config options for batch commands

@augustepoiroux
Copy link
Contributor

Amazing feature, thanks for sharing it!
A few comments:

  • There is a typo: parrallel -> parallel
  • I see you pushed some python code and text files for testing. I don't have a strong opinion on mixing the REPL with python code, but maybe not everyone would agree, just telling you in case ^^

@FrederickPu
Copy link
Author

the python code is just for benchmarking, I can get rid of it before we merge (and generate a corresponding .in file) before we merge

@vadimkantorov
Copy link

One useful option could also be something along the lines of "skip processing elements if an earlier example got verified okay". This can be useful for verifying multiple proofs for the same problem produced by whole-proof completeion LLMs (e.g. 32 or 256 or several thousand roll-outs). Sometimes we are already satisfied if we found a single proof and for time-saving, all further proofs of the given problem can be skipped

@augustepoiroux
Copy link
Contributor

augustepoiroux commented Apr 29, 2025

I agree this can be a useful feature. This can be implemented with IO.waitAny, and then cancelling the other jobs (hoping the jobs will cooperate though). Nevermind, it is not that straightforward as the first job to finish may fail.

@FrederickPu
Copy link
Author

i think to do this efficiently you would need to poll each pending task to see if it has yielded a successful result at regular intervals kind of like I do for the withTimeout function

@augustepoiroux
Copy link
Contributor

This sounds like a good practical approach. I wonder if there is a more efficient way of doing this though.
For example, regarding timeout, I think I prefer the approach in #92. IO.waitAny is used to terminate as soon as the command or the timeout terminate instead of checking at regular intervals.

@vadimkantorov
Copy link

One useful option could also be something along the lines of "skip processing elements if an earlier example got verified okay".

It could also be good to process the batch in micro-batches (when configured) - so that the CPU utilization can be maximized. When I ran REPL, I got typically 10% utilization of a single CPU core. So bringing it up would be useful.

Another question is multi-core processing. Then maybe proofs should be annotated with problem-name, so that simultaneously multiple micro-batches from different problems can be processed

@augustepoiroux
Copy link
Contributor

If you look at the readme file in this PR, I think @FrederickPu already implemented that through the "buckets" parameter

@FrederickPu
Copy link
Author

If you look at the readme file in this PR, I think @FrederickPu already implemented that through the "buckets" parameter

When running in parallel mode on a VM with 300+ cores I max out at a 7x speedup. So I'm not sure if core level parallelism is being acheived

@FrederickPu
Copy link
Author

Should we do thread level parallelism within each bucket?

@kim-em kim-em marked this pull request as draft May 1, 2025 15:17
{ "cmds": ["theorem womp : 2 + 2 = 4 := by rfl", "theorem womp1 : 2 + 4 = 6 := by rfl"]}
```

All the same options from Command can be used and will be applied to each command in the `cmds` array. Additionally, you can specify the parrallelism mode using `mode`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parallel has 1 r.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants