[PATCH 4/4] OpenMP 4.0 offloading to Intel MIC: non-fallback testing.

libgomp/
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Set up offload_additional_options,
	offload_additional_lib_paths and offload_targets.
	* testsuite/Makefile.am: Export environment variables: OFFLOAD_TARGETS,
	OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/lib/libgomp.exp (libgomp_init): Append
	offload_additional_lib_paths to LD_LIBRARY_PATH.  Append
	offload_additional_options to ALWAYS_CFLAGS.  Append liboffloadmic
	build directory to LD_LIBRARY_PATH for intelmic offload targets.

Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com>

From-SVN: r217500
This commit is contained in:
Andrey Turetskiy 2014-11-13 14:07:09 +00:00 committed by Kirill Yukhin
parent 9d73ec14be
commit d64ae6140f
7 changed files with 89 additions and 2 deletions

View File

@ -1,3 +1,18 @@
2014-11-13 Andrey Turetskiy <andrey.turetskiy@intel.com>
Ilya Verbin <ilya.verbin@intel.com>
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac: Set up offload_additional_options,
offload_additional_lib_paths and offload_targets.
* testsuite/Makefile.am: Export environment variables: OFFLOAD_TARGETS,
OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS.
* testsuite/Makefile.in: Regenerate.
* testsuite/lib/libgomp.exp (libgomp_init): Append
offload_additional_lib_paths to LD_LIBRARY_PATH. Append
offload_additional_options to ALWAYS_CFLAGS. Append liboffloadmic
build directory to LD_LIBRARY_PATH for intelmic offload targets.
2014-11-13 Andrey Turetskiy <andrey.turetskiy@intel.com> 2014-11-13 Andrey Turetskiy <andrey.turetskiy@intel.com>
Ilya Verbin <ilya.verbin@intel.com> Ilya Verbin <ilya.verbin@intel.com>
Kirill Yukhin <kirill.yukhin@intel.com> Kirill Yukhin <kirill.yukhin@intel.com>

View File

@ -268,6 +268,9 @@ lt_host_flags = @lt_host_flags@
mandir = @mandir@ mandir = @mandir@
mkdir_p = @mkdir_p@ mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@ multi_basedir = @multi_basedir@
offload_additional_lib_paths = @offload_additional_lib_paths@
offload_additional_options = @offload_additional_options@
offload_targets = @offload_targets@
oldincludedir = @oldincludedir@ oldincludedir = @oldincludedir@
pdfdir = @pdfdir@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@

21
libgomp/configure vendored
View File

@ -616,6 +616,9 @@ OMP_LOCK_SIZE
USE_FORTRAN_FALSE USE_FORTRAN_FALSE
USE_FORTRAN_TRUE USE_FORTRAN_TRUE
link_gomp link_gomp
offload_additional_lib_paths
offload_additional_options
offload_targets
XLDFLAGS XLDFLAGS
XCFLAGS XCFLAGS
config_path config_path
@ -11094,7 +11097,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 11097 "configure" #line 11100 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -11200,7 +11203,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 11203 "configure" #line 11206 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -16207,9 +16210,13 @@ else
multilib_arg= multilib_arg=
fi fi
# Get accel target and path to install tree of accel compiler
offload_additional_options=
offload_additional_lib_paths=
offload_targets= offload_targets=
if test x"$enable_offload_targets" != x; then if test x"$enable_offload_targets" != x; then
for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
tgt=`echo $tgt | sed 's/=.*//'` tgt=`echo $tgt | sed 's/=.*//'`
case $tgt in case $tgt in
*-intelmic-* | *-intelmicemul-*) *-intelmic-* | *-intelmicemul-*)
@ -16222,6 +16229,13 @@ if test x"$enable_offload_targets" != x; then
else else
offload_targets=$offload_targets,$tgt_name offload_targets=$offload_targets,$tgt_name
fi fi
if test x"$tgt_dir" != x; then
offload_additional_options="$offload_additional_options -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin"
offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib"
else
offload_additional_options="$offload_additional_options -B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)"
offload_additional_lib_paths="$offload_additional_lib_paths:$toolexeclibdir"
fi
done done
fi fi
@ -16230,6 +16244,9 @@ cat >>confdefs.h <<_ACEOF
_ACEOF _ACEOF
# Set up the set of libraries that we need to link against for libgomp. # Set up the set of libraries that we need to link against for libgomp.
# Note that the GOMP_SELF_SPEC in gcc.c may force -pthread, # Note that the GOMP_SELF_SPEC in gcc.c may force -pthread,
# which will force linkage against -lpthread (or equivalent for the system). # which will force linkage against -lpthread (or equivalent for the system).

