Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel preprocessing and parsing #589

Open
1 of 2 tasks
sim642 opened this issue Feb 3, 2022 · 0 comments
Open
1 of 2 tasks

Parallel preprocessing and parsing #589

sim642 opened this issue Feb 3, 2022 · 0 comments
Assignees
Labels
parallel Parallel Goblint performance Analysis time, memory usage

Comments

@sim642
Copy link
Member

sim642 commented Feb 3, 2022

In the context of interactive analysis, minimizing the wall time of preprocessing and parsing of large projects with many files would be beneficial. But this would also be useful non-incrementally.

Parallel preprocessing

Currently we use Unix.system to run the preprocessor, but this function waits until that subprocess terminates to start preprocessing the next file. Such sequentialization is completely unnecessary and could be performed in parallel instead.

Doing so doesn't require running any OCaml code in parallel! Instead we could use functions from here: https://ocaml.org/api/Unix.html#1_Highlevelprocessandredirectionmanagement. We could easily start all the preprocessor subprocesses first and not wait for any termination in between. And then wait for all of them to terminate. This is completely OS-level subprocess management, with no parallelism or even concurrency inside Goblint.

Parallel parsing

CIL's parsing is implemented in OCaml, so it's not as simple to parallelize. But again, there might not be a need to wait for Multicore OCaml. Instead one of these libraries might be sufficient:

What they do instead of Multicore OCaml is to fork the Goblint process, open a socket pair between the parent and child process and execute different (parsing) code in the forked child process. Then the resulting OCaml data structure is sent back to the parent Goblint process through the socket (using Marshal). These libraries completely automate that process and make it transparent.

This should work because parsing the individual files is an independent process. No data needs to be continuously shared on the OCaml heap, so the concurrent GC of Multicore OCaml isn't needed either.


TODO

  • Parallel preprocessing
  • Parallel parsing
@sim642 sim642 added the performance Analysis time, memory usage label Feb 3, 2022
@sim642 sim642 self-assigned this Feb 16, 2022
sim642 added a commit that referenced this issue Feb 16, 2022
sim642 added a commit that referenced this issue Feb 16, 2022
@sim642 sim642 linked a pull request Mar 7, 2022 that will close this issue
@sim642 sim642 added the parallel Parallel Goblint label Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parallel Parallel Goblint performance Analysis time, memory usage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant