From patchwork Tue Oct 10 17:27:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul A. Patience" X-Patchwork-Id: 54720 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 C28C127BBEA; Tue, 10 Oct 2023 18:29:27 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham 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 C94F727BBE2 for ; Tue, 10 Oct 2023 18:29:23 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qqGXD-0007m1-A1; Tue, 10 Oct 2023 13:28:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqGXB-0007lf-IR for guix-patches@gnu.org; Tue, 10 Oct 2023 13:28:41 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qqGXB-0005Pi-AL for guix-patches@gnu.org; Tue, 10 Oct 2023 13:28:41 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qqGXW-0001Ri-8U for guix-patches@gnu.org; Tue, 10 Oct 2023 13:29:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66449] [PATCH] gnu: nomad-optimizer: Update to 4.3.1. Resent-From: "Paul A. Patience" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 10 Oct 2023 17:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66449 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66449@debbugs.gnu.org Cc: "Paul A. Patience" X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16969589205525 (code B ref -1); Tue, 10 Oct 2023 17:29:02 +0000 Received: (at submit) by debbugs.gnu.org; 10 Oct 2023 17:28:40 +0000 Received: from localhost ([127.0.0.1]:36853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qqGX9-0001R3-5f for submit@debbugs.gnu.org; Tue, 10 Oct 2023 13:28:40 -0400 Received: from lists.gnu.org ([2001:470:142::17]:53396) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qqGX4-0001Qk-6d for submit@debbugs.gnu.org; Tue, 10 Oct 2023 13:28:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqGWd-0007gt-3B for guix-patches@gnu.org; Tue, 10 Oct 2023 13:28:07 -0400 Received: from mail-4018.proton.ch ([185.70.40.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqGWY-0005IG-Kd for guix-patches@gnu.org; Tue, 10 Oct 2023 13:28:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apatience.com; s=protonmail2; t=1696958879; x=1697218079; bh=D9bdB0vUU9mA6GZH6t2BqS3R8BWQIpY9dUF8QiuE8QQ=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=IUMiqDxhCgSntQOIiFsbffyfsWHV6s339Xjx6MU4Txs3rvGAFetmisl72tssTzJH9 5A+1avhkpEDGY/pxeMZhVcS2xAX4qWEvN7NGIMzfMnVwcAiTLPKZ58zwYi1Q19X/GK L6B8N/RwQ8bSESMc1yCWTmRqOtj1O9Ra8l/xIfhQQrFkXKVDYUoSf+y9s/Sw5lak3i TtlxfVI/gaYqC+EF9N58Ay5MVdF/BhYbs5azsxx19712DhgUB3bzhI/EwK6irNr//3 bVfIerUqeyXvVJeboJSGu8HUqevM4oz+Rkp1U0L5+ZN72cCp2EsaROcx07sLlAI+IH S58g4sw7lMSUA== Date: Tue, 10 Oct 2023 17:27:45 +0000 From: "Paul A. Patience" Message-ID: Feedback-ID: 19227857:user:proton MIME-Version: 1.0 Received-SPF: pass client-ip=185.70.40.18; envelope-from=paul@apatience.com; helo=mail-4018.proton.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/maths.scm (nomad-optimizer): Update to 4.3.1. [native-inputs]: Remove python-wrapper and python-cython. Add openmpi. [arguments]: Use G-expressions. Remove #:imported-modules and #:modules. <#:configure-flags>: Remove -DBUILD_INTERFACE_PYTHON=ON. <#:phases>: Remove 'fix-sources-for-build' phase. Rename 'fix-sources-for-tests' phase to 'fix-tests' and update it. Add 'mpi-setup' phase. --- gnu/packages/maths.scm | 257 ++++++++++++++++------------------------- 1 file changed, 101 insertions(+), 156 deletions(-) base-commit: f4e8baf3806e79d7111d2943859865ae4ee0b59d diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 928e169e95..f3ee861811 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -2420,7 +2420,7 @@ (define-public ipopt (define-public nomad-optimizer (package (name "nomad-optimizer") - (version "4.2.0") + (version "4.3.1") (source (origin (method git-fetch) @@ -2429,164 +2429,109 @@ (define-public nomad-optimizer (commit (string-append "v." version)))) (file-name (git-file-name name version)) (sha256 - (base32 - "1r4ygy3xn83dnppsw1451ynklsxpb238g5gk57inn84ghmdk08mj")))) + (base32 "08bxdvx8p5qzdw331xa5irc1896as4q5hajsid7f3qcxjm4nq4v3")))) (build-system cmake-build-system) (native-inputs - (list python-wrapper python-cython)) + (list openmpi)) (arguments - `(#:imported-modules ((guix build python-build-system) - ,@%cmake-build-system-modules) - #:modules (((guix build python-build-system) - #:select (python-version site-packages)) - (guix build cmake-build-system) - (guix build utils)) - #:configure-flags - '("-DBUILD_INTERFACE_C=ON" - "-DBUILD_INTERFACE_PYTHON=ON" - "-DBUILD_TESTS=ON") - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'fix-sources-for-build - (lambda* (#:key outputs #:allow-other-keys) - (substitute* "CMakeLists.txt" - ;; CMAKE_INSTALL_PREFIX is accidentally hardcoded. - (("set\\(CMAKE_INSTALL_PREFIX .* FORCE\\)") "") - ;; Requiring GCC version 8 or later is unwarranted. - (("message\\(FATAL_ERROR \"GCC version < 8") - "message(STATUS \"GCC version < 8")) - - (let ((out (assoc-ref outputs "out"))) - (substitute* "interfaces/PyNomad/CMakeLists.txt" - ;; We don't want to build in-place, and anyway the install - ;; command further below runs build_ext as a prerequisite. - (("COMMAND python setup_PyNomad\\.py .* build_ext --inplace\n") - "") - ;; Don't install locally. - (("COMMAND python (setup_PyNomad\\.py .* install) --user\n" - _ args) - (string-append "COMMAND ${CMAKE_COMMAND} -E env" - " CC=" ,(cc-for-target) - " CXX=" ,(cxx-for-target) - " " (which "python") - " " args - " --prefix=" out - "\n"))) - ;; Fix erroneous assumptions about the paths of the include and - ;; library directories. - (substitute* "interfaces/PyNomad/setup_PyNomad.py" - (("^( +os_include_dirs = ).*" _ prefix) - (string-append prefix "[\"../../src\"]\n")) - (("^(installed_lib_dir1 = ).*" _ prefix) - (string-append prefix "\"" out "/lib\"\n")) - (("^installed_lib_dir2 = .*") "") - (("^ +link_args\\.append\\(\"-Wl,-rpath,\" \\+ installed_lib_dir2\\)\n") - ""))))) - - ;; Fix the tests so they run in out-of-source builds. - ;; - ;; TODO: Add support for examples/basic/batch/single_obj_MPIparallel, - ;; by adding openmpi to native-inputs and adjusting the example's - ;; BB_EXE parameter. - (add-after 'fix-sources-for-build 'fix-sources-for-tests - (lambda _ - (substitute* "examples/CMakeLists.txt" - ;; This test passes only sometimes. - ;; See https://github.com/bbopt/nomad/issues/72. - (("^ +add_subdirectory\\(\\$\\{CMAKE_CURRENT_SOURCE_DIR\\}/advanced/library/PSDMads\\)\n") - "") - ;; examples/basic/batch/example3 is accidentally omitted. - (("^(add_subdirectory\\(\\$\\{CMAKE_CURRENT_SOURCE_DIR\\}/basic/batch/example)2(\\)\n)" - _ prefix suffix) - (string-append prefix "2" suffix - prefix "3" suffix)) - - ;; The generated runExampleTest.sh script runs the test as part - ;; of a pipeline and incorrectly (because pipefail is unset) - ;; relies on the value of the exit status immediately after the - ;; pipeline. - ;; (The patch-shebangs phase runs later than this one, so no - ;; need to update the path to bash here.) - (("#!/bin/bash") "#!/bin/bash\nset -o pipefail")) - - (substitute* - (map (lambda (d) (string-append "examples/" d "/CMakeLists.txt")) - (append - (map (lambda (d) (string-append "basic/library/" d)) - '("example1" "example2" "example3" - "single_obj_parallel")) - (map (lambda (d) (string-append "advanced/library/" d)) - '("FixedVariable" "NMonly" "PSDMads" "Restart" - "c_api/example1" "c_api/example2" - "exampleSuggestAndObserve")))) - ;; The runExampleTest.sh script is run with WORKING_DIRECTORY - ;; set to CMAKE_CURRENT_SOURCE_DIR. - ;; Other scripts invoked by that script (for example - ;; examples/advanced/batch/SuggestAndObserve/loopSuggestAndObserve.sh) - ;; are in that same directory, but compiled examples are - ;; located in CMAKE_CURRENT_BINARY_DIR. - (("(COMMAND \\$\\{CMAKE_BINARY_DIR\\}/examples/runExampleTest\\.sh )\\.(/.*)" - _ command test) - (string-append command "${CMAKE_CURRENT_BINARY_DIR}" test))) - - ;; The examples/basic/batch/example3 executable is already named - ;; bb3.exe. - (substitute* "examples/basic/batch/single_obj_parallel/CMakeLists.txt" - (("bb3.exe") "bb_parallel.exe")) - - ;; (Unrelated to support for out-of-source testing.) - (make-file-writable - "examples/advanced/library/exampleSuggestAndObserve/cache0.txt") - - (let ((builddir (string-append (getcwd) "/../build"))) - (let ((dir "examples/advanced/library/FixedVariable")) - (substitute* (string-append dir "/fixedVariable.cpp") - (("^( +std::string sExe = ).*" _ prefix) - (string-append prefix "\"" builddir "/" dir "/ufl.exe" "\";\n")))) - - ;; The BB_EXE and SURROGATE_EXE paths are interpreted relative - ;; to the configuration file provided to NOMAD. - ;; However, the configuration files are all in the source tree - ;; rather than in the build tree (unlike the compiled - ;; executables). - (let ((fix-exe-path (lambda* (dir #:optional - (file "param.txt") - (exe-opt "BB_EXE")) - (substitute* (string-append dir "/" file) - (((string-append "^" exe-opt " +")) - ;; The $ prevents NOMAD from prefixing - ;; the executable with the path of the - ;; parent directory of the configuration - ;; file NOMAD was provided with as - ;; argument (param.txt or some such). - (string-append exe-opt " $" - builddir "/" dir "/")))))) - (for-each - (lambda (dir) - (let ((dir (string-append "examples/" dir))) - (substitute* (string-append dir "/CMakeLists.txt") - ;; The install phase has not yet run. - (("COMMAND \\$\\{CMAKE_INSTALL_PREFIX\\}/bin/nomad ") - "COMMAND ${CMAKE_BINARY_DIR}/src/nomad ")) - (fix-exe-path dir) - (when (equal? dir "examples/basic/batch/surrogate_sort") - (fix-exe-path dir "param.txt" "SURROGATE_EXE")))) - (append (map (lambda (d) (string-append "basic/batch/" d)) - '("example1" "example2" "example3" - "single_obj" - "single_obj_parallel" - ;; "single_obj_MPIparallel" - "surrogate_sort")) - '("advanced/batch/LHonly"))) - - (let ((dir "examples/advanced/batch/FixedVariable")) - (substitute* (string-append dir "/runFixed.sh") - ;; Hardcoded path to NOMAD executable. - (("^\\.\\./\\.\\./\\.\\./\\.\\./bin/nomad ") - (string-append builddir "/src/nomad "))) - (for-each - (lambda (f) (fix-exe-path dir f)) - '("param1.txt" "param2.txt" "param3.txt" "param10.txt")))))))))) + (list + ;; Cannot build Python interface because it is incompatible with OpenMP + ;; support, which is enabled by default. + #:configure-flags + #~(list "-DBUILD_TESTS=ON" + "-DBUILD_INTERFACE_C=ON") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'fix-tests + (lambda _ + (substitute* "examples/CMakeLists.txt" + ;; This test passes only sometimes. + ;; See https://github.com/bbopt/nomad/issues/72. + (("^ +add_subdirectory\\(\\$\\{CMAKE_CURRENT_SOURCE_DIR\\}/advanced/library/PSDMads\\)\n") + "")) + (make-file-writable + "examples/advanced/library/exampleSuggestAndObserve/cache0.txt") + ;; Fix the tests so they run in out-of-source builds. + (substitute* + '("examples/basic/library/COCO/CMakeLists.txt" + "examples/basic/library/example1/CMakeLists.txt" + "examples/basic/library/example2/CMakeLists.txt" + "examples/basic/library/example3/CMakeLists.txt" + "examples/basic/library/example4/CMakeLists.txt" + "examples/basic/library/single_obj_parallel/CMakeLists.txt" + "examples/advanced/library/FixedVariable/CMakeLists.txt" + "examples/advanced/library/NMonly/CMakeLists.txt" + "examples/advanced/library/PSDMads/CMakeLists.txt" + "examples/advanced/library/Restart/CMakeLists.txt" + "examples/advanced/library/Restart_VNS/CMakeLists.txt" + "examples/advanced/library/c_api/example1/CMakeLists.txt" + "examples/advanced/library/c_api/example2/CMakeLists.txt" + "examples/advanced/library/exampleSuggestAndObserve/CMakeLists.txt") + ;; The runExampleTest.sh script is run with WORKING_DIRECTORY + ;; set to CMAKE_CURRENT_SOURCE_DIR. + ;; Other scripts invoked by that script (for example + ;; examples/advanced/batch/SuggestAndObserve/loopSuggestAndObserve.sh) + ;; are in that same directory, but compiled examples are + ;; located in CMAKE_CURRENT_BINARY_DIR. + (("(COMMAND \\$\\{CMAKE_BINARY_DIR\\}/examples/runExampleTest\\.sh )\\.(/.*)" + _ command test) + (string-append command "${CMAKE_CURRENT_BINARY_DIR}" test))) + (let ((builddir (string-append (getcwd) "/../build"))) + (let ((dir "examples/advanced/library/FixedVariable")) + (substitute* (string-append dir "/fixedVariable.cpp") + (("^( +std::string sExe = ).*" _ prefix) + (string-append prefix "\"" builddir "/" dir "/ufl.exe" "\";\n")))) + ;; The BB_EXE and SURROGATE_EXE paths are interpreted relative + ;; to the configuration file provided to NOMAD. + ;; However, the configuration files are all in the source tree + ;; rather than in the build tree (unlike the compiled + ;; executables). + (let ((fix-exe-path (lambda* (dir #:optional + (file "param.txt") + (exe-opt "BB_EXE")) + (substitute* (string-append dir "/" file) + (((string-append "^" exe-opt " +")) + ;; The $ prevents NOMAD from prefixing + ;; the executable with the path of the + ;; parent directory of the configuration + ;; file NOMAD was provided with as + ;; argument (param.txt or some such). + (string-append exe-opt " $" + builddir "/" dir "/")))))) + (for-each + (lambda (dir) + (substitute* (string-append dir "/CMakeLists.txt") + ;; The install phase has not yet run. + (("(COMMAND.*)\\$\\{CMAKE_INSTALL_PREFIX\\}/bin/nomad\\b" + _ prefix) + (string-append prefix "${CMAKE_BINARY_DIR}/src/nomad"))) + (if (equal? dir "examples/basic/batch/single_obj_MPIparallel") + (substitute* (string-append dir "/param.txt") + (("^BB_EXE +'\\$.*mpirun \\$-np \\$4 ") + (string-append "BB_EXE '$" (which "mpirun") " $" + builddir "/" dir "/"))) + (fix-exe-path dir)) + (when (equal? dir "examples/basic/batch/surrogate_sort") + (fix-exe-path dir "param.txt" "SURROGATE_EXE")) + (when (equal? dir "examples/advanced/batch/FixedVariable") + (fix-exe-path dir "param1.txt") + (fix-exe-path dir "param2.txt") + (fix-exe-path dir "param3.txt") + (fix-exe-path dir "param10.txt"))) + '("examples/basic/batch/coco_bbob-constrained" + "examples/basic/batch/example1" + "examples/basic/batch/example2" + "examples/basic/batch/example3" + "examples/basic/batch/multi_obj" + "examples/basic/batch/multi_obj2" + "examples/basic/batch/single_obj" + "examples/basic/batch/single_obj_MPIparallel" + "examples/basic/batch/single_obj_parallel" + "examples/basic/batch/surrogate_sort" + "examples/advanced/batch/FixedVariable" + "examples/advanced/batch/LHonly")))))) + (add-before 'configure 'mpi-setup + #$%openmpi-setup)))) (home-page "https://www.gerad.ca/nomad/") (synopsis "Nonlinear optimization by mesh-adaptive direct search") (description