View File

@ -280,9 +280,13 @@ else
multilib_arg= multilib_arg=
fi fi
# Get accel target and path to install tree of accel compiler
offload_additional_options=
offload_additional_lib_paths=
offload_targets= offload_targets=
if test x"$enable_offload_targets" != x; then if test x"$enable_offload_targets" != x; then
for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
tgt=`echo $tgt | sed 's/=.*//'` tgt=`echo $tgt | sed 's/=.*//'`
case $tgt in case $tgt in
*-intelmic-* | *-intelmicemul-*) *-intelmic-* | *-intelmicemul-*)
@ -295,10 +299,20 @@ if test x"$enable_offload_targets" != x; then
else else
offload_targets=$offload_targets,$tgt_name offload_targets=$offload_targets,$tgt_name
fi fi
if test x"$tgt_dir" != x; then
offload_additional_options="$offload_additional_options -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin"
offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib"
else
offload_additional_options="$offload_additional_options -B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)"
offload_additional_lib_paths="$offload_additional_lib_paths:$toolexeclibdir"
fi
done done
fi fi
AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets", AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
[Define to hold the list of target names suitable for offloading.]) [Define to hold the list of target names suitable for offloading.])
AC_SUBST(offload_targets)
AC_SUBST(offload_additional_options)
AC_SUBST(offload_additional_lib_paths)
# Set up the set of libraries that we need to link against for libgomp. # Set up the set of libraries that we need to link against for libgomp.
# Note that the GOMP_SELF_SPEC in gcc.c may force -pthread, # Note that the GOMP_SELF_SPEC in gcc.c may force -pthread,

View File

@ -11,3 +11,8 @@ EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
_RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi) echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)" RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)"
# Used for support non-fallback offloading.
export OFFLOAD_TARGETS = $(offload_targets)
export OFFLOAD_ADDITIONAL_OPTIONS = $(offload_additional_options)
export OFFLOAD_ADDITIONAL_LIB_PATHS = $(offload_additional_lib_paths)

View File

@ -184,6 +184,9 @@ lt_host_flags = @lt_host_flags@
mandir = @mandir@ mandir = @mandir@
mkdir_p = @mkdir_p@ mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@ multi_basedir = @multi_basedir@
offload_additional_lib_paths = @offload_additional_lib_paths@
offload_additional_options = @offload_additional_options@
offload_targets = @offload_targets@
oldincludedir = @oldincludedir@ oldincludedir = @oldincludedir@
pdfdir = @pdfdir@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
@ -408,6 +411,11 @@ uninstall-am:
uninstall uninstall-am uninstall uninstall-am
# Used for support non-fallback offloading.
export OFFLOAD_TARGETS = $(offload_targets)
export OFFLOAD_ADDITIONAL_OPTIONS = $(offload_additional_options)
export OFFLOAD_ADDITIONAL_LIB_PATHS = $(offload_additional_lib_paths)
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: .NOEXPORT:

View File

@ -107,6 +107,25 @@ proc libgomp_init { args } {
# Compute what needs to be put into LD_LIBRARY_PATH # Compute what needs to be put into LD_LIBRARY_PATH
set always_ld_library_path ".:${blddir}/.libs" set always_ld_library_path ".:${blddir}/.libs"
# Get offload-related variables from environment (exported by Makefile)
set offload_targets [getenv OFFLOAD_TARGETS]
set offload_additional_options [getenv OFFLOAD_ADDITIONAL_OPTIONS]
set offload_additional_lib_paths [getenv OFFLOAD_ADDITIONAL_LIB_PATHS]
# Add liboffloadmic build directory in LD_LIBRARY_PATH to support
# non-fallback testing for Intel MIC targets
if { [string match "*-intelmic-*" $offload_targets]
|| [string match "*-intelmicemul-*" $offload_targets] } {
append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
# libstdc++ is required by liboffloadmic
append always_ld_library_path ":${blddir}/../libstdc++-v3/src/.libs"
}
if { $offload_additional_lib_paths != "" } {
append always_ld_library_path "${offload_additional_lib_paths}"
}
# Compute what needs to be added to the existing LD_LIBRARY_PATH. # Compute what needs to be added to the existing LD_LIBRARY_PATH.
if {$gccdir != ""} { if {$gccdir != ""} {
# Add AIX pthread directory first. # Add AIX pthread directory first.
@ -169,6 +188,12 @@ proc libgomp_init { args } {
# Disable color diagnostics # Disable color diagnostics
lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never" lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
# Used for support non-fallback offloading.
# Help GCC to find target mkoffload.
if { $offload_additional_options != "" } {
lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}"
}
} }
# #