I was going to try and play around with coq-fiat-crypto.0.0.15
on Coq 8.15, but I quickly got this compilation issue, seemingly during compilation of code extracted to OCaml:
Fatal error: exception Stack overflow
make: *** [Makefile:596: src/ExtractionOCaml/saturated_solinas] Error 2
make: *** Waiting for unfinished jobs....
Is it because I use OCaml with flambda maybe? What is the recommended OCaml version?
for the record:
ocaml-option-flambda 1 Set OCaml to be compiled with flambda activated
ocaml-variants 4.13.1+options Official release of OCaml 4.13.1
If Flambda just needs some more stack, increasing your soft ulimit on stack size. For instance, my hard limit is 64MB, my soft limit is 8MB, and I can raise the soft one:
$ ulimit -H -s
65520
$ ulimit -S -s
8176
$ ulimit -S -s 16384
$ ulimit -S -s
16384
If Flambda just needs some more stack, increasing your soft ulimit on stack size. For instance, my hard limit is 64MB, my soft limit is 8MB, and I can raise the soft one:
$ ulimit -H -s
65520
$ ulimit -S -s
8176
$ ulimit -S -s 16384
$ ulimit -S -s
16384
(this is from a Mac, but the same commands should work on Linux)
Yeah, those particular Makefile targets run out of stack easily on the default soft limits. I should tag a new release; I recently added a warning suggesting an increase in stack size for those targets.
OK, yes, that needs to be flagged up somewhere for sure, preferably also in the opam package description
maybe the Makefile have wrapper targets that automate that — I agree that can't work for all systems, but it probably would work for many?
strawman:
all_wrapped:
$(SHELL) -c "ulimit -S -s 16384; $(MAKE) all"
for flambda, 16384 was not enough... succeeded with 32768
Yes, in Coq Platform (which has lambda enabled), I also needed 32M stack size for fiat-crypto. 16M would not do. Since we are talking Ms and not Gs here, I don't see a good reason for not being a bit generous.
I've made https://github.com/mit-plv/fiat-crypto/pull/1430
Does this mean I can remove the ulimit calls from Coq Platform?
Not until I tag a new release and update the opam package
(and merge the PR)
I had 2023.03 in mind ...
Yeah, once 1430 is merged, you can remove the calls to ulimit. Btw, do you know if there's a conf-* opam package to require to make sure ulimit is available?
there's no conf-ulimit
or similar to my knowledge. I suppose we could create one, preferably in the OCaml repo, but could otherwise live in the Platform repo....
I would create one in the OCaml main repo - in my experience they are very open to such things and arguably this is really useful for OCaml.
as per discussion here, it seems bash is already assumed in many opam packages, and there is no obvious conf-
for ulimit.
@Michael Soegtrop I have merged https://github.com/coq/opam-coq-archive/pull/2352 so when you use fiat-crypto 0.0.16, you should no longer need ulimit
@Jason Gross : should I change it in the 2022.09 release. The beta is out. I usually don't change packages from beta to release without a good reason, but for a new and experimental package I don't see issues doing so if you recommend it.
I think in this case it might be worth changing (actually let me release 0.0.17, there's a bug in the ulimit script that makes it always be invoked in 0.0.16). The main improvement is that the most RAM-intensive file now takes under 3GB RAM instead of over 5GB RAM. This is probably worth picking up for people building from source? There's very little of note changed beyond that.
OK, sounds good. Can you please reopen https://github.com/coq/platform/issues/178 and leave a note there, both to document the decisions and to make sure I don't forget to update?
Last updated: Oct 08 2024 at 15:02 UTC