From patchwork Sat Dec 4 20:49:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 34965 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A555727BBEA; Sat, 4 Dec 2021 20:50:53 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6316427BBE9 for ; Sat, 4 Dec 2021 20:50:53 +0000 (GMT) Received: from localhost ([::1]:38720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtbzg-0006xC-IY for patchwork@mira.cbaines.net; Sat, 04 Dec 2021 15:50:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtbyv-0005vj-9V for guix-patches@gnu.org; Sat, 04 Dec 2021 15:50:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:43690) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mtbyu-0001lC-W7 for guix-patches@gnu.org; Sat, 04 Dec 2021 15:50:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mtbyu-0003cd-Ub for guix-patches@gnu.org; Sat, 04 Dec 2021 15:50:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#52283] [PATCH 08/10] gnu: Add ceres-solver-benchmarks. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 04 Dec 2021 20:50:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52283 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 52283@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 52283-submit@debbugs.gnu.org id=B52283.163865099313840 (code B ref 52283); Sat, 04 Dec 2021 20:50:04 +0000 Received: (at 52283) by debbugs.gnu.org; 4 Dec 2021 20:49:53 +0000 Received: from localhost ([127.0.0.1]:55225 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mtbyi-0003b4-OE for submit@debbugs.gnu.org; Sat, 04 Dec 2021 15:49:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34744) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mtbyd-0003ZG-SX for 52283@debbugs.gnu.org; Sat, 04 Dec 2021 15:49:48 -0500 Received: from [2001:470:142:3::e] (port=45348 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtbyY-0001hZ-J4; Sat, 04 Dec 2021 15:49:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=x5ZSt0wehn96SrZtXhYGFsauGAHgWBl6QHdHJN/P6Og=; b=Pl9KpyZ83CtncWI/GvH8 +tJzvV++961Eu/a6ZeVTqdwyZsIperyMYEZey8C+XkYQE46KvGp5qgIHhEoyrU2FDOyAtzzlo6l+Q cDqZJybn05K9aX5gFbsjjs+wbik4KHhAuhFJQpBoXMhg3fhq5Q52TPfAu16ONcQkLqYQcPhX60S+v UBekvK8En8/n7hC1gpPmoeSmXeQpoMTb4nMLVQ93ruLE+j1sy3kcVX58feeIxFopKoQHbNqZBxtyw 6QKyOh5SqjO7TE4T59+Kxz6P4KeT3i/GSR/6tvWMvZsLnDjc5wJ/R3X4UP/iZw9sFymfRwlQIItER ccXF6u7Qa026DQ==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=45592 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mtbyY-00059z-Ey; Sat, 04 Dec 2021 15:49:42 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 4 Dec 2021 21:49:22 +0100 Message-Id: <20211204204924.15581-8-ludo@gnu.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211204204924.15581-1-ludo@gnu.org> References: <20211204204924.15581-1-ludo@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/maths.scm (ceres-solver-benchmarks): New variable. --- gnu/packages/maths.scm | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 19dab598c6..06bdb8ed92 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -2401,6 +2401,50 @@ (define-public ceres ;; Mark as tunable to take advantage of SIMD code in Eigen. (properties `((tunable? . #t))))) +(define-public ceres-solver-benchmarks + (package + (inherit ceres) + (name "ceres-solver-benchmarks") + (arguments + '(#:modules ((ice-9 popen) + (ice-9 rdelim) + (guix build utils) + (guix build cmake-build-system)) + + #:phases (modify-phases %standard-phases + (delete 'configure) + (replace 'build + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + (define flags + (string-tokenize + (read-line (open-pipe* OPEN_READ + "pkg-config" "eigen3" + "--cflags")))) + + (define (compile-file file) + (let ((source (string-append file ".cc"))) + (format #t "building '~a'...~%" file) + (apply invoke "c++" "-fopenmp" "-O2" "-g" "-DNDEBUG" + source "-lceres" "-lbenchmark" "-lglog" + "-pthread" + "-o" (string-append bin "/" file) + "-I" ".." flags))) + + (mkdir-p bin) + (with-directory-excursion "internal/ceres" + (for-each compile-file + '("small_blas_gemm_benchmark" + "small_blas_gemv_benchmark" + "autodiff_cost_function_benchmark")))))) + (delete 'check) + (delete 'install)))) + (inputs `(("googlebenchmark" ,googlebenchmark) + ("ceres-solver" ,ceres) + ,@(package-inputs ceres))) + (synopsis "Benchmarks of the Ceres optimization problem solver"))) + ;; For a fully featured Octave, users are strongly recommended also to install ;; the following packages: less, ghostscript, gnuplot. (define-public octave-cli