Closed pveber closed 3 years ago
I'm also running into this (and the CI does), I haven't found a good solution so what I do is just running only a single process when compiling the large files (via dune -j 1
), and setting ulimit -s unlimited
so that the stack can grow as large as it needs.
The files are certainly large, that said it does not happen on the rust version of this library so maybe it's an issue within the compiler - I haven't reported anything to the compiler github so far.
Increasing the stack memory helps here:
$ ulimit -s 16384
So it's easy to fix, but more users of the library might stumble into the same problem once the next version will be released. Also I noticed that this step of the compilation requires more than 6 GB of RAM on my machine. I think we could derive a useful example to help the compiler team improve the compiler's performance.
Sorry I just saw your answer, thanks! Right, I think a report would be useful, this is really unusual performance. The thing is to reproduce the problem requires a few dependencies, I'm not sure what would be the useful form of reporting the problem to the compiler team.
Right, reporting it is likely to be useful but probably requires a bit of work to derive a "standalone" example. If you want to take a stab at it, please go ahead, otherwise I'll try to have a go at it when I find some time but it's unlikely to be in the next few weeks.
Done! It's not pretty, but it's standalone :). I'm filing a report now.
Thanks, this was super fast!
Following up on the discussion in https://github.com/ocaml/ocaml/issues/10072 I've tweaked the code generation to generate multiple functors (each with less than 100 included functions) rather than a single one, and combine them in the end. This seems to get rid of the stack overflow issue for me.
Closing this as this should hopefully be fixed now, feel free to re-open should you run into any further issues.
I can confirm the problem is gone, thanks a lot!
When trying to build the current master (corresponding to pytorch 1.7), I get a stack overflow from the compiler for
src/wrapper/torch_bindings_generated.ml
. It is indeed a very long file, but still I'm surprised. Here is the backtrace:I'm a bit puzzled because it is short, while I'd expected it to be very long since there's a stack overflow. Have you also met this problem at some point? There might be something fishy with my environment I don't know, but at least if I comment a part of the file it compiles fine.