Add OpenMP support for custom external toolchains
cover Add OpenMP support for custom external toolchains
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(+)
Signature · 1 line
2.17.1
PATCH 1/2 toolchain-external: introduce BR2_TOOLCHAIN_EXTERNAL_OPENMP
Add a new option for custom external toolchains to enable OpenMP support.
--- .../toolchain-external-custom/Config.in.options | 8 ++++++++ 1 file changed, 8 insertions(+)
toolchain/toolchain-external/toolchain-external-custom/Config.in.options +8 -0
@@ -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
Signature · 1 line
2.17.1
PATCH 2/2 toolchain-external: add a check for OpenMP support
In reply to Ed Blake--- toolchain/helpers.mk | 18 ++++++++++++++++++ .../pkg-toolchain-external.mk | 3 +++ 2 files changed, 21 insertions(+)
toolchain/helpers.mk +18 -0
@@ -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 #
toolchain/toolchain-external/pkg-toolchain-external.mk +3 -0
@@ -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 \
Signature · 1 line
2.17.1
Thomas Petazzoni
Appliedcover Add OpenMP support for custom external toolchains
In reply to Ed BlakeQuoted 3 lines · On Thu, 28 Mar 2019 18:48:14 +0000 Ed Blake <[email protected]> wrote:
Ed Blake (2):
toolchain-external: introduceBR2_TOOLCHAIN_EXTERNAL_OPENMP
toolchain-external: add a check for OpenMP support
Thanks, applied!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com