Skip to content

file-based portfolio synchronisation#540

Merged
quickbeam123 merged 10 commits intomasterfrom
michael-portfolio-synchronisation
May 3, 2024
Merged

file-based portfolio synchronisation#540
quickbeam123 merged 10 commits intomasterfrom
michael-portfolio-synchronisation

Conversation

@MichaelRawson
Copy link
Contributor

See #462. We currently synchronise child Vampires and their proof printing by UNIX semaphores, which are quite complex beasts. However, C11 (and therefore C++17) can synchronise on a file by passing an "x"clusive flag to fopen: if the file exists, fopen will fail. Note that the standard only says "to the extent the platform supports exclusive access", but it seems to work quite well in practice.

Therefore:

  1. We determine a path that should be written to. This is either what the user requested or a temporary file.
  2. We delete it if it exists!
  3. The first child to not find that file creates it and writes its proof there.
  4. Other children find the file and do not print a proof.
  5. The parent Vampire knows the path and reads from it once all children have finished (one way or another).

I think this is simpler and certainly more portable, but of course it needs lots of testing: it would be a silly way to lose problems.

@MichaelRawson MichaelRawson changed the title Michael portfolio synchronisation file-based portfolio synchronisation Mar 20, 2024
@MichaelRawson
Copy link
Contributor Author

To explain the signal-handling change: currently we handle many different signals with very similar but slightly different code. This looks more like organic growth over time rather than something intentionally complex, so I've streamlined it. There are now only two broad classes of signal we handle:

  1. Exit now, silently: SIGHUP (portfolio parent died), SIGINT (Ctrl-C), SIGTERM (polite termination), and SIGXCPU (we're being warned that we've used an external resource limit and are about to be killed). SIGXCPU has moved from the other class, I don't think we want to special-case this.
  2. Crash of some kind: everything else, including SIGQUIT as apparently that's an abnormal halt intended to be used for debugging. Here we print a stack trace, indicate something to Spider, etc.

@quickbeam123
Copy link
Collaborator

quickbeam123 commented Apr 12, 2024

Since you already polished the signals, could you please give me back the feature we used to have, that Vampire reports statistics (if asked) and termination reason on CTRL+C?

(This should be obvious in vampire mode, not sure how complex it is in portfolio mode? Does the CTRL+C reach the master if there are many competing workers spawned from it?)

@quickbeam123 quickbeam123 merged commit 1f43c82 into master May 3, 2024
@quickbeam123 quickbeam123 deleted the michael-portfolio-synchronisation branch May 3, 2024 10:14
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.

2 participants