From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Woodcroft Subject: Re: CPU-specific builds Date: Mon, 10 Oct 2016 23:45:53 +1000 Message-ID: <612094dc-bcdb-b9a2-292c-501b897bcf21@uq.edu.au> References: <5985e2f0-edd3-c40b-bb10-f84b233bb48d@uq.edu.au> <871szyho3h.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------C24784D5B9563C8696217C49" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btau8-0005oG-JO for guix-devel@gnu.org; Mon, 10 Oct 2016 09:46:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btau2-00024P-Iw for guix-devel@gnu.org; Mon, 10 Oct 2016 09:46:07 -0400 In-Reply-To: <871szyho3h.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: =?UTF-8?Q?Ludovic_Court=c3=a8s?= Cc: "guix-devel@gnu.org" This is a multi-part message in MIME format. --------------C24784D5B9563C8696217C49 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by newmailhub.uq.edu.au id u9ADjuKX024747 Thanks for the responses Ludo and Eric. On 02/10/16 23:33, Ludovic Court=C3=A8s wrote: >> Currently, we build a single set of x86_64 packages assuming SSE but >> not SSE2 instructions, but sometimes it would be nice to use more >> recent instructions like AVX. > Isn=E2=80=99t SSE2 part of the x86_64 base spec? I always forget. I don't think so. I always refer to Mark's comment when I forget: https://lists.gnu.org/archive/html/guix-devel/2016-07/msg01534.html >> So I'm wondering if there is some way to specify a system more >> specific than 'X86_64'? I tried simply adding '--with-arch=3Dhaswell' = as >> a configure argument in gcc-4.9 so that flag became the default for >> gcc usage and saw some performance improvements, though I did have to >> disable tests in gnutls. > Do you have performance figures for some CPU-intensive applications? > > What software are you most interested in? We tend to run software whose runtime is dependent on the input data, so=20 it is hard to say. But up to days or weeks of walltime in some cases. It=20 takes a lot of power researching climate change.. As an anecdote, adding "-march=3Dhaswell" shaved 13% off the runtime of=20 diamond, ~20% if the CPUs were contended. >> Hardcoding that configure flag is definitely less than ideal, I'm >> wondering if there is some better way that would enable us to share >> package updates and even substitutes for these systems? My initial >> thought is extending the triplet 'x86_64-unknown-linux-gnu' somehow, >> but I suspect others have better ideas? > I=E2=80=99m not sure how to do this. Having, say, an x86_64avx-linux s= ystem > type (not triplet) would be impractical because it would be entirely > separate from x86_64-linux (different derivations). Yes my original plan was to rebuild all packages locally, but that was=20 probably too optimistic as I reckon there will be too much work involved=20 in maintaining it. > Ideally, software for which using these CPU extensions makes a > significant difference would do what glibc does, which is to provide > several implementations of the relevant functions (one for SSE2, one fo= r > AVX, etc.) and have the right one be selected at load time via an IFUNC > or similar mechanism. That sounds useful in some cases, but it is probably too much of a=20 stretch for most bioinformatics packages. In the end I think I'll just compile the specific packages we are=20 specifically interested in. I attached some example code in case anyone=20 is interested. But this brought up a few questions: 1) I also tried using --expression e.g. guix build --expression '(@@ (my=20 packages cpu-specific) diamond-cpu-specific)' but that fails to compile=20 as if the GUIX_PACKAGE_PATH is ignored, is that unexpected? 2) Is something amiss with gcc-toolchain-6? Compiling with it, diamond=20 complains of a missing stdlib.h. Thanks, ben --------------C24784D5B9563C8696217C49 Content-Type: text/x-scheme; name="cpu-specific.scm" Content-Disposition: attachment; filename="cpu-specific.scm" Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by newmailhub.uq.edu.au id u9ADjuKX024747 ;;; Copyright =C2=A9 2016 Ben Woodcroft ;;; ;;; This code is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (ben packages cpu-specific) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix utils) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix hg-download) #:use-module (guix build-system ant) #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) #:use-module (guix build-system perl) #:use-module (guix build-system python) #:use-module (guix build-system r) #:use-module (guix build-system ruby) #:use-module (guix build-system trivial) #:use-module (gnu packages) #:use-module (gnu packages autotools) #:use-module (gnu packages algebra) #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages bison) #:use-module (gnu packages boost) #:use-module (gnu packages commencement) #:use-module (gnu packages compression) #:use-module (gnu packages cpio) #:use-module (gnu packages curl) #:use-module (gnu packages documentation) #:use-module (gnu packages datastructures) #:use-module (gnu packages file) #:use-module (gnu packages gawk) #:use-module (gnu packages gcc) #:use-module (gnu packages gd) #:use-module (gnu packages gtk) #:use-module (gnu packages glib) #:use-module (gnu packages groff) #:use-module (gnu packages image) #:use-module (gnu packages imagemagick) #:use-module (gnu packages java) #:use-module (gnu packages linux) #:use-module (gnu packages logging) #:use-module (gnu packages machine-learning) #:use-module (gnu packages man) #:use-module (gnu packages maths) #:use-module (gnu packages mpi) #:use-module (gnu packages ncurses) #:use-module (gnu packages pcre) #:use-module (gnu packages parallel) #:use-module (gnu packages pdf) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages popt) #:use-module (gnu packages protobuf) #:use-module (gnu packages python) #:use-module (gnu packages readline) #:use-module (gnu packages ruby) #:use-module (gnu packages serialization) #:use-module (gnu packages statistics) #:use-module (gnu packages tbb) #:use-module (gnu packages tex) #:use-module (gnu packages texinfo) #:use-module (gnu packages textutils) #:use-module (gnu packages time) #:use-module (gnu packages tls) #:use-module (gnu packages vim) #:use-module (gnu packages web) #:use-module (gnu packages xml) #:use-module (gnu packages xorg) #:use-module (gnu packages zip) #:use-module (srfi srfi-1) #:use-module (gnu packages bioinformatics)) ;; "sandybridge" for Ben's laptop (define cpu "sandybridge") (define-public gcc-cpu-specific (let ((base gcc-5)) ; gcc-6 does not seem to work. (package (inherit base) (name "gcc-cpu-specific") (arguments (substitute-keyword-arguments (package-arguments base) ((#:configure-flags configure-flags) `(append ,configure-flags (list (string-append "--with-arch=3D" ,cpu))))))))) (define-public (cpu-specific-package base-package) (package (inherit base-package) (name (package-name base-package)) ;; We must set a higher package version so this package is used inste= ad of ;; the package in Guix proper. (version (string-append (package-version base-package) "-cpu-specific= ")) (inputs `(,@(package-inputs base-package) ("gcc" ,((@@ (gnu packages commencement) gcc-toolchain) gcc-cpu-specific)))))) (define-public diamond-cpu-specific (cpu-specific-package diamond)) (define-public fasttree-cpu-specific (cpu-specific-package fasttree)) (define-public blast+-cpu-specific (cpu-specific-package blast+)) (define-public bwa-cpu-specific (cpu-specific-package bwa)) (define-public metabat-cpu-specific (cpu-specific-package metabat)) --------------C24784D5B9563C8696217C49--