[PATCH] fenics: Do not use mpirun for tests

DoneSubmitted by Ontje.Luensdorf.
Details
3 participants
  • Ontje.Luensdorf
  • Ludovic Courtès
  • Paul A. Patience
Owner
unassigned
Severity
normal
O
O
Ontje.Luensdorf wrote on 27 Jun 13:24 +0200
(address . guix-patches@gnu.org)
87bkuefiwu.fsf@dlr.de
Hi guix,


the fenics package tests fail and it looks like the tests are run 3
times concurrently. Every test name is printed three times in the build
log, for example here:


This is the maximum number of parallel jobs of the test run and if I
increase it, I get more print outputs.

AFAIK, pytest doesn't support mpi, so I don't see why the tests are
executed this way.

Anyhow, in the attached patch, the tests are executed directly using
pytest. This prevents the tests from getting stuck and subsequently I
discovered a failure in XDMF tests. With this test also disabled, the
package builds fine for me.

Maybe a fenics or mpi expert can tell if this patch makes sense?

Best regards,
Ontje
From 8dd11596851ab5a7ae1d483b9883894a9bd4d4ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ontje=20L=C3=BCnsdorf?= <ontje.luensdorf@dlr.de>
Date: Mon, 27 Jun 2022 11:51:10 +0200
Subject: [PATCH] gnu: fenics: Do not mpirun tests.
* gnu/packages/simulation.scm (fenics)[phases]: Do not use mpirun for tests
and skip failing XDMF test.
---
gnu/packages/simulation.scm | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
Toggle diff (32 lines)
diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index 9e92fbcc5b..df4dd2d17a 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -665,15 +665,14 @@ (define-public fenics
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?
                (with-directory-excursion "test"
-                 ;; Note: The test test_snes_set_from_options() in the file
-                 ;; unit/nls/test_PETScSNES_solver.py fails and is ignored.
-                 ;; Limit the number of jobs to 3 as 500 MiB of memory is used
-                 ;; per process.
-                 (invoke "mpirun" "-np" (number->string
-                                         (min 3 (parallel-job-count)))
-                         "python" "-B" "-m"
-                         "pytest" "unit" "--ignore"
-                         "unit/nls/test_PETScSNES_solver.py")))))
+                 (invoke
+                  "pytest" "unit"
+                  ;; The test test_snes_set_from_options() in the file
+                  ;; unit/nls/test_PETScSNES_solver.py fails and is ignored.
+                  "--ignore" "unit/nls/test_PETScSNES_solver.py"
+                  ;; Fails with a segfault.
+                  "--ignore" "unit/io/test_XDMF.py"
+                  )))))
          (add-after 'install 'install-demo-files
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((demos (string-append
base-commit: 97766323bc6e2b4dcfba4d6b46749a4280bca709
-- 
2.36.1
L
L
Ludovic Courtès wrote on 4 Jul 12:18 +0200
(address . Ontje.Luensdorf@dlr.de)
87fsjhfaf7.fsf@gnu.org
Hi,

<Ontje.Luensdorf@dlr.de> skribis:

Toggle quote (12 lines)
> the fenics package tests fail and it looks like the tests are run 3
> times concurrently. Every test name is printed three times in the build
> log, for example here:
>
> https://ci.guix.gnu.org/build/1039880/log/raw
>
> This is the maximum number of parallel jobs of the test run and if I
> increase it, I get more print outputs.
>
> AFAIK, pytest doesn't support mpi, so I don't see why the tests are
> executed this way.

Good question. Paul, do you remember the reasons for doing so?

Toggle quote (5 lines)
> Anyhow, in the attached patch, the tests are executed directly using
> pytest. This prevents the tests from getting stuck and subsequently I
> discovered a failure in XDMF tests. With this test also disabled, the
> package builds fine for me.

Let’s see what Paul thinks, and otherwise I’ll apply the patch shortly
so fenics can be installed again.

Thanks,
Ludo’.
P
P
Paul A. Patience wrote on 5 Jul 14:43 +0200
[bug#56257] [PATCH] fenics: Do not use mpirun for tests
(address . 56257@debbugs.gnu.org)
87mtdnu4af.fsf@apatience.com
Hi,

Ludovic Courtès writes:
Toggle quote (2 lines)
> Good question. Paul, do you remember the reasons for doing so?

If I'm the Paul you're referring to, it would be better to CC me in the
future, as I'm not subscribed to the list and only intermittently check
it (which happens more often when I'm submitting patches).

Toggle quote (8 lines)
>> Anyhow, in the attached patch, the tests are executed directly using
>> pytest. This prevents the tests from getting stuck and subsequently I
>> discovered a failure in XDMF tests. With this test also disabled, the
>> package builds fine for me.
>
> Let’s see what Paul thinks, and otherwise I’ll apply the patch shortly
> so fenics can be installed again.

Actually, I'm not the original author of the fenics package; I just
added support for #:tests? (and fixed the sanity check), so I don't know
why the tests are run with mpirun.
However, the reason I had added support for the #:tests?
flag is to skip the fenics tests, which were failing for me.
I'm no expert in MPI and pytest, but it does seem that pytest_mpi [1] is
recommended when combining the two, and there are no instances of
@pytest.mark.mpi in the fenics repository.
Further, running pytest tests under MPI is accomplished with [2]:

mpirun -n 2 python -m pytest --with-mpi

In other words, it seems as if the current tests are repeated in
parallel, as Ontje discovered.

The patch looks good to me.

Best regards,
Paul

L
L
Ludovic Courtès wrote on 3 Aug 12:04 +0200
Re: bug#56257: [PATCH] fenics: Do not use mpirun for tests
(name . Paul A. Patience)(address . paul@apatience.com)
87a68lve0t.fsf_-_@gnu.org
Hi,

(Sorry for the delay.)

"Paul A. Patience" <paul@apatience.com> skribis:

Toggle quote (7 lines)
> Ludovic Courtès writes:
>> Good question. Paul, do you remember the reasons for doing so?
>
> If I'm the Paul you're referring to, it would be better to CC me in the
> future, as I'm not subscribed to the list and only intermittently check
> it (which happens more often when I'm submitting patches).

I actually Cc’d Paul Garlick, but maybe Debbugs ate the Cc: field?

Toggle quote (12 lines)
> I'm no expert in MPI and pytest, but it does seem that pytest_mpi [1] is
> recommended when combining the two, and there are no instances of
> @pytest.mark.mpi in the fenics repository.
> Further, running pytest tests under MPI is accomplished with [2]:
>
> mpirun -n 2 python -m pytest --with-mpi
>
> In other words, it seems as if the current tests are repeated in
> parallel, as Ontje discovered.
>
> The patch looks good to me.

Alright, applied.

Thanks!

Ludo’.
Closed
?