Package: src:pyzoltan
Version: 1.0.1-5
Severity: important
Tags: ftbfs

Dear maintainer:

During a mass-rebuild of all packages in bookworm, this
package failed to build in this way:

[...]
          raise RuntimeError(msg)
E           RuntimeError: test geometric_partitioner.py failed with returncode 1

pyzoltan/tools/run_parallel_script.py:54: RuntimeError
----------------------------- Captured stdout call -----------------------------
running test: ['mpiexec', '-n', '2', '/usr/bin/python3.11', 
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_pyzoltan/build/pyzoltan/core/tests/geometric_partitioner.py']

--------------------------------------------------------------------------
There are not enough slots available in the system to satisfy the 2
slots that were requested by the application:

  /usr/bin/python3.11

Either request fewer slots for your application, or make more slots
available for use.
[...]

Apparently the package is assuming I have at least 2 CPUs,
but I have only one, and build-essential does not imply multi-core.


I tried to fix this by honoring parallel=n in DEB_BUILD_OPTIONS,
since that's the recommended way to support parallelism
when building Debian packages.

The result is in the attached patches, but they don't work.

When I use those patches, build with a single-cpu now works,
but build in my desktop PC, which has 6 cores (12 threads)
fails in this way:

---------------------------------------------------------------

pyzoltan/tools/run_parallel_script.py:56: RuntimeError
----------------------------- Captured stdout call -----------------------------
running test: ['mpiexec', '-n', '12', '/usr/bin/python3.11', 
'/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_pyzoltan/build/pyzoltan/core/tests/geometric_partitioner.py']

--------------------------------------------------------------------------
There are not enough slots available in the system to satisfy the 12
slots that were requested by the application:

---------------------------------------------------------------


Considering that the package takes less than one minute to build,
my proposal to fix this (for everybody) would be to just disable
parallelism. Honoring parallel=n in DEB_BUILD_OPTIONS makes
sense for big packages (or even medium-sized). For small packages
like this one, there is not a great saving.

To reproduce the problem please try GRUB_CMDLINE_LINUX="nr_cpus=1",
that's an extremely easy way to test it in a machine with a single CPU.

[ Note: I'd like to fix this in stable, and I will gladly care
about the stable upload, but once we know how to fix this properly
in trixie/sid ].

Thanks.
--- a/debian/rules
+++ b/debian/rules
@@ -4,7 +4,11 @@ export DEB_BUILD_MAINT_OPTIONS=hardening=+all
 export USE_TRILINOS=1
 export ZOLTAN_INCLUDE=/usr/include/trilinos
 export ZOLTAN_LIBRARY=/usr/lib
-NPROCS?=2
+
+NPROCS = 1
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+  NPROCS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+endif
 export NPROCS
 
 export PYBUILD_NAME=pyzoltan
--- /dev/null
+++ b/debian/patches/0004-fix-nprocs.patch
@@ -0,0 +1,20 @@
+--- pyzoltan-1.0.1.orig/pyzoltan/tools/run_parallel_script.py
++++ pyzoltan-1.0.1/pyzoltan/tools/run_parallel_script.py
+@@ -4,6 +4,8 @@ from subprocess import Popen, PIPE
+ import sys
+ from threading import Timer
+ 
++import os
++nprocs = int(os.environ.get('NPROCS', '1'))
+ 
+ def get_directory(file):
+     return dirname(abspath(file))
+@@ -14,7 +16,7 @@ def kill_process(process):
+     process.kill()
+ 
+ 
+-def run(filename, args=None, nprocs=2, timeout=30.0, path=None):
++def run(filename, args=None, nprocs=nprocs, timeout=30.0, path=None):
+     """Run a python script with MPI or in serial (if nprocs=1).  Kill process
+     if it takes longer than the specified timeout.
+ 
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 0001-Fix-nprocs.patch
 0002-Package-data.patch
 0003-Spelling.patch
+0004-fix-nprocs.patch

Reply via email to