From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id JbiJN/N/JV+UXAAA0tVLHw (envelope-from ) for ; Sat, 01 Aug 2020 14:45:07 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id L4XbMvN/JV9TSAAAB5/wlQ (envelope-from ) for ; Sat, 01 Aug 2020 14:45:07 +0000 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 679389401AE for ; Sat, 1 Aug 2020 14:45:07 +0000 (UTC) Received: from localhost ([::1]:42848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k1sl0-0007GN-D6 for larch@yhetil.org; Sat, 01 Aug 2020 10:45:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1skw-0007GB-Fi for guix-patches@gnu.org; Sat, 01 Aug 2020 10:45:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:57545) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k1skw-0005c4-5x for guix-patches@gnu.org; Sat, 01 Aug 2020 10:45:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k1skw-0003RV-3b for guix-patches@gnu.org; Sat, 01 Aug 2020 10:45:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42650] [PATCH 2/2] gnu: Add python-onnx. Resent-From: Vinicius Monego Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 01 Aug 2020 14:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42650 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 42650@debbugs.gnu.org Cc: Vinicius Monego X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.159629304513156 (code B ref -1); Sat, 01 Aug 2020 14:45:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 Aug 2020 14:44:05 +0000 Received: from localhost ([127.0.0.1]:40858 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k1sk0-0003Q8-Iq for submit@debbugs.gnu.org; Sat, 01 Aug 2020 10:44:04 -0400 Received: from lists.gnu.org ([209.51.188.17]:44824) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k1sju-0003PB-Ld for submit@debbugs.gnu.org; Sat, 01 Aug 2020 10:44:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1sju-0006zS-Er for guix-patches@gnu.org; Sat, 01 Aug 2020 10:43:58 -0400 Received: from mout02.posteo.de ([185.67.36.66]:40435) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1sjs-0005Xz-Dz for guix-patches@gnu.org; Sat, 01 Aug 2020 10:43:58 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 3A5B62400FC for ; Sat, 1 Aug 2020 16:43:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1596293034; bh=F+poJnYlWhfs3zuTExro/Uh1Pp1gYuAfH800lZEtZO0=; h=From:To:Cc:Subject:Date:From; b=M/6+l+5+5xR8K8HsxsDTB7Z4blFnmgdePgdrbv6/5IElVAxPJyZBQV2grrieR8M3U Pm4Jbb4PmLn7n+x5Np3qksn+y4dxfZvO/VHNSNPo4AS+g7YGGltw/2Jy+rpHDna4zf jk6GXQ5qZ/Fnd2nfcbsnLuEu429VWt+P3vhIJgl0S5isCZvo6lO2ikV8L2uPGg2ffP ZIc4eRBnNoAeMo7p9FKg60mq8fVyXWIZTZ2B2Id4XpiPIzCa8S5azeB0fefvQQuyxU 1zFWzo81qORPDyzVCWKxSMdW6+BTlU195zI4InEE3kPA1jF+bQyy/fg59WjIcetd+h aG1etucsPf4Kg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4BJn2x03Ccz9rxW; Sat, 1 Aug 2020 16:43:52 +0200 (CEST) From: Vinicius Monego Date: Sat, 1 Aug 2020 11:43:21 -0300 Message-Id: <20200801144321.60595-2-monego@posteo.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200801144321.60595-1-monego@posteo.net> References: <20200801144321.60595-1-monego@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=185.67.36.66; envelope-from=monego@posteo.net; helo=mout02.posteo.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/01 10:43:37 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -2.3 (--) 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" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=posteo.net header.s=2017 header.b=M/6+l+5+; dmarc=fail reason="SPF not aligned (strict)" header.from=posteo.net (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 1.09 X-TUID: SKGXg0avd4AN * gnu/packages/machine-learning.scm (python-onnx): New variable. --- gnu/packages/machine-learning.scm | 43 +++++++++++++++ .../python-onnx-use-system-googletest.patch | 54 +++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 gnu/packages/patches/python-onnx-use-system-googletest.patch diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 18a4ac9ef2..4ec3ed05c7 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -15,6 +15,7 @@ ;;; Copyright © 2019 Brett Gilio ;;; Copyright © 2020 Konrad Hinsen ;;; Copyright © 2020 Edouard Klein +;;; Copyright © 2020 Vinicius Monego ;;; ;;; This file is part of GNU Guix. ;;; @@ -53,6 +54,7 @@ #:use-module (gnu packages boost) #:use-module (gnu packages check) #:use-module (gnu packages compression) + #:use-module (gnu packages cmake) #:use-module (gnu packages cran) #:use-module (gnu packages databases) #:use-module (gnu packages dejagnu) @@ -70,6 +72,7 @@ #:use-module (gnu packages pkg-config) #:use-module (gnu packages protobuf) #:use-module (gnu packages python) + #:use-module (gnu packages python-check) #:use-module (gnu packages python-science) #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz) @@ -576,6 +579,46 @@ tools. This enables both rapid prototyping of data pipelines and extensibility in terms of new algorithms.") (license license:gpl3+))) +(define-public python-onnx + (package + (name "python-onnx") + (version "1.7.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "onnx" version)) + ;; ONNX will build googletest from a git checkout. Patch CMake + ;; to use googletest from Guix and enable tests by default. + (patches (search-patches "python-onnx-use-system-googletest.patch")) + (sha256 + (base32 "0j6rgfbhsw3a8id8pyg18y93k68lbjbj1kq6qia36h69f6pvlyjy")))) + (build-system python-build-system) + (native-inputs + `(("cmake" ,cmake) + ("googletest" ,googletest) + ("pybind11" ,pybind11) + ("python-coverage" ,python-coverage) + ("python-nbval" ,python-nbval) + ("python-pytest" ,python-pytest) + ("python-pytest-runner" ,python-pytest-runner))) + (inputs + `(("protobuf" ,protobuf))) + (propagated-inputs + `(("python-numpy" ,python-numpy) + ("python-protobuf" ,python-protobuf) + ("python-six" ,python-six) + ("python-tabulate" ,python-tabulate) + ("python-typing-extensions" + ,python-typing-extensions))) + (home-page "https://onnx.ai/") + (synopsis "Open Neural Network Exchange") + (description + "Open Neural Network Exchange (ONNX) provides an open source format for +AI models, both deep learning and traditional ML. It defines an extensible +computation graph model, as well as definitions of built-in operators and +standard data types.") + (license license:expat))) + (define-public rxcpp (package (name "rxcpp") diff --git a/gnu/packages/patches/python-onnx-use-system-googletest.patch b/gnu/packages/patches/python-onnx-use-system-googletest.patch new file mode 100644 index 0000000000..33d2fa12de --- /dev/null +++ b/gnu/packages/patches/python-onnx-use-system-googletest.patch @@ -0,0 +1,54 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0aa9fda2..a573170c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,7 +22,7 @@ option(BUILD_ONNX_PYTHON "Build Python binaries" OFF) + option(ONNX_GEN_PB_TYPE_STUBS "Generate protobuf python type stubs" ON) + option(ONNX_WERROR "Build with Werror" OFF) + option(ONNX_COVERAGE "Build with coverage instrumentation" OFF) +-option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" OFF) ++option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" ON) + option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF) + option(ONNXIFI_ENABLE_EXT "Enable onnxifi extensions." OFF) + if(NOT DEFINED ONNX_ML) +@@ -82,8 +82,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX") + endif() + + if(ONNX_BUILD_TESTS) +- list(APPEND CMAKE_MODULE_PATH ${ONNX_ROOT}/cmake/external) +- include(googletest) ++ find_package(GTest REQUIRED) ++ if(NOT GTest_FOUND) ++ message(FATAL_ERROR "cannot find googletest") ++ endif() + endif() + + if((ONNX_USE_LITE_PROTO AND TARGET protobuf::libprotobuf-lite) OR ((NOT ONNX_USE_LITE_PROTO) AND TARGET protobuf::libprotobuf)) +diff --git a/cmake/unittest.cmake b/cmake/unittest.cmake +index e29a93ff..ae146390 100644 +--- a/cmake/unittest.cmake ++++ b/cmake/unittest.cmake +@@ -6,8 +6,8 @@ include(${ONNX_ROOT}/cmake/Utils.cmake) + + find_package(Threads) + +-set(${UT_NAME}_libs ${googletest_STATIC_LIBRARIES}) +-set(${ONNXIFI_TEST_DRIVER}_libs ${googletest_STATIC_LIBRARIES}) ++set(${UT_NAME}_libs ${GTEST_LIBRARIES}) ++set(${ONNXIFI_TEST_DRIVER}_libs ${GTEST_LIBRARIES}) + + list(APPEND ${UT_NAME}_libs onnx) + list(APPEND ${UT_NAME}_libs onnx_proto) +@@ -31,10 +31,10 @@ function(AddTest) + list(REMOVE_DUPLICATES _UT_SOURCES) + + add_executable(${_UT_TARGET} ${_UT_SOURCES}) +- add_dependencies(${_UT_TARGET} onnx onnx_proto googletest) ++ add_dependencies(${_UT_TARGET} onnx onnx_proto) + + target_include_directories(${_UT_TARGET} +- PUBLIC ${googletest_INCLUDE_DIRS} ++ PUBLIC ${GTEST_INCLUDE_DIRS} + ${ONNX_INCLUDE_DIRS} + ${PROTOBUF_INCLUDE_DIRS} + ${ONNX_ROOT} -- 2.20.1