From patchwork Wed Jun 30 12:22:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwenhael Goavec-Merou X-Patchwork-Id: 1498883 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GFL966WJtz9sVb for ; Wed, 30 Jun 2021 22:23:20 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 126C2404EA; Wed, 30 Jun 2021 12:23:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0xHSdZGjRg3Y; Wed, 30 Jun 2021 12:23:15 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 2A3E0414B4; Wed, 30 Jun 2021 12:23:14 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 7FA331BF57C for ; Wed, 30 Jun 2021 12:23:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6EF8760903 for ; Wed, 30 Jun 2021 12:23:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q9Q8S6FtDcEr for ; Wed, 30 Jun 2021 12:23:10 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from smtp6-g21.free.fr (smtp6-g21.free.fr [212.27.42.6]) by smtp3.osuosl.org (Postfix) with ESMTPS id 6DCFA60A3E for ; Wed, 30 Jun 2021 12:23:09 +0000 (UTC) Received: from localhost.localdomain (unknown [78.252.129.8]) by smtp6-g21.free.fr (Postfix) with ESMTP id 154F978038B; Wed, 30 Jun 2021 14:23:05 +0200 (CEST) From: Gwenhael Goavec-Merou To: buildroot@buildroot.org Date: Wed, 30 Jun 2021 14:22:45 +0200 Message-Id: <20210630122245.1791249-1-gwenj@trabucayre.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [Buildroot] [RESEND PATCH v3] package/armadillo: allows to select between clapack, lapack or openblas X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Romain Naour , Gwenhael Goavec-Merou Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Gwenhael Goavec-Merou armadillo can use clapack, lapack or openblas as BLAS provider and clapack or lapack as LAPACK provider. This patch - adds hidden variable to check dependencies/requirement for each of them - a choice to select wich implementation to use for blas and lapack. Choices are required since applications, potentially, needs explicitly lapack or clapack. Signed-off-by: Gwenhael Goavec-Merou --- Changes v2 -> v3: - drop all default statements for choice (Thomas) - add explicit -l since blas libary is called liblas for (c)lapack and libopenblas for openblas (Thomas) - add a choice for lapack selection between lapack, clapack or none Changes v1 -> v2: - add openblas as blas provider --- package/armadillo/Config.in | 66 ++++++++++++++++++++++++++++++++-- package/armadillo/armadillo.mk | 29 ++++++++++++++- 2 files changed, 91 insertions(+), 4 deletions(-) diff --git a/package/armadillo/Config.in b/package/armadillo/Config.in index b2b61a3233..816b45be96 100644 --- a/package/armadillo/Config.in +++ b/package/armadillo/Config.in @@ -1,3 +1,15 @@ +config BR2_PACKAGE_ARMADILLO_CLAPACK_SUPPORTS + bool + default y + depends on !BR2_m68k_cf + depends on !BR2_powerpc || BR2_TOOLCHAIN_USES_GLIBC + +config BR2_PACKAGE_ARMADILLO_LAPACK_SUPPORTS + bool + default y + depends on BR2_TOOLCHAIN_HAS_FORTRAN + depends on !(BR2_powerpc && BR2_TOOLCHAIN_USES_UCLIBC) + comment "armadillo needs a toolchain w/ C++" depends on !BR2_INSTALL_LIBSTDCPP depends on !BR2_powerpc @@ -10,11 +22,59 @@ comment "armadillo needs a glibc toolchain w/ C++" config BR2_PACKAGE_ARMADILLO bool "armadillo" depends on BR2_INSTALL_LIBSTDCPP - depends on !BR2_powerpc || BR2_TOOLCHAIN_USES_GLIBC # clapack - depends on !BR2_m68k_cf # clapack - select BR2_PACKAGE_CLAPACK + depends on BR2_PACKAGE_ARMADILLO_CLAPACK_SUPPORTS || \ + BR2_PACKAGE_ARMADILLO_LAPACK_SUPPORTS || \ + BR2_PACKAGE_OPENBLAS_ARCH_SUPPORTS help Armadillo: An Open Source C++ Linear Algebra Library for Fast Prototyping and Computationally Intensive Experiments. http://arma.sourceforge.net/ + +if BR2_PACKAGE_ARMADILLO + +choice + prompt "blas library" + help + Selects blas library to use + +config BR2_PACKAGE_ARMADILLO_BLAS_LAPACK + bool "lapack" + depends on BR2_PACKAGE_ARMADILLO_LAPACK_SUPPORTS + select BR2_PACKAGE_LAPACK + +config BR2_PACKAGE_ARMADILLO_BLAS_CLAPACK + bool "clapack" + depends on BR2_PACKAGE_ARMADILLO_CLAPACK_SUPPORTS + select BR2_PACKAGE_CLAPACK + +config BR2_PACKAGE_ARMADILLO_BLAS_OPENBLAS + bool "openblas" + depends on BR2_PACKAGE_OPENBLAS_ARCH_SUPPORTS + select BR2_PACKAGE_OPENBLAS + +endchoice + +choice + prompt "lapack library" + help + Selects lapack library to use + +config BR2_PACKAGE_ARMADILLO_LAPACK_LAPACK + bool "lapack" + depends on BR2_PACKAGE_ARMADILLO_LAPACK_SUPPORTS + depends on !BR2_PACKAGE_ARMADILLO_BLAS_CLAPACK + select BR2_PACKAGE_LAPACK + +config BR2_PACKAGE_ARMADILLO_LAPACK_CLAPACK + bool "clapack" + depends on BR2_PACKAGE_ARMADILLO_CLAPACK_SUPPORTS + depends on !BR2_PACKAGE_ARMADILLO_BLAS_LAPACK + select BR2_PACKAGE_CLAPACK + +config BR2_PACKAGE_ARMADILLO_LAPACK_NONE + bool "none" + +endchoice + +endif diff --git a/package/armadillo/armadillo.mk b/package/armadillo/armadillo.mk index 624b842ef6..bae27774d7 100644 --- a/package/armadillo/armadillo.mk +++ b/package/armadillo/armadillo.mk @@ -7,11 +7,38 @@ ARMADILLO_VERSION = 9.900.2 ARMADILLO_SOURCE = armadillo-$(ARMADILLO_VERSION).tar.xz ARMADILLO_SITE = https://downloads.sourceforge.net/project/arma -ARMADILLO_DEPENDENCIES = clapack ARMADILLO_INSTALL_STAGING = YES ARMADILLO_LICENSE = Apache-2.0 ARMADILLO_LICENSE_FILES = LICENSE.txt ARMADILLO_CONF_OPTS = -DDETECT_HDF5=false +# blas support may be provided by lapack, clapack or openblas +# blas library from (c)lapack is libblas.a, libopenblas.a otherwise +ARMADILLO_CONF_OPTS += -DBLAS_FOUND=ON +ifeq ($(BR2_PACKAGE_ARMADILLO_OPENBLAS),y) +ARMADILLO_CONF_OPTS += -DBLAS_LIBRARIES=-lopenblas +ARMADILLO_DEPENDENCIES = openblas +else +ARMADILLO_CONF_OPTS += -DBLAS_LIBRARIES=-lblas +ifeq ($(BR2_PACKAGE_ARMADILLO_CLAPACK), y) +ARMADILLO_DEPENDENCIES = clapack +else +ARMADILLO_DEPENDENCIES = lapack +endif +endif + +# lapack support may be provided by lapack or clapack +# but not by openblas +ifeq ($(BR2_PACKAGE_LAPACK_NONE),y) +ARMADILLO_CONF_OPTS += -DLAPACK_FOUND=OFF +else +ARMADILLO_CONF_OPTS += -DLAPACK_FOUND=ON +ifeq ($(BR2_PACKAGE_ARMADILLO_LAPACK_LAPACK),y) +ARMADILLO_DEPENDENCIES += lapack +else ifeq ($(BR2_PACKAGE_ARMADILLO_LAPACK_CLAPACK), y) +ARMADILLO_DEPENDENCIES += clapack +endif +endif + $(eval $(cmake-package))