unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#47237] [PATCH] gnu: metis: Use 64-bit floating pointer numbers on 64-bit architectures.
@ 2021-03-18 15:02 Ludovic Courtès
  2021-03-18 15:27 ` Emmanuel Agullo
  2021-03-18 18:41 ` Paul Garlick
  0 siblings, 2 replies; 7+ messages in thread
From: Ludovic Courtès @ 2021-03-18 15:02 UTC (permalink / raw)
  To: 47237; +Cc: Emmanuel Agullo, Ludovic Courtès, Eric Bavier, Paul Garlick

From: Ludovic Courtès <ludovic.courtes@inria.fr>

* gnu/packages/maths.scm (metis)[arguments]: Add #:modules and #:phases.
---
 gnu/packages/maths.scm | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

Hi!

Metis defaults to 32-bit floating point numbers.  However, on 64-bit
platforms, users probably expect 64-bit floating point numbers, hence
this patch.

We could make it configurable through different variants or via package
parameters when they’re available, but I wonder about the usefulness of
a variant that uses 32-bit floats on 64-bit architectures.  Can we keep
just this one variant?

Thanks,
Ludo’.

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 565f109f47..4cd9112be9 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -12,7 +12,7 @@
 ;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
 ;;; Copyright © 2016, 2018, 2020 Kei Kebreau <kkebreau@posteo.net>
-;;; Copyright © 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2016, 2017 Thomas Danckaert <post@thomasdanckaert.be>
 ;;; Copyright © 2017, 2018, 2019, 2020 Paul Garlick <pgarlick@tourbillion-technology.com>
@@ -3312,7 +3312,26 @@ YACC = bison -pscotchyy -y -b y
      `(#:tests? #f                      ;no tests
        #:configure-flags `("-DSHARED=ON"
                            ,(string-append "-DGKLIB_PATH=" (getcwd)
-                                           "/metis-" ,version "/GKlib"))))
+                                           "/metis-" ,version "/GKlib"))
+
+       #:modules ((system base target)
+                  (guix build cmake-build-system)
+                  (guix build utils))
+       #:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'set-real-type-width
+                    (lambda* (#:key build target #:allow-other-keys)
+                      ;; Enable 64-bit floating point numbers on 64-bit
+                      ;; architectures.  Leave the default 32-bit width on
+                      ;; other architectures.
+                      (let ((word-size
+                             (with-target (or target build %host-type)
+                               (lambda ()
+                                 (target-word-size)))))
+                        (when (= 8 word-size)
+                          (display "setting REALTYPEWIDTH to 64...\n")
+                          (substitute* "include/metis.h"
+                            (("define REALTYPEWIDTH.*$")
+                             "define REALTYPEWIDTH 64\n")))))))))
     (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
     (synopsis "Graph partitioning and fill-reducing matrix ordering library")
     (description
-- 
2.30.2





^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-25 17:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-18 15:02 [bug#47237] [PATCH] gnu: metis: Use 64-bit floating pointer numbers on 64-bit architectures Ludovic Courtès
2021-03-18 15:27 ` Emmanuel Agullo
2021-03-18 21:48   ` zimoun
2021-03-19 11:07     ` Emmanuel Agullo
2021-03-18 18:41 ` Paul Garlick
2021-03-19  9:37   ` Ludovic Courtès
2021-03-25 17:42     ` bug#47237: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).