From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 05 14:08:16 2019 Received: (at 36071) by debbugs.gnu.org; 5 Jun 2019 18:08:16 +0000 Received: from localhost ([127.0.0.1]:48169 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hYaKd-0001V6-Ck for submit@debbugs.gnu.org; Wed, 05 Jun 2019 14:08:16 -0400 Received: from mout02.posteo.de ([185.67.36.66]:33427) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hYZgj-0000Ps-32 for 36071@debbugs.gnu.org; Wed, 05 Jun 2019 13:27:06 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id BF4D02400FB for <36071@debbugs.gnu.org>; Wed, 5 Jun 2019 19:26:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1559755614; bh=MeeQxvALjjaDqWxDW9mAz4Na9xp9wdG4RZMlLATS/Oo=; h=Date:From:To:Cc:Subject:From; b=JYzSbk/jgEpCYShdZ5saWdpDWOT1+DdyLkcacoW03/q+HhHS1yPJH8b9h1iwWQJMc MZR8E+KadX1Z+LiMagGGiA8gjsL/CrU3WbSEekB59wf5JiRJG8mlopEsoKY8JSbLdQ BNGs6RtoQpE0dx31trb/v868UTTo1BQcL35wjioamZDkKNibuaG7ixzQtY7Ru+pBLe dto6z6/hF2iL78vTyv/2dOFC4SNkqEkOkEhbEfCHuWwsPSLlqSq0RkeomnmA7zArAb gUnjvET1/Pxqw6K3y4xQGdz5fHHqrOOdx6GjNTJcpPHfX0PEw/PFkU31IeH+l+SClN pn3645i+vM1jg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 45JwhC6RNpz9rxT; Wed, 5 Jun 2019 19:26:51 +0200 (CEST) Received: from yamatai (unknown [IPv6:2a01:e34:ed03:c7d0:49a4:9317:c939:a462]) by vps530281.ovh.net (Postfix) with ESMTPSA id 33129401B0; Wed, 5 Jun 2019 19:26:51 +0200 (CEST) Date: Wed, 5 Jun 2019 19:26:25 +0200 From: Guillaume LE VAILLANT To: Ludovic =?UTF-8?B?Q291cnTDqHM=?= Subject: Re: [bug#36071] [PATCH] gnu: Add leela-zero. Message-ID: <20190605192625.3c567ce7@yamatai> In-Reply-To: <87v9xkyrzz.fsf@gnu.org> References: <20190603130611.32142-1-glv@posteo.net> <87v9xkyrzz.fsf@gnu.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/h+IJpBYxP1K6ZGaY6C9DmPg" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 36071 X-Mailman-Approved-At: Wed, 05 Jun 2019 14:08:12 -0400 Cc: 36071@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --MP_/h+IJpBYxP1K6ZGaY6C9DmPg Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, Ludovic Court=C3=A8s a =C3=A9crit : > Does the game run at all if we don=E2=80=99t download additional network > weight data? >=20 > There=E2=80=99s a debate as to whether trained neural network parameters = can > be considered =E2=80=9Csource=E2=80=9D: . The game needs neural network weights to run. The user must download a file with the weights (usually from , which is updated daily I think) and put it in '$HOME/.local/share/leela-zero/'. Do you think some weigths (e.g. taken from , for reproducibility) should be embedded in the package? --MP_/h+IJpBYxP1K6ZGaY6C9DmPg Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0001-gnu-Add-leela-zero.patch =46rom a3578a986661f6ad3fd08e8e4eb2d8f7cc8e3351 Mon Sep 17 00:00:00 2001 From: Guillaume LE VAILLANT Date: Wed, 5 Jun 2019 18:11:20 +0200 Subject: [PATCH] gnu: Add leela-zero. * gnu/packages/games.scm (leela-zero): New variable. * gnu/packages/patches/leela-zero-gtest.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 2 + gnu/packages/games.scm | 51 +++++++++++++++++++++ gnu/packages/patches/leela-zero-gtest.patch | 40 ++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 gnu/packages/patches/leela-zero-gtest.patch diff --git a/gnu/local.mk b/gnu/local.mk index 6878aef44a..5e2f958f26 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -20,6 +20,7 @@ # Copyright =C2=A9 2018 Oleg Pykhalov # Copyright =C2=A9 2018 Stefan Stefanovi=C4=87 # Copyright =C2=A9 2018 Maxim Cournoyer +# Copyright =C2=A9 2019 Guillaume Le Vaillant # # This file is part of GNU Guix. # @@ -968,6 +969,7 @@ dist_patch_DATA =3D \ %D%/packages/patches/lcms-CVE-2018-16435.patch \ %D%/packages/patches/ldc-bootstrap-disable-tests.patch \ %D%/packages/patches/ldc-disable-phobos-tests.patch \ + %D%/packages/patches/leela-zero-gtest.patch \ %D%/packages/patches/liba52-enable-pic.patch \ %D%/packages/patches/liba52-link-with-libm.patch \ %D%/packages/patches/liba52-set-soname.patch \ diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm index 4fdc9b01e6..2b3552eba8 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -40,6 +40,7 @@ ;;; Copyright =C2=A9 2019 Oleg Pykhalov ;;; Copyright =C2=A9 2019 Pierre Langlois ;;; Copyright =C2=A9 2019 Julien Lepiller +;;; Copyright =C2=A9 2019 Guillaume Le Vaillant ;;; ;;; This file is part of GNU Guix. ;;; @@ -128,6 +129,7 @@ #:use-module (gnu packages netpbm) #:use-module (gnu packages networking) #:use-module (gnu packages ocaml) + #:use-module (gnu packages opencl) #:use-module (gnu packages pcre) #:use-module (gnu packages perl) #:use-module (gnu packages perl-check) @@ -7336,3 +7338,52 @@ Unfortunately, Hacker is not aware of Drascula's rea= l ambitions: DOMINATING the World and demonstrating that he is even more evil than his brother Vla= d.") ;; Drascula uses a BSD-like license. (license (license:non-copyleft "file:///readme.txt")))) + +(define-public leela-zero + (package + (name "leela-zero") + (version "0.17") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/leela-zero/leela-zero.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "17px5iny8mql5c01bymcli7zfssswkzvb2i8gnsmjcck6i2n8srl")) + (patches (search-patches "leela-zero-gtest.patch")))) + (build-system cmake-build-system) + (native-inputs + `(("googletest" ,googletest))) + (inputs + `(("boost" ,boost) + ("ocl-icd" ,ocl-icd) + ("openblas" ,openblas) + ("opencl-headers" ,opencl-headers) + ("qtbase" ,qtbase) + ("zlib" ,zlib))) + (arguments + '(#:configure-flags '("-DUSE_BLAS=3DYES") + #:phases (modify-phases %standard-phases + (add-before 'configure 'fix-tests + (lambda* (#:key outputs #:allow-other-keys) + (let ((home (getcwd))) + (setenv "HOME" home) + (substitute* "src/tests/gtests.cpp" + (("\\.\\./src/tests/0k\\.txt") + (string-append home "/src/tests/0k.txt")) + (("cfg_gtp_mode =3D true;") + "cfg_gtp_mode =3D true; cfg_cpu_only =3D true;")= )) + #t)) + (replace 'check + (lambda _ + (invoke "./tests")))))) + (home-page "https://github.com/leela-zero/leela-zero") + (synopsis "Program playing the game of Go") + (description + "Leela-zero is a Go engine with no human-provided knowledge, modeled a= fter +the AlphaGo Zero paper. The current best network weights file for the eng= ine +can be downloaded from @url{https://zero.sjeng.org/best-network}.") + (license license:gpl3+))) diff --git a/gnu/packages/patches/leela-zero-gtest.patch b/gnu/packages/pat= ches/leela-zero-gtest.patch new file mode 100644 index 0000000000..7291b4ab72 --- /dev/null +++ b/gnu/packages/patches/leela-zero-gtest.patch @@ -0,0 +1,40 @@ +Use shared gtest instead of submodule + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 617e4b2..2857875 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -18,7 +18,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOUR= CE_DIR}/cmake/Modules/") + include(GNUInstallDirs) +=20 + project(leelaz) +-add_subdirectory(gtest EXCLUDE_FROM_ALL) # We don't want to install gtest= , exclude it from `all` +=20 + # Required Packages + set(Boost_MIN_VERSION "1.58.0") +@@ -27,6 +26,7 @@ find_package(Boost 1.58.0 REQUIRED program_options files= ystem) + find_package(Threads REQUIRED) + find_package(ZLIB REQUIRED) + find_package(OpenCL REQUIRED) ++find_package(GTest REQUIRED) + # We need OpenBLAS for now, because we make some specific + # calls. Ideally we'd use OpenBLAS is possible and fall back to + # not doing those calls if it's not present. +@@ -93,6 +93,7 @@ include_directories(${IncludePath}) + include_directories(${Boost_INCLUDE_DIRS}) + include_directories(${OpenCL_INCLUDE_DIRS}) + include_directories(${ZLIB_INCLUDE_DIRS}) ++include_directories(${GTEST_INCLUDE_DIRS}) +=20 + if((UNIX AND NOT APPLE) OR WIN32) + include_directories(${BLAS_INCLUDE_DIRS}) +@@ -141,7 +142,8 @@ target_link_libraries(tests ${Boost_LIBRARIES}) + target_link_libraries(tests ${BLAS_LIBRARIES}) + target_link_libraries(tests ${OpenCL_LIBRARIES}) + target_link_libraries(tests ${ZLIB_LIBRARIES}) +-target_link_libraries(tests gtest_main ${CMAKE_THREAD_LIBS_INIT}) ++target_link_libraries(tests ${GTEST_BOTH_LIBRARIES}) ++target_link_libraries(tests ${CMAKE_THREAD_LIBS_INIT}) +=20 + include(GetGitRevisionDescription) + git_describe(VERSION --tags) --=20 2.21.0 --MP_/h+IJpBYxP1K6ZGaY6C9DmPg--