Bug#965215: Use --max-parallel based on available ram

Markus Blatt markus at dr-blatt.de
Fri Jan 13 19:42:22 GMT 2023


Hi,

On Sat, 18 Jul 2020 19:54:07 +0200 Gianfranco Costamagna <locutusofborg at debian.org> wrote:
> On Sat, 18 Jul 2020 10:09:34 +0200 Ansgar <ansgar at debian.org> wrote:
> > On Fri, 2020-07-17 at 20:03 +0200, Gianfranco Costamagna wrote:
> > > Hello, dune-common is FTBFS in Ubuntu and on systems where there is not enough ram, because of OOM killer.
> > 

I don't think this problem is limited to dune-common or Ubuntu. It occurs for
e.g. dealii or OPM even for some Debian build machines (e.g. arm). That is
quite unfortunate.

> > > Can you please consider adding --max-parallel=3 to dh invocation?
> > > 
> > > People might want to rebuild on their system without having to swap during the build process.
> > 
> > That might require parallel=1 depending on the system anyway.  I
> > usually build with parallel=8 without problems, so I don't want to
> > limit it to 3.
> mmm what about doing something like this?
> ifeq ($(shell dpkg-vendor --is Ubuntu && echo yes),yes)
> 	dh $@ --builddirectory=build --max-parallel=3
> else
> 	dh $@ --builddirectory=build
> endif

Maybe we should rather base that on the assumed max ram needed per process.
Say that is e.g. 4 Gigabyte then one could do something similar to

free_ram = $(shell free -g | sed -n 2p| sed "s/ \+/ /g"| cut -d " " -f 2)
max_procs = $(shell echo $(free_ram)/4 | bc)
%:
	dh $@ --builddirectory=build --max-parallel=$(max_procs)

Would that work?
Would need some trial and error of course...

Best,

Markus



More information about the debian-science-maintainers mailing list