From patchwork Thu Jul 27 23:34:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: zamfofex X-Patchwork-Id: 52275 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 CCC8227BBEA; Fri, 28 Jul 2023 00:43:14 +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 65F2927BBE2 for ; Fri, 28 Jul 2023 00:43:13 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qPAVf-0000UV-Qt; Thu, 27 Jul 2023 19:35:12 -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 1qPAVd-0000Q1-Mp for guix-patches@gnu.org; Thu, 27 Jul 2023 19:35:05 -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 1qPAVd-0001SR-Ez for guix-patches@gnu.org; Thu, 27 Jul 2023 19:35:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qPAVa-0003oJ-DB; Thu, 27 Jul 2023 19:35:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63088] [PATCH] Add Lc0. References: In-Reply-To: Resent-From: zamfofex Original-Sender: "Debbugs-submit" Resent-CC: liliana.prikler@gmail.com, iyzsong@envs.net, guix-patches@gnu.org Resent-Date: Thu, 27 Jul 2023 23:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63088 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63088@debbugs.gnu.org Cc: zamfofex , zimon.toutoune@gmail.com, Liliana Marie Prikler , =?utf-8?b?5a6L5paH5q2m?= X-Debbugs-Original-Xcc: Liliana Marie Prikler , =?utf-8?b?5a6L5paH5q2m?= Received: via spool by 63088-submit@debbugs.gnu.org id=B63088.169050088814622 (code B ref 63088); Thu, 27 Jul 2023 23:35:02 +0000 Received: (at 63088) by debbugs.gnu.org; 27 Jul 2023 23:34:48 +0000 Received: from localhost ([127.0.0.1]:43287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qPAVL-0003nl-ST for submit@debbugs.gnu.org; Thu, 27 Jul 2023 19:34:48 -0400 Received: from mta-09-4.privateemail.com ([198.54.127.118]:26367) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qPAVG-0003nV-J4 for 63088@debbugs.gnu.org; Thu, 27 Jul 2023 19:34:46 -0400 Received: from mta-09.privateemail.com (localhost [127.0.0.1]) by mta-09.privateemail.com (Postfix) with ESMTP id 8242F180007F; Thu, 27 Jul 2023 19:34:36 -0400 (EDT) Received: from smtp.gmail.com (unknown [186.222.85.100]) by mta-09.privateemail.com (Postfix) with ESMTPA id 5BCB91800079; Thu, 27 Jul 2023 19:34:33 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=twdb.moe; s=default; t=1690500876; bh=3wKg9X4GdZG5nSF2AZ3V0tpll1tJ+HLuX5Hf9ZiH4DE=; h=From:To:Cc:Subject:Date:From; b=HoQ99i5iK4KLhnhA2uZGLQx3BeM9ogo+vzJ5E2gQqcIdOpxGMg+cDLHJe8U+PLVvk v3nft7nbu24wYawY1j0+t7MvHZZbbupn+J8KMK7hjyjVGVkypa2ZZab9VoPXXdfBdO 0nHu8J8f1zsY7iJxxSsw4p4YDxlDVfjX/+K5NFgjxoVSS5kemkmHVDry0I8uHBtSGs mQESkK8/h6r+jcZFa59UMm8owqXcxEOFswzOCJx+xAwFJV0CdcMPf1ZYvsHfveoP61 XbMMC7mhwFu9wvMv4ztjdtDVZ6tTP/0eusZri/n+HERKW0nAmfjyYg/kLAvXaZAX2g TbyaoltNh1oSg== From: zamfofex Date: Thu, 27 Jul 2023 20:34:05 -0300 Message-Id: X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP 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 Lc0 recently released version 0.30.0, so here is a patch with the updates version (in case the issue regarding the network’s inclusion is ever resolved). Also, I wanted to say: Is it reasonable to include Lc0 without the networks in? People can still download and use them, they just wouldn’t be included in Guix itself. Note that, unlike Stockfish, Lc0 does run without the neural networks, so it would be necessary for the user to download or otherwise acquire one by themself in order to use Lc0. The user can choose an appropriate network in their chess GUI program when configuring Lc0 in it. If this is more desireable, I can submit a patch without the trained neural network, which would allow the user to choose whichever one they might want. Thanks in advance! * gnu/packages/games.scm (lc0): New variable. --- gnu/packages/games.scm | 58 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) base-commit: c7e45139faa27b60f2c7d0a4bc140f9793d97d47 diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm index cc6bef1114..21aa370701 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -118,6 +118,7 @@ (define-module (gnu packages games) #:use-module (gnu packages bash) #:use-module (gnu packages bison) #:use-module (gnu packages boost) + #:use-module (gnu packages c) #:use-module (gnu packages check) #:use-module (gnu packages cmake) #:use-module (gnu packages compression) @@ -171,6 +172,7 @@ (define-module (gnu packages games) #:use-module (gnu packages linux) #:use-module (gnu packages llvm) #:use-module (gnu packages lua) + #:use-module (gnu packages machine-learning) #:use-module (gnu packages man) #:use-module (gnu packages maths) #:use-module (gnu packages messaging) @@ -10285,6 +10287,62 @@ (define-public stockfish (home-page "https://stockfishchess.org/") (license license:gpl3+)))) +(define lc0-neural-network + (let ((hash + "f404e156ceb2882470fd8c032b8754af0fa0b71168328912eaef14671a256e34")) + (origin + (method url-fetch) + (uri (string-append "https://storage.lczero.org/files/networks/" + hash)) + (sha256 + (base32 + "03b9xl9vkiihdilz5dzcpg6g4inb6n4k5gs911i3gbd8h9sh9ixi")) + (file-name "lc0-neural-network")))) + +(define-public lc0 + (package + (name "lc0") + (version "0.30.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/LeelaChessZero/lc0") + (commit (string-append "v" version)) + (recursive? #t))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1m7k8m8iz4pxv3h9g2j1dkgryi4k9c1bcg3fx5j7ii4ysif63kj3")))) + (build-system meson-build-system) + (native-search-paths + (list (search-path-specification + (variable "XDG_DATA_DIRS") + (files (list "share"))))) + (inputs + `(("neural-network" ,lc0-neural-network) + ("eigen" ,eigen) + ("oneapi-dnnl" ,oneapi-dnnl) + ("zlib" ,zlib))) + (native-inputs + (list googletest ispc pkg-config python)) + (arguments + '(#:phases (modify-phases %standard-phases + (add-after 'install 'copy-net + (lambda* (#:key outputs inputs #:allow-other-keys) + (mkdir-p (string-append (assoc-ref outputs "out") + "/share/lc0")) + (copy-file (assoc-ref inputs "neural-network") + (string-append (assoc-ref outputs "out") + "/share/lc0/neural-network"))))) + #:configure-flags (list "-Ddnnl=true" + (string-append + "-Ddnnl_dir=" + (assoc-ref %build-inputs "oneapi-dnnl"))))) + (synopsis "Neural network based chess engine") + (description "Lc0 is a chess engine based on neural networks") + (home-page "https://lczero.org") + (license license:gpl3+))) + (define-public barrage (package (name "barrage")