[PATCH] gnu: Add nomad-optimizer.

DoneSubmitted by Paul A. Patience.
Details
2 participants
  • Ludovic Courtès
  • Paul A. Patience
Owner
unassigned
Severity
normal
P
P
Paul A. Patience wrote on 9 Jul 05:29 +0200
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
KXMnEx5vgiIGcIPbHtr8E4lOZzRXfDRZvUBLcsFW64RTK6oFeITfzaOyV858iMJlXRY7SnZGF2PxTM_jHnRUs3LVgtMyN5ewGZihf3fth1U=@apatience.com
Hi,
The attached patch adds the nomad-optimizer package.The actual program/library is called NOMAD, butthere is already a nomad package in Guix.
Best regards,Paul
From dda8093881cbc810516c06453bc0d3cc380bc8b5 Mon Sep 17 00:00:00 2001From: "Paul A. Patience" <paul@apatience.com>Date: Thu, 8 Jul 2021 23:22:30 -0400Subject: [PATCH] gnu: Add nomad-optimizer.
* gnu/packages/maths.scm (nomad-optimizer): New variable.--- gnu/packages/maths.scm | 148 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+)
Toggle diff (161 lines)diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scmindex b8e9a31be7..a54cb6f0cf 100644--- a/gnu/packages/maths.scm+++ b/gnu/packages/maths.scm@@ -1798,6 +1798,154 @@ large-scale nonlinear optimization. It provides C++, C, and Fortran interfaces.") (license license:epl2.0))) +(define-public nomad-optimizer+ (package+ (name "nomad-optimizer")+ (version "4.1.0")+ (source+ (origin+ (method git-fetch)+ (uri (git-reference+ (url "https://github.com/bbopt/nomad.git")+ (commit (string-append "v" version))))+ (file-name (git-file-name name version))+ (sha256+ (base32+ "0w386d8r5ldbvnv0c0g7vz95pfpvwdxis26vaalk2amsa5akl775"))))+ (build-system cmake-build-system)+ (native-inputs+ `(("python" ,python-wrapper)+ ("python-cython" ,python-cython)))+ (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_INTERFACES=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_dir = ).*" _ prefix)+ (string-append prefix "\"" out "/lib\"\n"))))+ #t))++ ;; Fix the tests so they run in out-of-source builds.+ (add-after 'fix-sources-for-build 'fix-sources-for-tests+ (lambda _+ (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 built examples are assumed to be in the source tree+ ;; (which isn't the case here).+ (("(COMMAND \\$\\{CMAKE_BINARY_DIR\\}/examples/runExampleTest\\.sh )\\.(/.*)"+ _ command test)+ (string-append command "${CMAKE_CURRENT_BINARY_DIR}" test)))+ ;; (Unrelated to support for out-of-source testing.)+ (make-file-writable+ "examples/advanced/library/exampleSuggestAndObserve/cache0.txt")++ (let* ((builddir (string-append (getcwd) "/../build"))+ ;; 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).+ (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"+ "single_obj" "single_obj_parallel"+ "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"))))+ #t))++ ;; The information in the .egg-info file is not kept up to date.+ (add-after 'install 'delete-superfluous-egg-info+ (lambda* (#:key inputs outputs #:allow-other-keys)+ (delete-file (string-append+ (site-packages inputs outputs)+ "PyNomad-0.0.0-py"+ (python-version (assoc-ref inputs "python"))+ ".egg-info"))+ #t)))))+ (home-page "https://www.gerad.ca/nomad/")+ (synopsis "Nonlinear optimization by mesh-adaptive direct search")+ (description+ "NOMAD is a C++ implementation of the mesh-adaptive direct search (MADS)+algorithm, designed for difficult blackbox optimization problems. These+problems occur when the functions defining the objective and constraints are+the result of costly computer simulations.")+ (license license:lgpl3)))+ (define-public cbc (package (name "cbc")-- 2.32.0
P
P
Paul A. Patience wrote on 9 Jul 05:43 +0200
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
jDdF7qt8piSU1VsKvav0ECJdiUWMdSdfuM5X1FMLR5D16uGXhKoKGhgZnT9h_WrywXBojTkIcwr7CgBsIVaKUa8WoKVTflt7a8NnFgrgVME=@apatience.com
On Thursday, July 8th, 2021 at 23:29, Paul A. Patience <paul@apatience.com> wrote:
Toggle quote (2 lines)> The attached patch adds the nomad-optimizer package.
I forgot to run guix lint.Here is the updated patch.
Unfortunately, guix lint complains about a long line,but forcing it to wrap would cause it to become moreunreadable, in my opinion.
Best regards,Paul
From 34a15bce446a401a5c6be60d1b6c8ce641709007 Mon Sep 17 00:00:00 2001From: "Paul A. Patience" <paul@apatience.com>Date: Thu, 8 Jul 2021 23:38:51 -0400Subject: [PATCH] gnu: Add nomad-optimizer.
* gnu/packages/maths.scm (nomad-optimizer): New variable.--- gnu/packages/maths.scm | 148 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+)
Toggle diff (161 lines)diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scmindex b8e9a31be7..6f761f9498 100644--- a/gnu/packages/maths.scm+++ b/gnu/packages/maths.scm@@ -1798,6 +1798,154 @@ large-scale nonlinear optimization. It provides C++, C, and Fortran interfaces.") (license license:epl2.0))) +(define-public nomad-optimizer+ (package+ (name "nomad-optimizer")+ (version "4.1.0")+ (source+ (origin+ (method git-fetch)+ (uri (git-reference+ (url "https://github.com/bbopt/nomad/")+ (commit (string-append "v" version))))+ (file-name (git-file-name name version))+ (sha256+ (base32+ "0w386d8r5ldbvnv0c0g7vz95pfpvwdxis26vaalk2amsa5akl775"))))+ (build-system cmake-build-system)+ (native-inputs+ `(("python" ,python-wrapper)+ ("python-cython" ,python-cython)))+ (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_INTERFACES=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_dir = ).*" _ prefix)+ (string-append prefix "\"" out "/lib\"\n"))))+ #t))++ ;; Fix the tests so they run in out-of-source builds.+ (add-after 'fix-sources-for-build 'fix-sources-for-tests+ (lambda _+ (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 built examples are assumed to be in the source tree+ ;; (which isn't the case here).+ (("(COMMAND \\$\\{CMAKE_BINARY_DIR\\}/examples/runExampleTest\\.sh )\\.(/.*)"+ _ command test)+ (string-append command "${CMAKE_CURRENT_BINARY_DIR}" test)))+ ;; (Unrelated to support for out-of-source testing.)+ (make-file-writable+ "examples/advanced/library/exampleSuggestAndObserve/cache0.txt")++ (let* ((builddir (string-append (getcwd) "/../build"))+ ;; 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).+ (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"+ "single_obj" "single_obj_parallel"+ "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"))))+ #t))++ ;; The information in the .egg-info file is not kept up to date.+ (add-after 'install 'delete-superfluous-egg-info+ (lambda* (#:key inputs outputs #:allow-other-keys)+ (delete-file (string-append+ (site-packages inputs outputs)+ "PyNomad-0.0.0-py"+ (python-version (assoc-ref inputs "python"))+ ".egg-info"))+ #t)))))+ (home-page "https://www.gerad.ca/nomad/")+ (synopsis "Nonlinear optimization by mesh-adaptive direct search")+ (description+ "NOMAD is a C++ implementation of the mesh-adaptive direct search (MADS)+algorithm, designed for difficult blackbox optimization problems. These+problems occur when the functions defining the objective and constraints are+the result of costly computer simulations.")+ (license license:lgpl3)))+ (define-public cbc (package (name "cbc")-- 2.32.0
L
L
Ludovic Courtès wrote on 19 Jul 19:33 +0200
Re: bug#49476: [PATCH] gnu: Add nomad-optimizer.
(name . Paul A. Patience)(address . paul@apatience.com)(address . 49476-done@debbugs.gnu.org)
87sg0aky41.fsf_-_@gnu.org
Hi Paul,
"Paul A. Patience" <paul@apatience.com> skribis:
Toggle quote (7 lines)> From 34a15bce446a401a5c6be60d1b6c8ce641709007 Mon Sep 17 00:00:00 2001> From: "Paul A. Patience" <paul@apatience.com>> Date: Thu, 8 Jul 2021 23:38:51 -0400> Subject: [PATCH] gnu: Add nomad-optimizer.>> * gnu/packages/maths.scm (nomad-optimizer): New variable.
Applied with one change:
Toggle quote (2 lines)> + (license license:lgpl3)))
This is ‘lgpl3+’ since source file headers carry the “or any laterversion” wording.
Thanks!
Ludo’.
Closed
L
L
Ludovic Courtès wrote on 23 Jul 11:03 +0200
(name . Paul A. Patience)(address . paul@apatience.com)(address . 49476@debbugs.gnu.org)
877dhhcsg6.fsf@gnu.org
Hi,
"Paul A. Patience" <paul@apatience.com> skribis:
Toggle quote (16 lines)> On Monday, July 19th, 2021 at 13:33, Ludovic Courtès <ludo@gnu.org> wrote:>>> Applied with one change:>>>> > - (license license:lgpl3)))>>>> This is ‘lgpl3+’ since source file headers carry the “or any later>> version” wording.>> Nice catch. I've reported this to the project authors [1].>> Best regards,> Paul>> [1]: https://github.com/bbopt/nomad/issues/52
Note that the LICENSE file is the standard LGPLv3 text; it should not bemodified. The text reads:
If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
In this case, headers explicitly specify “version 3 or any laterversion”. So I’d say the authors of nomad did “everything right”.
Thanks,Ludo’.
P
P
Paul A. Patience wrote on 24 Jul 00:08 +0200
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 49476@debbugs.gnu.org)
ssPlLps7w09dRVL1VTO17aO0uMah8lrWpsmGcdlbjHm66a13_TtG3pyPzSO_P32C0ulhv_O_uBL4T8OEY96PrN_qvUF4MPYGnhrqM_izkws=@apatience.com
On Friday, July 23rd, 2021 at 05:03, Ludovic Courtès <ludo@gnu.org> wrote:
Toggle quote (11 lines)> Note that the LICENSE file is the standard LGPLv3 text; it should not be> modified. The text reads:>> If the Library as you received it does not specify a version number of> the GNU Lesser General Public License, you may choose any version of> the GNU Lesser General Public License ever published by the Free> Software Foundation.>> In this case, headers explicitly specify “version 3 or any later> version”. So I’d say the authors of nomad did “everything right”.
My bad! I didn't know about this.Thank you for the clarification.
Best regards,Paul
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send email to 49476@debbugs.gnu.org