From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id WJp7I41S/2XYMwAAqHPOHw:P1 (envelope-from ) for ; Sat, 23 Mar 2024 23:07:09 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id WJp7I41S/2XYMwAAqHPOHw (envelope-from ) for ; Sat, 23 Mar 2024 23:07:09 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=GqGbgafO; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1711231629; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=eV3L3kdzzSk/7iZrgQT7N21r6qNB1jDCxOKc03jxqk8=; b=TPTRP4PD8pIBzYSXquPDTkB3Kz6HB5jOvvrEBLU6p9UTlTnimNyPr7mMYYF+oqZHYuQ7Z0 CPq9O/gpvC67lci21ldIyq4y+4LJW5omsJ3TV3qVV8tpyCDAVXKJLmrfcEGSwyUPDgGzc+ JdS+mDh0yo67r71PacpkPWqCElupNl9daYD3a7Hu1rjsxWfywCPNaUdxUM4GsL+6qS5LHN NTEBBZ0yGl0WSfOILWH6UfTYpEWHmALNMBr+7US7clMOeL/Nqq5PIga65vZ7ZZc9O96tZo sjmdRTKkawZaIgVCwgRU21nfDwYt2ITHCDKc19v6Tr9aJiuWdq4eTTW4BvXELA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=posteo.net header.s=2017 header.b=GqGbgafO; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1711231629; a=rsa-sha256; cv=none; b=PimmrCE+IPzwfx+EpigL0BNzR6wQDot0s5sdTUME7A7jgDc47/BVe6H/mRDEQmMG34g7Uw Ghm/SoyGRQvLO5Nz3cIgUis8ziphlQ9AD0Uw7ahnkAJmyt0Fh6c87+R3+DloxoV7ENlPNU zaotvBCSKPVpI4nyGvLMrnIJZiVusVo/Z6M21BWy32N+ESCj6LMJs6PW8FcRaFSJ5H3LGd OQm6NSmUrKhC6UWhi11rTjosDP5nJIXG4+ZBCz7HVi8acoZAOblXKMyYZkNVRGev4Q2Yun BuBlaoH7GqLFRFt4O7tuvfR0EnlKYj4ZHUDCf4JLkGxxEnQU0MnZk2+Dl7v2rA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4636E642DF for ; Sat, 23 Mar 2024 23:07:09 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ro9VU-00053o-0v; Sat, 23 Mar 2024 18:06:28 -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 1ro9VR-00051a-9X for guix-patches@gnu.org; Sat, 23 Mar 2024 18:06:25 -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 1ro9VQ-00081Q-VD for guix-patches@gnu.org; Sat, 23 Mar 2024 18:06:25 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ro9W6-0006Tb-A0 for guix-patches@gnu.org; Sat, 23 Mar 2024 18:07:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69591] [PATCH v4 19/32] gnu: Add fbgemm. Resent-From: David Elsing Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 23 Mar 2024 22:07:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69591 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69591@debbugs.gnu.org Cc: David Elsing Received: via spool by 69591-submit@debbugs.gnu.org id=B69591.171123161224787 (code B ref 69591); Sat, 23 Mar 2024 22:07:06 +0000 Received: (at 69591) by debbugs.gnu.org; 23 Mar 2024 22:06:52 +0000 Received: from localhost ([127.0.0.1]:56617 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ro9Vs-0006Rd-2N for submit@debbugs.gnu.org; Sat, 23 Mar 2024 18:06:52 -0400 Received: from mout01.posteo.de ([185.67.36.65]:51299) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ro9VM-0006OY-Mw for 69591@debbugs.gnu.org; Sat, 23 Mar 2024 18:06:21 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 9FCFB240027 for <69591@debbugs.gnu.org>; Sat, 23 Mar 2024 23:05:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1711231530; bh=GVqdGfjQnJg9NybX1mPpNJPWPxVdhPwVowAg7K/0bXg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=GqGbgafOPQM8nGoOo7QMTt7YmS1oBcl3catwv1U9GmXnL1uAqcCXd5/aaMIV4G0rl dhH9dkXsbPhSV+rE2ISs8Q/qDz+llZE40zeyf4g4OFJSM9C175kGZb/yVl0PRqvoSB aen3E7fXT5Si8QWSL62Tv2goxx9fKnyzep4myKYHN6LkCGAe4S4szYO5p2bSJ7vVw2 tY3vXhgjvs7yHpXnwmvTv4fhomu8C48+aJrrf0TainPR+iJgT0yNxCVADIdC7UAmpv Dq5UDVJPKTp5mbSen0ET+FGdhDI9gLFpy1Jq+vjtdByIOLetZJBU/K+caxKA4KFe3l Md7p7pH3ADM4A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4V2Ctf2GVqz6tx0; Sat, 23 Mar 2024 23:05:30 +0100 (CET) From: David Elsing Date: Sat, 23 Mar 2024 22:04:58 +0000 Message-ID: <20240323220518.25063-19-david.elsing@posteo.net> In-Reply-To: <20240323214040.20221-1-david.elsing@posteo.net> References: <20240323214040.20221-1-david.elsing@posteo.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: 3.97 X-Migadu-Queue-Id: 4636E642DF X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: 3.97 X-TUID: 6zCulRY5L09D * gnu/packages/machine-learning.scm (fbgemm): New variable. * gnu/packages/patches/fbgemm-use-system-libraries.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. --- gnu/local.mk | 1 + gnu/packages/machine-learning.scm | 34 ++++++++++ .../patches/fbgemm-use-system-libraries.patch | 62 +++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 gnu/packages/patches/fbgemm-use-system-libraries.patch diff --git a/gnu/local.mk b/gnu/local.mk index 474260b764..e0fa9e1f78 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1175,6 +1175,7 @@ dist_patch_DATA = \ %D%/packages/patches/fasthenry-spUtils.patch \ %D%/packages/patches/fasthenry-spSolve.patch \ %D%/packages/patches/fasthenry-spFactor.patch \ + %D%/packages/patches/fbgemm-use-system-libraries.patch \ %D%/packages/patches/fbreader-curl-7.62.patch \ %D%/packages/patches/fbreader-fix-icon.patch \ %D%/packages/patches/fenics-dolfin-algorithm.patch \ diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index b104800b71..b478723939 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -4094,6 +4094,40 @@ (define-public xnnpack-for-torch2 "-DXNNPACK_BUILD_TESTS=FALSE" ;FIXME: see below "-DXNNPACK_BUILD_BENCHMARKS=FALSE")))))) +;; Warning: This package requires AVX2 or AVX-512 instructions. +(define-public fbgemm + (package + (name "fbgemm") + (version "0.6.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/pytorch/fbgemm") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0mw30v55aicqdbh3xwfj9p8f38nw70ks5cxiwpgwjsk0dylah9rf")) + (patches (search-patches "fbgemm-use-system-libraries.patch")) + (modules '((guix build utils))) + (snippet + '(delete-file-recursively "third_party")))) + (build-system cmake-build-system) + (arguments + (list + #:configure-flags + ''("-DFBGEMM_LIBRARY_TYPE=shared") + ;; Tests require AVX2 or AVX-512 instructions + #:tests? #f)) + (inputs (list asmjit cpuinfo)) + (native-inputs (list pkg-config python googletest)) + (home-page "https://github.com/pytorch/fbgemm") + (synopsis "Facebook GEneral Matrix Multiplication") + (description "Low-precision, high-performance matrix-matrix +multiplications and convolution library for server-side inference.") + (supported-systems '("x86_64-linux")) + (license license:bsd-3))) + (define-public tensorpipe (let ((commit "bb1473a4b38b18268e8693044afdb8635bc8351b") (revision "0")) diff --git a/gnu/packages/patches/fbgemm-use-system-libraries.patch b/gnu/packages/patches/fbgemm-use-system-libraries.patch new file mode 100644 index 0000000000..456bc3021c --- /dev/null +++ b/gnu/packages/patches/fbgemm-use-system-libraries.patch @@ -0,0 +1,62 @@ +Use the asmjit and cpuinfo packages. + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 134523e..b88b0e7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -235,7 +235,7 @@ message(WARNING "CMAKE_CXX_FLAGS_DEBUG is ${CMAKE_CXX_FLAGS_DEBUG}") + message(WARNING "CMAKE_CXX_FLAGS_RELEASE is ${CMAKE_CXX_FLAGS_RELEASE}") + message(WARNING "==========") + +-if(NOT TARGET asmjit) ++if(FALSE) + #Download asmjit from github if ASMJIT_SRC_DIR is not specified. + if(NOT DEFINED ASMJIT_SRC_DIR) + set(ASMJIT_SRC_DIR "${FBGEMM_SOURCE_DIR}/third_party/asmjit" +@@ -264,7 +264,7 @@ if(NOT TARGET asmjit) + endif() + endif() + +-if(NOT TARGET cpuinfo) ++if(FALSE) + #Download cpuinfo from github if CPUINFO_SOURCE_DIR is not specified. + if(NOT DEFINED CPUINFO_SOURCE_DIR) + set(CPUINFO_SOURCE_DIR "${FBGEMM_SOURCE_DIR}/third_party/cpuinfo" +@@ -340,9 +340,12 @@ target_include_directories(fbgemm BEFORE + target_link_libraries(fbgemm + $ + $) +-add_dependencies(fbgemm +- asmjit +- cpuinfo) ++ ++find_package(asmjit) ++find_package(PkgConfig REQUIRED) ++pkg_check_modules(libcpuinfo REQUIRED IMPORTED_TARGET libcpuinfo) ++ ++target_link_libraries(fbgemm asmjit::asmjit PkgConfig::libcpuinfo) + + if(OpenMP_FOUND) + target_link_libraries(fbgemm OpenMP::OpenMP_CXX) +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index 2cffddf..bd4d409 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -14,7 +14,7 @@ set(CMAKE_C_STANDARD 11) + set(CMAKE_C_EXTENSIONS OFF) + set(CMAKE_C_STANDARD_REQUIRED ON) + +-if(FBGEMM_BUILD_TESTS AND NOT TARGET gtest) ++if(FALSE) + #Download Googletest framework from github if + #GOOGLETEST_SOURCE_DIR is not specified. + if(NOT DEFINED GOOGLETEST_SOURCE_DIR) +@@ -78,7 +78,7 @@ macro(add_gtest TESTNAME) + target_link_libraries(${TESTNAME} ${OpenMP_CXX_LIBRARIES}) + endif() + +- add_dependencies(${TESTNAME} gtest fbgemm) ++ add_dependencies(${TESTNAME} fbgemm) + add_test(${TESTNAME} ${TESTNAME}) + set_target_properties(${TESTNAME} PROPERTIES FOLDER test) + endmacro() -- 2.41.0