diff mbox series

[bug#39862,v3,2/2] gnu: define dune-*-openmpi packages

Message ID 20200312210513.107891-3-felgru@posteo.net
State Accepted
Headers show
Series Add dune-*-openmpi packages | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Felix Gruber March 12, 2020, 9:05 p.m. UTC
* gnu/packages/maths.scm (dune-*-openmpi): New variables.
* gnu/packages/maths.scm (add-openmpi-to-dune-package): New function to
  add openmpi to the inputs of a dune-* package and replace all dune-*
  packages in its input with the corresponding dune-*-openmpi package.
---
 gnu/packages/maths.scm | 53 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

Comments

Ludovic Courtès March 13, 2020, 9:42 a.m. UTC | #1
Hi Felix,

Felix Gruber <felgru@posteo.net> skribis:

> * gnu/packages/maths.scm (dune-*-openmpi): New variables.
> * gnu/packages/maths.scm (add-openmpi-to-dune-package): New function to
>   add openmpi to the inputs of a dune-* package and replace all dune-*
>   packages in its input with the corresponding dune-*-openmpi package.

Nitpick: no need to repeat the file name above.  It would also be great
if you could list all the new variables.

> +      (lambda (p) (not (dune-package? p))))))

You can replace the lambda with:

  (negate dune-package?)

One last thing: could you look at the output of, say, ‘guix graph
dune-geometry-openmpi’ and ensure we’re not duplicating more nodes than
needed in the graph?

For example, you can compare node counts with:

  guix graph dune-geometry | grep 'label =' | wc -l
  guix graph dune-geometry-openmpi | grep 'label =' | wc -l

The difference should be less than:

  guix graph openmpi | grep 'label =' | wc -l

If that works well, please send an updated patch and we should be ready
to go!

Thanks,
Ludo’.
Felix Gruber March 13, 2020, 5:26 p.m. UTC | #2
Hi Ludo’,

On 3/13/20 10:42 AM, Ludovic Courtès wrote:
> Felix Gruber <felgru@posteo.net> skribis:
> 
>> * gnu/packages/maths.scm (dune-*-openmpi): New variables.
>> * gnu/packages/maths.scm (add-openmpi-to-dune-package): New function to
>>   add openmpi to the inputs of a dune-* package and replace all dune-*
>>   packages in its input with the corresponding dune-*-openmpi package.
> 
> Nitpick: no need to repeat the file name above.  It would also be great
> if you could list all the new variables.

Sure, no problem.

>> +      (lambda (p) (not (dune-package? p))))))
> 
> You can replace the lambda with:
> 
>   (negate dune-package?)

Thanks for this hint, as I'm new to Scheme, my knowledge of its standard
library is still pretty limited. The negate function is quite useful.

> One last thing: could you look at the output of, say, ‘guix graph
> dune-geometry-openmpi’ and ensure we’re not duplicating more nodes than
> needed in the graph?
> 
> For example, you can compare node counts with:
> 
>   guix graph dune-geometry | grep 'label =' | wc -l
>   guix graph dune-geometry-openmpi | grep 'label =' | wc -l
> 
> The difference should be less than:
> 
>   guix graph openmpi | grep 'label =' | wc -l
> 
> If that works well, please send an updated patch and we should be ready
> to go!

I get the following numbers:

 graph dune-geometry | grep 'label =' | wc -l
 70

 guix graph dune-geometry-openmpi | grep 'label =' | wc -l
 143

 guix graph openmpi | grep 'label =' | wc -l
 137

The difference seems to be OK: 143 - 70 = 73 < 137.

I'll send the updated patch ASAP.

Best Regards,
Felix
Ludovic Courtès March 13, 2020, 9:28 p.m. UTC | #3
Hi,

Felix Gruber <felgru@posteo.net> skribis:

>>> +      (lambda (p) (not (dune-package? p))))))
>> 
>> You can replace the lambda with:
>> 
>>   (negate dune-package?)
>
> Thanks for this hint, as I'm new to Scheme, my knowledge of its standard
> library is still pretty limited.

Sure, I think sharing knowledge is one of the goals of review.

>> One last thing: could you look at the output of, say, ‘guix graph
>> dune-geometry-openmpi’ and ensure we’re not duplicating more nodes than
>> needed in the graph?
>> 
>> For example, you can compare node counts with:
>> 
>>   guix graph dune-geometry | grep 'label =' | wc -l
>>   guix graph dune-geometry-openmpi | grep 'label =' | wc -l
>> 
>> The difference should be less than:
>> 
>>   guix graph openmpi | grep 'label =' | wc -l
>> 
>> If that works well, please send an updated patch and we should be ready
>> to go!
>
> I get the following numbers:
>
>  graph dune-geometry | grep 'label =' | wc -l
>  70
>
>  guix graph dune-geometry-openmpi | grep 'label =' | wc -l
>  143
>
>  guix graph openmpi | grep 'label =' | wc -l
>  137
>
> The difference seems to be OK: 143 - 70 = 73 < 137.

Looks good, thanks!

Ludo’.
diff mbox series

Patch

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 33a5efd2f0..ac89064a7f 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -5027,6 +5027,59 @@  built on top of DUNE, the Distributed and Unified Numerics Environment.")
     ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
     (license (list license:lgpl3+ license:gpl2))))
 
+(define add-openmpi-to-dune-package
+  (let ((dune-package?
+          (lambda (p) (string-prefix? "dune-" (package-name p)))))
+    (package-mapping
+      (lambda (p)
+        (if (dune-package? p)
+            (package (inherit p)
+              (name (string-append (package-name p) "-openmpi"))
+              (inputs `(,@(package-inputs p)
+                        ("openmpi" ,openmpi)))
+              (arguments
+               (substitute-keyword-arguments (package-arguments p)
+                 ((#:phases phases '%standard-phases)
+                  `(modify-phases ,phases
+                     (add-before 'check 'mpi-setup
+                       ,%openmpi-setup)))))
+              (synopsis (string-append (package-synopsis p) " (with MPI support)")))
+            p))
+      (lambda (p) (not (dune-package? p))))))
+
+(define-public dune-common-openmpi
+  (add-openmpi-to-dune-package dune-common))
+
+(define-public dune-geometry-openmpi
+  (add-openmpi-to-dune-package dune-geometry))
+
+(define-public dune-istl-openmpi
+  (add-openmpi-to-dune-package dune-istl))
+
+(define-public dune-typetree-openmpi
+  (add-openmpi-to-dune-package dune-typetree))
+
+(define-public dune-uggrid-openmpi
+  (add-openmpi-to-dune-package dune-uggrid))
+
+(define-public dune-grid-openmpi
+  (add-openmpi-to-dune-package dune-grid))
+
+(define-public dune-alugrid-openmpi
+  (add-openmpi-to-dune-package dune-alugrid))
+
+(define-public dune-subgrid-openmpi
+  (add-openmpi-to-dune-package dune-subgrid))
+
+(define-public dune-localfunctions-openmpi
+  (add-openmpi-to-dune-package dune-localfunctions))
+
+(define-public dune-functions-openmpi
+  (add-openmpi-to-dune-package dune-functions))
+
+(define-public dune-pdelab-openmpi
+  (add-openmpi-to-dune-package dune-pdelab))
+
 (define-public mlucas
   (package
     (name "mlucas")