tags 1042029 + patch
thanks
Hi. This is the patch I had in mind, inspired
by the code in the llvm-toolchain-nn packages,
but simplified a little bit.
The code takes available memory and divides it by 10000 MB,
so that at most 10000 MB of RAM are used per CPU.
For example, on a machine of type r7a.large from AWS,
which has 16 GB of RAM and 2 CPUs, the code will make it
to use 1 CPU, because there is not enough RAM to use 2 CPUs.
Thanks.
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+graph-tool (2.77+ds-2) unstable; urgency=medium
+
+ * Team upload.
+ * Limit RAM per CPU ratio to 10000 MB / CPU. Closes: #1042029.
+
+ -- Jerome Benoit <calcu...@rezozer.net> Tue, 15 Oct 2024 02:15:00 +0200
+
graph-tool (2.77+ds-1) unstable; urgency=medium
* New upstream release (Closes: #1077450).
--- a/debian/rules
+++ b/debian/rules
@@ -25,6 +25,11 @@ endif
##CPPFLAGS += -mxgot --param ggc-min-expand=10
##endif
+MEM_PER_CPU = 10000
+NCPUS := $(or $(subst parallel=,,$(filter
parallel=%,$(DEB_BUILD_OPTIONS))),$(shell nproc))
+NJOBS := $(shell awk -vn=$(NCPUS) -vm=$(MEM_PER_CPU) \
+ '/^MemAvail/ { n2 = int($$2/1024/m); print (n==1 || n2<=1 ? 1 : n2<=n ? n2 :
n) }' /proc/meminfo)
+
default:
@uscan --no-conf --dehs --report || true
@@ -40,6 +45,9 @@ override_dh_auto_configure:
--with-sparsehash-prefix=google \
--with-boost-python=boost_python$(PY3DOTLESSVERSION)
+override_dh_auto_build:
+ dh_auto_build -- -j $(NJOBS)
+
override_dh_auto_test:
true