From patchwork Fri Feb 12 09:15:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas De Schampheleire X-Patchwork-Id: 1439781 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=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=KpDHZuFJ; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DcSX26QSFz9sCD for ; Fri, 12 Feb 2021 20:15:30 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C14D386B20; Fri, 12 Feb 2021 09:15:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5xYPsDCkO_pO; Fri, 12 Feb 2021 09:15:27 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 20E8E86B19; Fri, 12 Feb 2021 09:15:27 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id A58F21BF372 for ; Fri, 12 Feb 2021 09:15:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id A243D87551 for ; Fri, 12 Feb 2021 09:15:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id it8kSzVLHGH9 for ; Fri, 12 Feb 2021 09:15:25 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by hemlock.osuosl.org (Postfix) with ESMTPS id A54F587536 for ; Fri, 12 Feb 2021 09:15:24 +0000 (UTC) Received: by mail-ej1-f46.google.com with SMTP id p20so14404176ejb.6 for ; Fri, 12 Feb 2021 01:15:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=js51ZLMHm5jwqCw0Vg1CIyJnXa49cYcmRbot0CucXM0=; b=KpDHZuFJn0MubDDPJTEYjKbQFI967iZyeQn6iRZlElOTNGOegHeFR9qEZW3YAIet27 eWmQwXfXsPQyjA8YuwbVi+RTHNHNSI337Vzn8pNfUEvAw8KqB1bhqBNtbWeboFlvBu5S uvyM3sBN6VuN/VPgHdAwE0R0Kmh/zciGutV1KTI9ZHkwDeLkerQH22kAZ/i/pMfqP282 v8bLNGg/4ihWFrw82rtRJWDOAsUyYds1OI+bLhoUvIYGsP1i5eShWbtGW6NaSWpObtgY x6325h87A6ZCE7L89h7j+FrZF9tqLNzNwUbVXeHVMAO3CWxtiWw1SyJJ1zZ8zK/R2CKu 5tCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=js51ZLMHm5jwqCw0Vg1CIyJnXa49cYcmRbot0CucXM0=; b=ffJ5gwPwwFr4TXzgdBbCEb+oXMP2J5ZDT8d3uI5nrdKQ9Ve8VQXhBrUANN1lr3fO1L FAOJSoOdTgGgn9xTjkOBCR1t49KdwJHP5XgDUVFP+Dx+KEqPazpqoXJxyIsFFTn5BlV/ 109yt1gnCYk5Qxowl/vAxlwvc6dnDl6PVh2xgPYQ833qHVVGcEewI1qqXOTDDFqxOGxF 6isbSHjx0OdZ4ncJS/Qwn5biiiDvkouLMEI2TwTAf2EP2mY+OnnkgfzmhmfvCiFK1fCc wK3Sb9um9IUPV29XRxndr+ri4hru1N6+1d3EEnaT2eJP82BRS15NanKQYd+Kky83z1c7 71Nw== X-Gm-Message-State: AOAM530ZKgB+ZOYbuHCNrYfEXJRpOb4DVo/k0O13geWLZkMSG6vIorKo JQpdNbkmT0GoFs7p6QEoo4gdeukjQh1iIgWS X-Google-Smtp-Source: ABdhPJxDnrKDe2Pk3iMmyYbpmvDrr4CQQo72bLlEJnCbah4y+FpIS1DmwSPVSUohppmZcpG8bfWYhg== X-Received: by 2002:a17:906:3ad0:: with SMTP id z16mr2090984ejd.72.1613121322952; Fri, 12 Feb 2021 01:15:22 -0800 (PST) Received: from localhost (ptr-5gw9txf6g5tndjqqqz.18120a2.ip6.access.telenet.be. [2a02:1810:510:3800:1b15:18e4:57d1:eb]) by smtp.gmail.com with ESMTPSA id s10sm6081011eja.26.2021.02.12.01.15.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 01:15:22 -0800 (PST) From: Thomas De Schampheleire To: buildroot@buildroot.org Date: Fri, 12 Feb 2021 10:15:09 +0100 Message-Id: <20210212091511.9905-1-patrickdepinguin@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/2] package/openblas: allow disabling multithreading 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: Thomas De Schampheleire , thomas.petazzoni@bootlin.com Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Thomas De Schampheleire Buildroot would automatically enable multithreading in OpenBLAS if the architecture supports it. However, one may want to avoid OpenBLAS creating threads itself and configure single-threaded operation. To accommodate this use case, add a config option for multithreading. When multithreading is disabled but OpenBLAS functions are called in the same application by multiple threads, then locking is mandatory. The USE_LOCKING flag was added in version 0.3.7 with following release note: a new option USE_LOCKING was added to ensure thread safety when OpenBLAS itself is built without multithreading but will be called from multiple threads. However, if one knows that OpenBLAS will only be called from single-threaded applications, then passing USE_LOCKING is not necessary, so make it a config option too. When multithreading is enabled, locking is implicitly enabled inside openblas, so only provide the locking option when multithreading is disabled. Signed-off-by: Thomas De Schampheleire --- This is a resend of v2, addressing comments of Thomas Petazzoni: - let USE_LOCKING depend on !USE_THREAD - don't pass USE_LOCKING=0 to avoid confusion package/openblas/Config.in | 21 +++++++++++++++++++++ package/openblas/openblas.mk | 9 ++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/package/openblas/Config.in b/package/openblas/Config.in index 3f658c862a..0144e93a3f 100644 --- a/package/openblas/Config.in +++ b/package/openblas/Config.in @@ -73,4 +73,25 @@ config BR2_PACKAGE_OPENBLAS_TARGET string "OpenBLAS target CPU" default BR2_PACKAGE_OPENBLAS_DEFAULT_TARGET +config BR2_PACKAGE_OPENBLAS_USE_THREAD + bool "use multithreading" + default y + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on !BR2_STATIC_LIBS + help + Tell OpenBLAS to use multithreading, by passing USE_THREAD=1. + +config BR2_PACKAGE_OPENBLAS_USE_LOCKING + bool "use locking" + default y + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on !BR2_PACKAGE_OPENBLAS_USE_THREAD + help + Tell OpenBLAS to use locking, by passing USE_LOCKING=1. + Locking is implicitly enabled when USE_THREAD=1. + However, if USE_THREAD=0 (i.e. OpenBLAS itself will run in + single-threaded mode) but an application makes OpenBLAS + function calls from multiple threads, then locking is + mandatory for correct operation. + endif diff --git a/package/openblas/openblas.mk b/package/openblas/openblas.mk index 9701df9148..21d05cf30d 100644 --- a/package/openblas/openblas.mk +++ b/package/openblas/openblas.mk @@ -25,12 +25,19 @@ OPENBLAS_MAKE_OPTS += ONLY_CBLAS=1 endif # Enable/Disable multi-threading (not for static-only since it uses dlfcn.h) -ifeq ($(BR2_TOOLCHAIN_HAS_THREADS):$(BR2_STATIC_LIBS),y:) +ifeq ($(BR2_PACKAGE_OPENBLAS_USE_THREAD),y) OPENBLAS_MAKE_OPTS += USE_THREAD=1 else OPENBLAS_MAKE_OPTS += USE_THREAD=0 endif +ifeq ($(BR2_PACKAGE_OPENBLAS_USE_LOCKING),y) +OPENBLAS_MAKE_OPTS += USE_LOCKING=1 +else +# not passing USE_LOCKING=0 as this could be confusing: its effect is implicit +# in case of USE_THREAD=1. +endif + # We don't know if OpenMP is available or not, so disable OPENBLAS_MAKE_OPTS += USE_OPENMP=0 From patchwork Fri Feb 12 09:15:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas De Schampheleire X-Patchwork-Id: 1439782 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=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=CouNFlMk; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DcSXB0L1Jz9sCD for ; Fri, 12 Feb 2021 20:15:38 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 15EAD86DE5; Fri, 12 Feb 2021 09:15:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P8UQetvwDLoS; Fri, 12 Feb 2021 09:15:30 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2D4B486BFF; Fri, 12 Feb 2021 09:15:30 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id BC51D1BF372 for ; Fri, 12 Feb 2021 09:15:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B7FA787019 for ; Fri, 12 Feb 2021 09:15:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NhqDJn-ppAVW for ; Fri, 12 Feb 2021 09:15:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by whitealder.osuosl.org (Postfix) with ESMTPS id 5B26B86E7F for ; Fri, 12 Feb 2021 09:15:26 +0000 (UTC) Received: by mail-ej1-f52.google.com with SMTP id lg21so14402276ejb.3 for ; Fri, 12 Feb 2021 01:15:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GM5G9Zn4uL3YcNKbrLU7u6XucZdd/T3D0XnkuCmnrss=; b=CouNFlMk1wh0sNuGV1WBIdsWhv8hHbTmGDNSdborOBtqg0ZE6A6mX8ZhjJ9d1N6MgH N52sAdiRO87iE4RQOihBmMxjZkkQgYrHxMAgoNZ+wW9ZqyTdlo83LO2AYUyz89VEKQ8l aNeX7iSc1N3QHAytqiCDhss4n7SRMPOwrn0FLptXNo+QW2VP4YchEZ8wYXS5vKA/cyLf rrh8MOkCrxK7GezdwgcItQqMxIyn8yEp2yhRHzHGTuwXlwyM3+x52NabU7q4pbOj9f1F gF8WpcVGqj5yUjCWQeUcj5yW58+eaEKvPEF4F2cGeeYHD8E+wbRsWdfm0SRWoXstWrs6 rD1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GM5G9Zn4uL3YcNKbrLU7u6XucZdd/T3D0XnkuCmnrss=; b=Xh1mYe5sEYrq3rToHUGOHDj3Q8231ix51zG+NFFcGYEtV9qaeTjpGpaeAIXeGTtk7h Y22Q8hbAjM2c/8lsgTQXVFxS91KCL611fFOAbZDVGzTMdvm8UkHJwXJfg9qm1+HxnG7J ltjFplja2Qt2t+DZp9x0onnxBJrtOM0SkkJQ1C/bTczC/h9gYsRh6RjBi9BRqxFAXDHI Uu3qbgId+5gJBXWRxuRu5PFkArf2JFpb3oFCoUKo5pKQJfgf8mzoozwm6bV6ZaoDAiuD EMSOdQBgsYLguHpzV+0u5jOhY/95aVNWH1pxN1Ua8cYirArywKMc3N48LeLLNHXjRv5T SM4g== X-Gm-Message-State: AOAM532rUjv6rjk1r7w0FTPzT5KjZQmS9Kdf7OPjgOblXCXpoTmqg8UT rYMCapDe6UMs2A1qG8ewLQ6f29Nw5EwHGj/y X-Google-Smtp-Source: ABdhPJxW3Nx8EdYcFLR993/rwyB3n8Immt4HF9314mBtfCyH8kBwOkEuK0UdwIGrIeySzeGMsLb8VQ== X-Received: by 2002:a17:906:90d9:: with SMTP id v25mr458291ejw.271.1613121324753; Fri, 12 Feb 2021 01:15:24 -0800 (PST) Received: from localhost (ptr-5gw9txf6g5tndjqqqz.18120a2.ip6.access.telenet.be. [2a02:1810:510:3800:1b15:18e4:57d1:eb]) by smtp.gmail.com with ESMTPSA id g3sm5659562edk.75.2021.02.12.01.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 01:15:24 -0800 (PST) From: Thomas De Schampheleire To: buildroot@buildroot.org Date: Fri, 12 Feb 2021 10:15:10 +0100 Message-Id: <20210212091511.9905-2-patrickdepinguin@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210212091511.9905-1-patrickdepinguin@gmail.com> References: <20210212091511.9905-1-patrickdepinguin@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 2/2] package/openblas: fix detection of gfortran compiler 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: Thomas De Schampheleire , thomas.petazzoni@bootlin.com Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Thomas De Schampheleire The compiler detection since openblas 0.3.8 added support for gcc 10, but this broke detection of compilers created with crosstool-ng, or other toolchains that have a package version containing a version like x.y.z where at least one of x, y or z have more than one digit, for example "Crosstool-NG 1.24.0". See the reported issue for more details [1]. Backport the upstream patch that fixes it. [1] https://github.com/xianyi/OpenBLAS/issues/3099 Signed-off-by: Thomas De Schampheleire --- .../0001-fix-gfortran-detection.patch | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 package/openblas/0001-fix-gfortran-detection.patch diff --git a/package/openblas/0001-fix-gfortran-detection.patch b/package/openblas/0001-fix-gfortran-detection.patch new file mode 100644 index 0000000000..1fecdac3e5 --- /dev/null +++ b/package/openblas/0001-fix-gfortran-detection.patch @@ -0,0 +1,30 @@ +From ece3ce581e3ec530eaccfe7f284c52e115ec7aa9 Mon Sep 17 00:00:00 2001 +From: Martin Kroeker +Date: Wed, 10 Feb 2021 14:22:59 +0100 +Subject: [PATCH] Strip parenthesized (pkgversion) data from GCC version string + to avoid misinterpretation + +See https://github.com/xianyi/OpenBLAS/issues/3099 for details. + +Upstream-status: backport + +[for import into Buildroot] +Signed-off-by: Thomas De Schampheleire + + +--- + f_check | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/f_check b/f_check +index e9aca4ff9..ffe9c6b46 100644 +--- a/f_check ++++ b/f_check +@@ -75,6 +75,7 @@ if ($compiler eq "") { + + } elsif ($data =~ /GNU/ || $data =~ /GCC/ ) { + ++ $data =~ s/\(+.*?\)+//g; + $data =~ /(\d+)\.(\d+).(\d+)/; + $major = $1; + $minor = $2;