Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] Add OpenMP support for custom external toolchains
@ 2019-03-28 18:48 Ed Blake
  2019-03-28 18:48 ` [Buildroot] [PATCH 1/2] toolchain-external: introduce BR2_TOOLCHAIN_EXTERNAL_OPENMP Ed Blake
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ed Blake @ 2019-03-28 18:48 UTC (permalink / raw)
  To: buildroot

This patchset adds OpenMP support for custom external toolchains. The first
patch adds a new 'BR2_TOOLCHAIN_EXTERNAL_OPENMP' option for custom external
toolchains to enable OpenMP support, and the second patch adds a check that
the toolchain has OpenMP support.

Ed Blake (2):
  toolchain-external: introduce BR2_TOOLCHAIN_EXTERNAL_OPENMP
  toolchain-external: add a check for OpenMP support

 toolchain/helpers.mk                           | 18 ++++++++++++++++++
 .../pkg-toolchain-external.mk                  |  3 +++
 .../Config.in.options                          |  8 ++++++++
 3 files changed, 29 insertions(+)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 2/2] toolchain-external: add a check for OpenMP support
  2019-03-28 18:48 [Buildroot] [PATCH 0/2] Add OpenMP support for custom external toolchains Ed Blake
  2019-03-28 18:48 ` [Buildroot] [PATCH 1/2] toolchain-external: introduce BR2_TOOLCHAIN_EXTERNAL_OPENMP Ed Blake
@ 2019-03-28 18:48 ` Ed Blake
  2019-03-28 18:53 ` [Buildroot] [PATCH 0/2] Add OpenMP support for custom external toolchains Thomas Petazzoni
  2 siblings, 0 replies; 4+ messages in thread
From: Ed Blake @ 2019-03-28 18:48 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Ed Blake <ed.blake@sondrel.com>
---
 toolchain/helpers.mk                           | 18 ++++++++++++++++++
 .../pkg-toolchain-external.mk                  |  3 +++
 2 files changed, 21 insertions(+)

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index e5520c00c3..03355f56dd 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -359,6 +359,24 @@ check_fortran = \
 	fi ; \
 	rm -f $${__o}* \
 
+#
+#
+# Check that the external toolchain supports OpenMP
+#
+# $1: cross-gcc path
+#
+check_openmp = \
+	__CROSS_CC=$(strip $1) ; \
+	__o=$(BUILD_DIR)/.br-toolchain-test-openmp.tmp ; \
+	printf '\#include <omp.h>\nint main(void) { return omp_get_thread_num(); }' | \
+	$${__CROSS_CC} -fopenmp -x c -o $${__o} - ; \
+	if test $$? -ne 0 ; then \
+		rm -f $${__o}* ; \
+		echo "OpenMP support is selected but is not available in external toolchain"; \
+		exit 1 ; \
+	fi ; \
+	rm -f $${__o}* \
+
 #
 # Check that the cross-compiler given in the configuration exists
 #
diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
index 747837fdc6..baf719ad1f 100644
--- a/toolchain/toolchain-external/pkg-toolchain-external.mk
+++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
@@ -545,6 +545,9 @@ define $(2)_CONFIGURE_CMDS
 	if test "$$(BR2_TOOLCHAIN_HAS_FORTRAN)" = "y" ; then \
 		$$(call check_fortran,$$(TOOLCHAIN_EXTERNAL_FC)) ; \
 	fi ; \
+	if test "$$(BR2_TOOLCHAIN_HAS_OPENMP)" = "y" ; then \
+		$$(call check_openmp,$$(TOOLCHAIN_EXTERNAL_CC)) ; \
+	fi ; \
 	if test "$$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC)" = "y" ; then \
 		$$(call check_uclibc,$$$${SYSROOT_DIR}) ; \
 	elif test "$$(BR2_TOOLCHAIN_EXTERNAL_MUSL)" = "y" ; then \
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 1/2] toolchain-external: introduce BR2_TOOLCHAIN_EXTERNAL_OPENMP
  2019-03-28 18:48 [Buildroot] [PATCH 0/2] Add OpenMP support for custom external toolchains Ed Blake
@ 2019-03-28 18:48 ` Ed Blake
  2019-03-28 18:48 ` [Buildroot] [PATCH 2/2] toolchain-external: add a check for OpenMP support Ed Blake
  2019-03-28 18:53 ` [Buildroot] [PATCH 0/2] Add OpenMP support for custom external toolchains Thomas Petazzoni
  2 siblings, 0 replies; 4+ messages in thread
From: Ed Blake @ 2019-03-28 18:48 UTC (permalink / raw)
  To: buildroot

Add a new option for custom external toolchains to enable OpenMP
support.

Signed-off-by: Ed Blake <ed.blake@sondrel.com>
---
 .../toolchain-external-custom/Config.in.options           | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
index 08a79ee4d9..74e445d625 100644
--- a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
+++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
@@ -421,6 +421,14 @@ config BR2_TOOLCHAIN_EXTERNAL_FORTRAN
 	  support. If you don't know, leave the default value,
 	  Buildroot will tell you if it's correct or not.
 
+config BR2_TOOLCHAIN_EXTERNAL_OPENMP
+	bool "Toolchain has OpenMP support?"
+	select BR2_TOOLCHAIN_HAS_OPENMP
+	help
+	  Select this option if your external toolchain has OpenMP
+	  support. If you don't know, leave the default value,
+	  Buildroot will tell you if it's correct or not.
+
 config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS
 	string "Extra toolchain libraries to be copied to target"
 	help
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 0/2] Add OpenMP support for custom external toolchains
  2019-03-28 18:48 [Buildroot] [PATCH 0/2] Add OpenMP support for custom external toolchains Ed Blake
  2019-03-28 18:48 ` [Buildroot] [PATCH 1/2] toolchain-external: introduce BR2_TOOLCHAIN_EXTERNAL_OPENMP Ed Blake
  2019-03-28 18:48 ` [Buildroot] [PATCH 2/2] toolchain-external: add a check for OpenMP support Ed Blake
@ 2019-03-28 18:53 ` Thomas Petazzoni
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2019-03-28 18:53 UTC (permalink / raw)
  To: buildroot

On Thu, 28 Mar 2019 18:48:14 +0000
Ed Blake <ed.blake@sondrel.com> wrote:

> Ed Blake (2):
>   toolchain-external: introduce BR2_TOOLCHAIN_EXTERNAL_OPENMP
>   toolchain-external: add a check for OpenMP support

Thanks, applied!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-28 18:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-28 18:48 [Buildroot] [PATCH 0/2] Add OpenMP support for custom external toolchains Ed Blake
2019-03-28 18:48 ` [Buildroot] [PATCH 1/2] toolchain-external: introduce BR2_TOOLCHAIN_EXTERNAL_OPENMP Ed Blake
2019-03-28 18:48 ` [Buildroot] [PATCH 2/2] toolchain-external: add a check for OpenMP support Ed Blake
2019-03-28 18:53 ` [Buildroot] [PATCH 0/2] Add OpenMP support for custom external toolchains Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox