unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Emmanuel Agullo <emmanuel.agullo@inria.fr>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: ludovic.courtes@inria.fr, bavier@member.fsf.org,
	pgarlick@tourbillion-technology.com, 47237@debbugs.gnu.org
Subject: [bug#47237] [PATCH] gnu: metis: Use 64-bit floating pointer numbers on 64-bit architectures.
Date: Thu, 18 Mar 2021 16:27:22 +0100 (CET)	[thread overview]
Message-ID: <79577287.1930022.1616081242591.JavaMail.zimbra@inria.fr> (raw)
In-Reply-To: <20210318150246.7220-1-ludo@gnu.org>

Hello Ludo, hello everybody,

Thank you very much for this patch and discussion.

In numerical linear algebra in particular and hpc in
general, the trend is more and more to use reduced 
floating point arithmetic whenever possible (for memory 
footprint, communication volume and possibly computational 
time). I have no experience with using floating point 
numbers in partitioners such as metis. But I strongly 
suspect that a flexible usage will be requested (the 
same way it is often requested for integers). All in all, 
I would say that the number of bits for the architecture, 
the floating point numbers and the integers shall not 
(a priori) be related. In particular, I would say, in general, 
if a (high-quality) library (such as metis) exposes multiple 
choices, there are chances that users may want to
choose between them (for good reasons).

In the long run, it would be nice to have a naming
convention all over guix to make clear (and explicit)
for libraries that expose it which floating point
and integer arithmetic is being used. There can
hardly be a general rule (as some codes may even
decide to expose, say, part of the integers in
32 bits and another part in 64 bits), but it would
already be a great step to have a convention for
the "main" integer choice and "main" floating-point
choice. Something like mypackage_i32_r64 (if there
is a general convention (beyond guix) to follow,
even better). [It may even be great to use two versions
of the same package to facilitate mixed arithmetic, 
but we can certainly pospone that discussion as it
would certainly open two many issues for now].

In the short run, if there can be only one, I
let metis users playing with floating point
numbers comment on which one shall it be.

Hope this helps.

Thank you again.

Best regards,

Manu


----- Mail original -----
> De: "Ludovic Courtès" <ludo@gnu.org>
> À: guix-patches@gnu.org
> Cc: "Eric Bavier" <bavier@member.fsf.org>, "Emmanuel Agullo" <emmanuel.agullo@inria.fr>, "Paul Garlick"
> <pgarlick@tourbillion-technology.com>, "Ludovic Courtes" <ludovic.courtes@inria.fr>
> Envoyé: Jeudi 18 Mars 2021 16:02:46
> Objet: [PATCH] gnu: metis: Use 64-bit floating pointer numbers on 64-bit architectures.

> 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




  reply	other threads:[~2021-03-18 18:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79577287.1930022.1616081242591.JavaMail.zimbra@inria.fr \
    --to=emmanuel.agullo@inria.fr \
    --cc=47237@debbugs.gnu.org \
    --cc=bavier@member.fsf.org \
    --cc=ludo@gnu.org \
    --cc=ludovic.courtes@inria.fr \
    --cc=pgarlick@tourbillion-technology.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).