• Bug#1110031: pynx: Bug in autopktest for command sbuild

    From Clement LONGEAC@21:1/5 to All on Mon Jul 28 13:50:04 2025
    Package: pynx
    Version: 2025.1-2
    Severity: important
    X-Debbugs-Cc: [email protected]

    Dear Maintainer,

    *** Reporter, please consider answering these questions, where appropriate ***

    * What led up to the situation?

    I am in an internship at Synchrotron-Soleil , my directors are Frederic- Emmanuel PICCA and Emmanuel FARHI. I implemented Rocm and Pocl autopkgtest for architecture amd64 and arm64. And I would like to push it.
    I implemented autopktests for rocm and pocl using Opencl on the package named on local. The aim is to have an overview of code compatibility with various AMD graphics cards, the codes on all the AMD boards available for CI rocm for GPU and Pocl for CPU.

    * What exactly did you do (or not do) that was effective (or ineffective)?

    I implemented the autopkgtest dependencies for pynx in debian/tests/control

    debian/tests/control:

    # flaky test for now

    Test-Command: rocm-test-launcher debian/tests/opencl
    Depends:
    @,
    clinfo,
    rocm-opencl-icd,
    pkg-rocm-tools,
    python3-all,
    python3-pytest,
    python3-pytest-mock,
    python3-pytest-xvfb,
    python-pycuda-doc,
    xauth,
    xvfb,
    hipcc,
    rocm-device-libs-17,
    libclang-common-17-dev,
    Architecture: i386 amd64 arm64
    Features: test-name=opencl-rocm
    Restrictions: allow-stderr,flaky, skip-not-installable, skippable

    Test-Command: debian/tests/opencl
    Depends:
    @,
    clinfo,
    pocl-opencl-icd,
    python3-all,
    python3-pytest,
    python3-pytest-mock,
    python3-pytest-xvfb,
    python-pycuda-doc,
    xauth,
    hipcc,
    xvfb,
    Features: test-name=opencl-pocl
    Architecture: i386 amd64 arm64
    Restrictions: allow-stderr,flaky, skip-not-installable, skippable

    Test-Command: xvfb-run -s "-screen 0 1024x768x24 -ac +extension GLX +render -noreset" sh debian/tests/gui
    Depends:
    debhelper,
    mesa-utils,
    pocl-opencl-icd,
    pynx,
    python3-all,
    @,
    xauth,
    xvfb,
    python-pycuda-doc,
    Architecture: i386 amd64 arm64
    Restrictions: allow-stderr, flaky, skip-not-installable, skippable

    I also made pacthes because we have a couple of errors of code :

    ------------------------- pynx/ptycho/runner/tps25a.py -------------------------
    index 77076dd..394c9ae 100644
    @@ -149,6 +149,8 @@ class PtychoRunnerTPS25A(PtychoRunner):
    Returns: Nothing. Will raise an exception if necessary
    """
    if self.params['scanfile'] is None:
    - raise PtychoRunnerException('Missing argument: no scanfile given') + # raise PtychoRunnerException('Missing argument: no scanfile given')
    + pass
    if self.params['data'] is None:
    - raise PtychoRunnerException('Missing argument: no data (hdf5 master) given')
    + # raise PtychoRunnerException('Missing argument: no data (hdf5 master) given')
    + pass

    ------------------------- debian/patches/series -------------------------
    -1,2 +1,4 @@
    +0001-pynx_tps25apty.py-delete-of-helptext_generic.patch
    0002-relax-h5py-scipy-pyopencl-dependency-for-backportabl.patch
    0002-fix-for-hermes.patch +0004-pynx_tps25apty.py-Deleted-helptext_generic.patch

    ------------------------- pynx/ptycho/runner/runner.py -------------------------
    index abda6df..3b68cea 100644
    @@ -103,6 +103,7 @@ default_params = {
    'saveplot': False,
    'saveprefix': 'ResultsScan{scan:04d}/Run{run:04d}',
    'scan': None,
    + 'scanfile': None,
    'stack_size': None,
    'verbose': 50,
    'xy': None,

    pynx_tps25apty.py Deleted helptext_generic

    Because we have no helptext_generic in pynx/ptycho/runner
    Replace generic_params by default_params

    ---------------- pynx/ptycho/examples/LLK-Stats-AutoMask.ipynb ---------------- index 94cac66..a30a7eb 100644
    @@ -62,7 +62,7 @@
    "\n",
    "# Import CXI runner\n",
    "from pynx.ptycho.runner.cxi import PtychoRunnerScanCXI\n",
    - "from pynx.ptycho.runner.runner import params_generic as params\n",
    + "from pynx.ptycho.runner.runner import default_params as params\n",
    "\n",
    "from IPython.core.display import display, HTML\n",
    "display(HTML(\"<style>.container { width:80% !important; }</style>\"))"

    ----- pynx/ptycho/examples/ptycho_operators-cuda-opencl-compare-CXI.ipynb ----- index 6c5c55f..480321c 100644
    @@ -47,7 +47,7 @@
    "\n",
    "# Import CXI runner\n",
    "from pynx.ptycho.runner.cxi import PtychoRunnerScanCXI\n",
    - "from pynx.ptycho.runner.runner import params_generic as params\n",
    + "from pynx.ptycho.runner.runner import default_params as params\n",
    "\n",
    "# Load explicitely both OpenCL and CUDA operators\n",
    "import pynx.ptycho.cl_operator as clop\n",

    ------------------------- pynx/ptycho/runner/tps25a.py -------------------------
    index 0421d2f..77076dd 100644
    @@ -15,7 +15,7 @@ import timeit
    from ...utils import h5py
    import numpy as np

    -from .runner import PtychoRunner, PtychoRunnerScan, PtychoRunnerException, params_generic
    +from .runner import PtychoRunner, PtychoRunnerScan, PtychoRunnerException, default_params

    helptext_beamline = """
    Script to perform a ptychography analysis on data from 25A@TPS
    @@ -35,7 +35,7 @@ Command-line arguments (beamline-specific):
    params_beamline = {'scanfile': None, 'data': None, 'object': 'random,0.9,1,-.2,.2', 'instrument': 'TPS 25A',
    'h5data': 'entry/data/data_%06d'}

    -params = params_generic.copy()
    +params = default_params.copy()
    for k, v in params_beamline.items():
    params[k] = v


    -------------------- pynx/ptycho/scripts/pynx_tps25apty.py -------------------- index 484a738..86ccfa4 100644
    @@ -8,10 +8,10 @@


    import sys
    -from pynx.ptycho.runner import helptext_generic, PtychoRunnerException
    +from pynx.ptycho.runner import PtychoRunnerException
    from pynx.ptycho.runner.tps25a import PtychoRunnerTPS25A, PtychoRunnerScanTPS25A, helptext_beamline, params

    -help_text = helptext_generic + helptext_beamline
    +help_text = helptext_beamline


    def main():


    +-from pynx.ptycho.runner import helptext_generic, PtychoRunnerException
    ++from pynx.ptycho.runner import PtychoRunnerException
    + from pynx.ptycho.runner.tps25a import PtychoRunnerTPS25A, PtychoRunnerScanTPS25A, helptext_beamline, params
    +
    +-help_text = helptext_generic + helptext_beamline
    ++help_text = helptext_beamline
    +
    +
    + def main():

    * What was the outcome of this action?

    But I have a lot of bugs when tests are ran in autopkgtest is launched in sbuild


    * What outcome did you expect instead?

    For CPU

    test_cdi_analysis (pynx.cdi.runner.test.test_runner.TestCDIRunner.test_cdi_analysis) ...
    test_cdi_analysis (pynx.cdi.runner.test.test_runner.TestCDIRunner.test_cdi_analysis) (command='pynx-cdi-simulation --data2cxi --nbrun 3 --save final') ... FAIL
    test_cdi_analysis (pynx.cdi.runner.test.test_runner.TestCDIRunner.test_cdi_analysis) (options=[' --modes'], command='pynx-cdi-analysis --modes') ... FAIL
    -testing /usr/bin/pynx-test.py: exit(143) trapped (SIGTERM) This is not an error
    /usr/lib/python3/dist-packages/pytools/persistent_dict.py:52: RecommendedHashNotFoundWarning: Unable to import recommended hash 'siphash24.siphash13', falling back to 'hashlib.sha256'. Run 'python3 -m pip install siphash24' to install the recommended hash.
    warn("Unable to import recommended hash 'siphash24.siphash13', "
    Traceback (most recent call last):
    File "/usr/bin/pynx-tps25apty.py", line 33, in <module>
    sys.exit(load_entry_point('PyNX==2025.1', 'console_scripts', 'pynx- tps25apty.py')()) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
    File "/usr/lib/python3/dist-packages/pynx/ptycho/scripts/pynx_tps25apty.py", line 19, in main
    w = PtychoRunnerTPS25A(sys.argv, params, PtychoRunnerScanTPS25A)
    File "/usr/lib/python3/dist-packages/pynx/ptycho/runner/tps25a.py", line 142, in __init__
    super(PtychoRunnerTPS25A, self).__init__(argv, params)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
    File "/usr/lib/python3/dist-packages/pynx/ptycho/runner/runner.py", line 2652, in __init__
    self.check_params()
    ~~~~~~~~~~~~~~~~~^^
    File "/usr/lib/python3/dist-packages/pynx/ptycho/runner/runner.py", line 2800, in check_params
    self.check_params_beamline()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
    File "/usr/lib/python3/dist-packages/pynx/ptycho/runner/tps25a.py", line 151, in check_params_beamline
    if self.params['scanfile'] is None:
    ~~~~~~~~~~~^^^^^^^^^^^^
    KeyError: 'scanfile'
    -testing /usr/bin/pynx-tps25apty.py: exit(1) FAILED !!!


    Tests are laucnched but it has errors in the code such as values no allocated , or values not known in a dictionary. Autopkgtests are supposed to be ran without errors of source code. Errors are in the source code.

    These tests are very important because we have to know if opencl tests are able to run on AMD's GPU or not. And on opencl tests on CPU. With these bug we couldn't know it because it does not go beyond the stage of these bugs.


    -- System Information:
    Debian Release: 13.0
    APT prefers testing-security
    APT policy: (500, 'testing-security'), (500, 'testing')
    Architecture: amd64 (x86_64)

    Kernel: Linux 6.12.32-amd64 (SMP w/128 CPU threads; PREEMPT)
    Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
    Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
    Shell: /bin/sh linked to /usr/bin/dash
    Init: systemd (via /run/systemd/system)
    LSM: AppArmor: enabled

    Versions of packages pynx depends on:
    ii python3 3.13.5-1
    ii python3-pynx 2025.1-2

    pynx recommends no packages.

    pynx suggests no packages.

    -- no debconf information

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)