
..., and enable if 'flock' is available for serializing execution testing. Regarding the default of 19 parallel slots, this turned out to be a local minimum for wall time when testing this on: $ uname -srvi Linux 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016 x86_64 $ grep '^model name' < /proc/cpuinfo | uniq -c 32 model name : Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz ... in two configurations: case (a) standard configuration, no offloading configured, case (b) offloading for GCN and nvptx configured but no devices available. For both cases, default plus '-m32' variant. $ \time make check-target-libgomp RUNTESTFLAGS="--target_board=unix\{,-m32\}" Case (a), baseline: 6432.23user 332.38system 47:32.28elapsed 237%CPU (0avgtext+0avgdata 505044maxresident)k 6382.43user 319.21system 47:06.04elapsed 237%CPU (0avgtext+0avgdata 505172maxresident)k This is what people have been complaining about, rightly so, in <https://gcc.gnu.org/PR66005> "libgomp make check time is excessive" and elsewhere. Case (a), parallelized: -j12 GCC_TEST_PARALLEL_SLOTS=10 3088.49user 267.74system 6:43.82elapsed 831%CPU (0avgtext+0avgdata 505188maxresident)k -j15 GCC_TEST_PARALLEL_SLOTS=15 3308.08user 294.79system 5:56.04elapsed 1011%CPU (0avgtext+0avgdata 505360maxresident)k -j17 GCC_TEST_PARALLEL_SLOTS=17 3539.93user 298.99system 5:27.86elapsed 1170%CPU (0avgtext+0avgdata 505112maxresident)k -j18 GCC_TEST_PARALLEL_SLOTS=18 3697.50user 317.18system 5:14.63elapsed 1275%CPU (0avgtext+0avgdata 505360maxresident)k -j19 GCC_TEST_PARALLEL_SLOTS=19 3765.94user 324.27system 5:13.22elapsed 1305%CPU (0avgtext+0avgdata 505128maxresident)k -j20 GCC_TEST_PARALLEL_SLOTS=20 3684.66user 312.32system 5:15.26elapsed 1267%CPU (0avgtext+0avgdata 505100maxresident)k -j23 GCC_TEST_PARALLEL_SLOTS=23 4040.59user 347.10system 5:29.12elapsed 1333%CPU (0avgtext+0avgdata 505200maxresident)k -j26 GCC_TEST_PARALLEL_SLOTS=26 3973.24user 377.96system 5:24.70elapsed 1340%CPU (0avgtext+0avgdata 505160maxresident)k -j32 GCC_TEST_PARALLEL_SLOTS=32 4004.42user 346.10system 5:16.11elapsed 1376%CPU (0avgtext+0avgdata 505160maxresident)k Yay! Case (b), baseline; 2+ h: 7227.58user 700.54system 2:14:33elapsed 98%CPU (0avgtext+0avgdata 994264maxresident)k Case (b), parallelized: -j12 GCC_TEST_PARALLEL_SLOTS=10 7377.46user 777.52system 16:06.63elapsed 843%CPU (0avgtext+0avgdata 994344maxresident)k -j15 GCC_TEST_PARALLEL_SLOTS=15 8019.18user 721.42system 12:13.56elapsed 1191%CPU (0avgtext+0avgdata 994228maxresident)k -j17 GCC_TEST_PARALLEL_SLOTS=17 8530.11user 716.95system 10:45.92elapsed 1431%CPU (0avgtext+0avgdata 994176maxresident)k -j18 GCC_TEST_PARALLEL_SLOTS=18 8776.79user 645.89system 10:27.20elapsed 1502%CPU (0avgtext+0avgdata 994248maxresident)k -j19 GCC_TEST_PARALLEL_SLOTS=19 9332.37user 641.76system 10:15.09elapsed 1621%CPU (0avgtext+0avgdata 994260maxresident)k -j20 GCC_TEST_PARALLEL_SLOTS=20 9609.54user 789.88system 10:26.94elapsed 1658%CPU (0avgtext+0avgdata 994284maxresident)k -j23 GCC_TEST_PARALLEL_SLOTS=23 10362.40user 911.14system 10:44.47elapsed 1749%CPU (0avgtext+0avgdata 994208maxresident)k -j26 GCC_TEST_PARALLEL_SLOTS=26 11159.44user 850.99system 11:09.25elapsed 1794%CPU (0avgtext+0avgdata 994256maxresident)k -j32 GCC_TEST_PARALLEL_SLOTS=32 11453.50user 939.52system 11:00.38elapsed 1876%CPU (0avgtext+0avgdata 994240maxresident)k On my Dell Precision 7530 laptop: $ uname -srvi Linux 5.15.0-71-generic #78-Ubuntu SMP Tue Apr 18 09:00:29 UTC 2023 x86_64 $ grep '^model name' < /proc/cpuinfo | uniq -c 12 model name : Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz $ nvidia-smi -L GPU 0: Quadro P1000 (UUID: GPU-e043973b-b52a-d02b-c066-a8fdbf64e8ea) ... in two configurations: case (c) standard configuration, no offloading configured, case (d) offloading for nvptx configured and device available. For both cases, only default variant, no '-m32'. $ \time make check-target-libgomp Case (c), baseline; roughly half of case (a) (just one variant): 1180.98user 110.80system 19:36.40elapsed 109%CPU (0avgtext+0avgdata 505148maxresident)k 1133.22user 111.08system 19:35.75elapsed 105%CPU (0avgtext+0avgdata 505212maxresident)k Case (c), parallelized: -j12 GCC_TEST_PARALLEL_SLOTS=2 1143.83user 110.76system 10:20.46elapsed 202%CPU (0avgtext+0avgdata 505216maxresident)k -j12 GCC_TEST_PARALLEL_SLOTS=6 1737.08user 143.94system 4:59.48elapsed 628%CPU (0avgtext+0avgdata 505200maxresident)k 1730.31user 143.02system 4:58.75elapsed 627%CPU (0avgtext+0avgdata 505152maxresident)k -j12 GCC_TEST_PARALLEL_SLOTS=8 2192.63user 169.34system 4:52.96elapsed 806%CPU (0avgtext+0avgdata 505216maxresident)k 2219.04user 167.67system 4:53.19elapsed 814%CPU (0avgtext+0avgdata 505152maxresident)k -j12 GCC_TEST_PARALLEL_SLOTS=10 2463.93user 184.98system 4:48.39elapsed 918%CPU (0avgtext+0avgdata 505200maxresident)k 2455.62user 183.68system 4:47.40elapsed 918%CPU (0avgtext+0avgdata 505216maxresident)k -j12 GCC_TEST_PARALLEL_SLOTS=12 2591.04user 192.64system 4:44.98elapsed 976%CPU (0avgtext+0avgdata 505216maxresident)k 2581.23user 195.21system 4:47.51elapsed 965%CPU (0avgtext+0avgdata 505212maxresident)k -j20 GCC_TEST_PARALLEL_SLOTS=20 [oversubscribe] 2613.18user 199.51system 4:44.06elapsed 990%CPU (0avgtext+0avgdata 505216maxresident)k Case (d), baseline (compared to case (b): only nvptx offloading compilation, but also nvptx offloading execution); ~1 h: 2841.93user 653.68system 1:02:26elapsed 93%CPU (0avgtext+0avgdata 909792maxresident)k 2842.03user 654.39system 1:02:24elapsed 93%CPU (0avgtext+0avgdata 909880maxresident)k Case (d), parallelized: -j12 GCC_TEST_PARALLEL_SLOTS=2 2856.39user 606.87system 33:58.64elapsed 169%CPU (0avgtext+0avgdata 909948maxresident)k -j12 GCC_TEST_PARALLEL_SLOTS=6 3444.90user 666.86system 18:37.57elapsed 367%CPU (0avgtext+0avgdata 909856maxresident)k 3462.13user 667.13system 18:36.87elapsed 369%CPU (0avgtext+0avgdata 909872maxresident)k -j12 GCC_TEST_PARALLEL_SLOTS=8 3929.74user 716.22system 18:02.36elapsed 429%CPU (0avgtext+0avgdata 909832maxresident)k -j12 GCC_TEST_PARALLEL_SLOTS=10 4152.84user 736.16system 17:43.05elapsed 459%CPU (0avgtext+0avgdata 909872maxresident)k -j12 GCC_TEST_PARALLEL_SLOTS=12 4209.60user 749.00system 17:35.20elapsed 469%CPU (0avgtext+0avgdata 909840maxresident)k -j20 GCC_TEST_PARALLEL_SLOTS=20 [oversubscribe] 4255.54user 756.78system 17:29.06elapsed 477%CPU (0avgtext+0avgdata 909868maxresident)k Worth noting is that with nvptx offloading, there is one execution test case that times out ('libgomp.fortran/reverse-offload-5.f90'). This effectively stalls progress for almost 5 min: quickly other executions test cases queue up on the lock for all parallel slots. That's working as expected; just noting this as it accordingly does skew the wall time numbers. PR testsuite/66005 libgomp/ * configure.ac: Look for 'flock'. * testsuite/Makefile.am (gcc_test_parallel_slots): Enable parallel testing. * testsuite/config/default.exp: Don't 'load_lib "standard.exp"' here... * testsuite/lib/libgomp.exp: ... but here, instead. (libgomp_load): Override for parallel testing. * testsuite/libgomp-site-extra.exp.in (FLOCK): Set. * configure: Regenerate. * Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate.
492 lines
16 KiB
Text
492 lines
16 KiB
Text
# Process this file with autoconf to produce a configure script, like so:
|
|
# aclocal -I ../config && autoconf && autoheader && automake
|
|
|
|
AC_INIT([GNU Offloading and Multi Processing Runtime Library], 1.0,,[libgomp])
|
|
AC_CONFIG_HEADER(config.h)
|
|
|
|
# -------
|
|
# Options
|
|
# -------
|
|
|
|
AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
|
|
LIBGOMP_ENABLE(version-specific-runtime-libs, no, ,
|
|
[Specify that runtime libraries should be installed in a compiler-specific directory],
|
|
permit yes|no)
|
|
AC_MSG_RESULT($enable_version_specific_runtime_libs)
|
|
|
|
# We would like our source tree to be readonly. However when releases or
|
|
# pre-releases are generated, the flex/bison generated files as well as the
|
|
# various formats of manuals need to be included along with the rest of the
|
|
# sources. Therefore we have --enable-generated-files-in-srcdir to do
|
|
# just that.
|
|
AC_MSG_CHECKING([for --enable-generated-files-in-srcdir])
|
|
LIBGOMP_ENABLE(generated-files-in-srcdir, no, ,
|
|
[put copies of generated files in source dir intended for creating source
|
|
tarballs for users without texinfo bison or flex.],
|
|
permit yes|no)
|
|
AC_MSG_RESULT($enable_generated_files_in_srcdir)
|
|
AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes)
|
|
|
|
|
|
# -------
|
|
# -------
|
|
|
|
# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
|
|
#
|
|
# You will slowly go insane if you do not grok the following fact: when
|
|
# building this library, the top-level /target/ becomes the library's /host/.
|
|
#
|
|
# configure then causes --target to default to --host, exactly like any
|
|
# other package using autoconf. Therefore, 'target' and 'host' will
|
|
# always be the same. This makes sense both for native and cross compilers
|
|
# just think about it for a little while. :-)
|
|
#
|
|
# Also, if this library is being configured as part of a cross compiler, the
|
|
# top-level configure script will pass the "real" host as $with_cross_host.
|
|
#
|
|
# Do not delete or change the following two lines. For why, see
|
|
# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
|
|
AC_CANONICAL_SYSTEM
|
|
target_alias=${target_alias-$host_alias}
|
|
|
|
# Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the
|
|
# following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
|
|
# 1.9.0: minimum required version
|
|
# no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch
|
|
# of other PACKAGE_* variables will, however, and there's nothing
|
|
# we can do about that; they come from AC_INIT).
|
|
# foreign: we don't follow the normal rules for GNU packages (no COPYING
|
|
# file in the top srcdir, etc, etc), so stop complaining.
|
|
# no-dist: we don't want 'dist' and related rules.
|
|
# -Wall: turns on all automake warnings...
|
|
# -Wno-portability: ...except this one, since GNU make is required.
|
|
# -Wno-override: ... and this one, since we do want this in testsuite.
|
|
AM_INIT_AUTOMAKE([1.9.0 foreign no-dist -Wall -Wno-portability -Wno-override])
|
|
AM_ENABLE_MULTILIB(, ..)
|
|
|
|
GCC_WITH_TOOLEXECLIBDIR
|
|
|
|
# Calculate toolexeclibdir
|
|
# Also toolexecdir, though it's only used in toolexeclibdir
|
|
case ${enable_version_specific_runtime_libs} in
|
|
yes)
|
|
# Need the gcc compiler version to know where to install libraries
|
|
# and header files if --enable-version-specific-runtime-libs option
|
|
# is selected.
|
|
toolexecdir='$(libdir)/gcc/$(target_alias)'
|
|
toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
|
|
;;
|
|
no)
|
|
if test -n "$with_cross_host" &&
|
|
test x"$with_cross_host" != x"no"; then
|
|
# Install a library built with a cross compiler in tooldir, not libdir.
|
|
toolexecdir='$(exec_prefix)/$(target_alias)'
|
|
case ${with_toolexeclibdir} in
|
|
no)
|
|
toolexeclibdir='$(toolexecdir)/lib'
|
|
;;
|
|
*)
|
|
toolexeclibdir=${with_toolexeclibdir}
|
|
;;
|
|
esac
|
|
else
|
|
toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
|
|
toolexeclibdir='$(libdir)'
|
|
fi
|
|
multi_os_directory=`$CC -print-multi-os-directory`
|
|
case $multi_os_directory in
|
|
.) ;; # Avoid trailing /.
|
|
*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
|
|
esac
|
|
;;
|
|
esac
|
|
AC_SUBST(toolexecdir)
|
|
AC_SUBST(toolexeclibdir)
|
|
|
|
# Check the compiler.
|
|
# The same as in boehm-gc and libstdc++. Have to borrow it from there.
|
|
# We must force CC to /not/ be precious variables; otherwise
|
|
# the wrong, non-multilib-adjusted value will be used in multilibs.
|
|
# As a side effect, we have to subst CFLAGS ourselves.
|
|
|
|
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
|
|
m4_define([_AC_ARG_VAR_PRECIOUS],[])
|
|
AC_PROG_CC
|
|
m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
|
|
|
|
AC_SUBST(CFLAGS)
|
|
|
|
# In order to override CFLAGS_FOR_TARGET, all of our special flags go
|
|
# in XCFLAGS. But we need them in CFLAGS during configury. So put them
|
|
# in both places for now and restore CFLAGS at the end of config.
|
|
save_CFLAGS="$CFLAGS"
|
|
|
|
AC_ARG_ENABLE([werror],
|
|
[AS_HELP_STRING([--disable-werror], [disable building with -Werror])])
|
|
# Add -Wall -Werror if we are using GCC.
|
|
AS_IF([test "x$GCC" = "xyes"],
|
|
[XCFLAGS="$XCFLAGS -Wall"])
|
|
AS_IF([test "x$enable_werror" != "xno" && test "x$GCC" = "xyes"],
|
|
[XCFLAGS="$XCFLAGS -Werror"])
|
|
|
|
# Find other programs we need.
|
|
AC_CHECK_TOOL(AR, ar)
|
|
AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
|
|
AC_PATH_PROG(PERL, perl, perl-not-found-in-path-error)
|
|
AC_PROG_MAKE_SET
|
|
AC_PROG_INSTALL
|
|
|
|
# See if makeinfo has been installed and is modern enough
|
|
# that we can use it.
|
|
ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version],
|
|
[GNU texinfo.* \([0-9][0-9.]*\)],
|
|
[4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
|
|
AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
|
|
|
|
|
|
# Configure libtool
|
|
AM_PROG_LIBTOOL
|
|
ACX_LT_HOST_FLAGS
|
|
AC_SUBST(enable_shared)
|
|
AC_SUBST(enable_static)
|
|
|
|
AM_MAINTAINER_MODE
|
|
|
|
# We optionally test libgomp C++ support, and for that want to use the proper
|
|
# C++ driver, 'g++' (or 'xg++' for build-tree testing). Given that build of
|
|
# target libstdc++-v3 depends on target libgomp (see '../Makefile.def'), we
|
|
# cannot make build of target libgomp depend on target libstdc++-v3: circular
|
|
# dependency. We thus cannot instantiate 'AC_PROG_CXX' here: we'd get
|
|
# '-funconfigured-libstdc++-v3' (see '../configure.ac'). Therefore, just
|
|
# capture 'CXX', and we'll fix this up at 'make check' time (see
|
|
# 'testsuite/lib/libgomp.exp:libgomp_init').
|
|
AC_SUBST(CXX)
|
|
|
|
# Create a spec file, so that compile/link tests don't fail
|
|
test -f libgfortran.spec || touch libgfortran.spec
|
|
FCFLAGS="$FCFLAGS -L."
|
|
|
|
# We need 'gfortran' to compile parts of the library, and test libgomp Fortran
|
|
# support.
|
|
# We can't use AC_PROG_FC because it expects a fully working gfortran.
|
|
#AC_PROG_FC(gfortran)
|
|
case `echo $GFORTRAN` in
|
|
-* | no* )
|
|
FC=no ;;
|
|
*)
|
|
set dummy $GFORTRAN; ac_word=$2
|
|
if test -x "$ac_word"; then
|
|
FC="$GFORTRAN"
|
|
else
|
|
FC=no
|
|
fi ;;
|
|
esac
|
|
AC_PROG_FC(gfortran)
|
|
FCFLAGS="$FCFLAGS -Wall -L../libgfortran"
|
|
|
|
# For libtool versioning info, format is CURRENT:REVISION:AGE
|
|
libtool_VERSION=1:0:0
|
|
AC_SUBST(libtool_VERSION)
|
|
|
|
# Check header files.
|
|
AC_STDC_HEADERS
|
|
AC_HEADER_TIME
|
|
ACX_HEADER_STRING
|
|
AC_CHECK_HEADERS(pthread.h unistd.h semaphore.h sys/loadavg.h sys/sysctl.h sys/time.h)
|
|
|
|
XPCFLAGS=""
|
|
case "$host" in
|
|
*-*-rtems*)
|
|
# RTEMS supports Pthreads, but the library is not available at GCC build time.
|
|
;;
|
|
nvptx*-*-* | amdgcn*-*-*)
|
|
# NVPTX does not support Pthreads, has its own code replacement.
|
|
libgomp_use_pthreads=no
|
|
# NVPTX is an accelerator-only target
|
|
libgomp_offloaded_only=yes
|
|
;;
|
|
*)
|
|
# Check to see if -pthread or -lpthread is needed. Prefer the former.
|
|
# In case the pthread.h system header is not found, this test will fail.
|
|
CFLAGS="$CFLAGS -pthread"
|
|
AC_LINK_IFELSE(
|
|
[AC_LANG_PROGRAM(
|
|
[#include <pthread.h>
|
|
void *g(void *d) { return NULL; }],
|
|
[pthread_t t; pthread_create(&t,NULL,g,NULL);])],
|
|
[XPCFLAGS=" -Wc,-pthread"],
|
|
[CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
|
|
AC_LINK_IFELSE(
|
|
[AC_LANG_PROGRAM(
|
|
[#include <pthread.h>
|
|
void *g(void *d) { return NULL; }],
|
|
[pthread_t t; pthread_create(&t,NULL,g,NULL);])],
|
|
[],
|
|
[AC_MSG_ERROR([Pthreads are required to build libgomp])])])
|
|
esac
|
|
|
|
if test x$libgomp_use_pthreads != xno; then
|
|
AC_DEFINE(LIBGOMP_USE_PTHREADS, 1,
|
|
[Define to 1 if libgomp should use POSIX threads.])
|
|
fi
|
|
|
|
if test x$libgomp_offloaded_only = xyes; then
|
|
AC_DEFINE(LIBGOMP_OFFLOADED_ONLY, 1,
|
|
[Define to 1 if building libgomp for an accelerator-only target.])
|
|
fi
|
|
|
|
if test "x$enable_offload_defaulted" = xyes; then
|
|
AC_DEFINE(OFFLOAD_DEFAULTED, 1,
|
|
[Define to 1 to if -foffload is defaulted])
|
|
fi
|
|
|
|
AC_CHECK_SIZEOF([void *])
|
|
|
|
m4_include([plugin/configfrag.ac])
|
|
|
|
# Check for functions needed.
|
|
AC_CHECK_FUNCS(getloadavg clock_gettime strtoull)
|
|
AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
|
|
|
|
# Check for broken semaphore implementation on darwin.
|
|
# sem_init returns: sem_init error: Function not implemented.
|
|
case "$host" in
|
|
*-darwin*)
|
|
AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
|
|
Define if the POSIX Semaphores do not work on your system.)
|
|
;;
|
|
esac
|
|
|
|
# RTEMS specific checks
|
|
case "$host" in
|
|
*-*-rtems*)
|
|
AC_CHECK_TYPES([struct _Mutex_Control],[],[],[#include <sys/lock.h>])
|
|
;;
|
|
esac
|
|
|
|
GCC_LINUX_FUTEX(:)
|
|
|
|
# Check for pthread_{,attr_}[sg]etaffinity_np.
|
|
AC_LINK_IFELSE(
|
|
[AC_LANG_PROGRAM(
|
|
[#define _GNU_SOURCE
|
|
#include <pthread.h>],
|
|
[cpu_set_t cpuset;
|
|
pthread_attr_t attr;
|
|
pthread_getaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
|
|
if (CPU_ISSET (0, &cpuset))
|
|
CPU_SET (1, &cpuset);
|
|
else
|
|
CPU_ZERO (&cpuset);
|
|
pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
|
|
pthread_attr_init (&attr);
|
|
pthread_attr_getaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);
|
|
pthread_attr_setaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);])],
|
|
AC_DEFINE(HAVE_PTHREAD_AFFINITY_NP, 1,
|
|
[ Define if pthread_{,attr_}{g,s}etaffinity_np is supported.]))
|
|
|
|
# At least for glibc, clock_gettime is in librt. But don't pull that
|
|
# in if it still doesn't give us the function we want.
|
|
if test $ac_cv_func_clock_gettime = no; then
|
|
AC_CHECK_LIB(rt, clock_gettime,
|
|
[LIBS="-lrt $LIBS"
|
|
AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
|
|
[Define to 1 if you have the `clock_gettime' function.])])
|
|
fi
|
|
|
|
# Check for uname.
|
|
AC_COMPILE_IFELSE(
|
|
[AC_LANG_PROGRAM(
|
|
[#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <sys/utsname.h>],
|
|
[struct utsname buf;
|
|
volatile size_t len = 0;
|
|
if (!uname (buf))
|
|
len = strlen (buf.nodename);])],
|
|
AC_DEFINE(HAVE_UNAME, 1,
|
|
[ Define if uname is supported and struct utsname has nodename field.]))
|
|
|
|
# Check for gethostname.
|
|
AC_COMPILE_IFELSE(
|
|
[AC_LANG_PROGRAM(
|
|
[#include <unistd.h>],
|
|
[
|
|
changequote(,)dnl
|
|
char buf[256];
|
|
if (gethostname (buf, sizeof (buf) - 1) == 0)
|
|
buf[255] = '\0';
|
|
changequote([,])dnl
|
|
])],
|
|
AC_DEFINE(HAVE_GETHOSTNAME, 1,
|
|
[ Define if gethostname is supported.]))
|
|
|
|
# Check for getpid.
|
|
AC_COMPILE_IFELSE(
|
|
[AC_LANG_PROGRAM(
|
|
[#include <unistd.h>],
|
|
[int pid = getpid ();])],
|
|
AC_DEFINE(HAVE_GETPID, 1,
|
|
[ Define if getpid is supported.]))
|
|
|
|
# See if we support thread-local storage.
|
|
GCC_CHECK_TLS
|
|
|
|
# See if we have emulated thread-local storage.
|
|
GCC_CHECK_EMUTLS
|
|
|
|
# See what sort of export controls are available.
|
|
LIBGOMP_CHECK_ATTRIBUTE_VISIBILITY
|
|
LIBGOMP_CHECK_ATTRIBUTE_DLLEXPORT
|
|
LIBGOMP_CHECK_ATTRIBUTE_ALIAS
|
|
LIBGOMP_ENABLE_SYMVERS
|
|
|
|
if test $enable_symvers = gnu; then
|
|
AC_DEFINE(LIBGOMP_GNU_SYMBOL_VERSIONING, 1,
|
|
[Define to 1 if GNU symbol versioning is used for libgomp.])
|
|
fi
|
|
|
|
# Determine cpu count to limit testsuite parallelism.
|
|
AX_COUNT_CPUS
|
|
AC_SUBST(CPU_COUNT)
|
|
|
|
AC_CHECK_PROGS(FLOCK, flock)
|
|
|
|
# Get target configury.
|
|
. ${srcdir}/configure.tgt
|
|
CFLAGS="$save_CFLAGS $XCFLAGS"
|
|
|
|
# Check for __sync_val_compare_and_swap, but only after the target has
|
|
# had a chance to set XCFLAGS.
|
|
LIBGOMP_CHECK_SYNC_BUILTINS
|
|
|
|
XCFLAGS="$XCFLAGS$XPCFLAGS"
|
|
|
|
# Add CET specific flags if CET is enabled
|
|
GCC_CET_FLAGS(CET_FLAGS)
|
|
XCFLAGS="$XCFLAGS $CET_FLAGS"
|
|
FCFLAGS="$FCFLAGS $CET_FLAGS"
|
|
|
|
AC_SUBST(config_path)
|
|
AC_SUBST(XCFLAGS)
|
|
AC_SUBST(XLDFLAGS)
|
|
|
|
# Conditionalize the makefile for this target machine.
|
|
tmake_file_=
|
|
for f in ${tmake_file}
|
|
do
|
|
if test -f ${srcdir}/config/$f
|
|
then
|
|
tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
|
|
fi
|
|
done
|
|
tmake_file="${tmake_file_}"
|
|
AC_SUBST(tmake_file)
|
|
|
|
# Cleanup and exit.
|
|
CFLAGS="$save_CFLAGS"
|
|
AC_CACHE_SAVE
|
|
|
|
if test ${multilib} = yes; then
|
|
multilib_arg="--enable-multilib"
|
|
else
|
|
multilib_arg=
|
|
fi
|
|
|
|
# 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,
|
|
# which will force linkage against -lpthread (or equivalent for the system).
|
|
# That's not 100% ideal, but about the best we can do easily.
|
|
if test $enable_shared = yes; then
|
|
link_gomp="-lgomp %{static: $LIBS}"
|
|
else
|
|
link_gomp="-lgomp $LIBS"
|
|
fi
|
|
AC_SUBST(link_gomp)
|
|
|
|
AM_CONDITIONAL([USE_FORTRAN], [test "$ac_cv_fc_compiler_gnu" = yes])
|
|
|
|
# ??? 2006-01-24: Paulo committed to asking autoconf folk to document
|
|
# and export AC_COMPUTE_INT. If that happens, then we'll need to remove
|
|
# the underscore here and update the PREREQ. If it doesn't, then we'll
|
|
# need to copy this macro to our acinclude.m4.
|
|
save_CFLAGS="$CFLAGS"
|
|
for i in $config_path; do
|
|
if test -f $srcdir/config/$i/omp-lock.h; then
|
|
CFLAGS="$CFLAGS -include confdefs.h -include $srcdir/config/$i/omp-lock.h"
|
|
break
|
|
fi
|
|
done
|
|
|
|
_AC_COMPUTE_INT([sizeof (__INTPTR_TYPE__)], [INTPTR_T_KIND])
|
|
_AC_COMPUTE_INT([sizeof (__int128)], [OMP_INT128_SIZE],,[OMP_INT128_SIZE=0])
|
|
_AC_COMPUTE_INT([2*sizeof (__INTPTR_TYPE__)], [OMP_DEPEND_KIND],,
|
|
[OMP_DEPEND_KIND=0])
|
|
_AC_COMPUTE_INT([sizeof (omp_lock_t)], [OMP_LOCK_SIZE],,
|
|
[AC_MSG_ERROR([unsupported system, cannot find sizeof (omp_lock_t)])])
|
|
_AC_COMPUTE_INT([__alignof (omp_lock_t)], [OMP_LOCK_ALIGN])
|
|
_AC_COMPUTE_INT([sizeof (omp_nest_lock_t)], [OMP_NEST_LOCK_SIZE])
|
|
_AC_COMPUTE_INT([__alignof (omp_nest_lock_t)], [OMP_NEST_LOCK_ALIGN])
|
|
_AC_COMPUTE_INT([sizeof (omp_lock_25_t)], [OMP_LOCK_25_SIZE],,
|
|
[AC_MSG_ERROR([unsupported system, cannot find sizeof (omp_lock_25_t)])])
|
|
_AC_COMPUTE_INT([__alignof (omp_lock_25_t)], [OMP_LOCK_25_ALIGN])
|
|
_AC_COMPUTE_INT([sizeof (omp_nest_lock_25_t)], [OMP_NEST_LOCK_25_SIZE])
|
|
_AC_COMPUTE_INT([__alignof (omp_nest_lock_25_t)], [OMP_NEST_LOCK_25_ALIGN])
|
|
|
|
# If the lock fits in an integer, then arrange for Fortran to use that
|
|
# integer. If it doesn't, then arrange for Fortran to use a pointer.
|
|
# Except that we don't have a way at present to multi-lib the installed
|
|
# Fortran modules, so we assume 8 bytes for pointers, regardless of the
|
|
# actual target.
|
|
OMP_LOCK_KIND=$OMP_LOCK_SIZE
|
|
OMP_NEST_LOCK_KIND=$OMP_NEST_LOCK_SIZE
|
|
if test $OMP_LOCK_SIZE -gt 8 || test $OMP_LOCK_ALIGN -gt $OMP_LOCK_SIZE; then
|
|
OMP_LOCK_KIND=8
|
|
fi
|
|
if test $OMP_NEST_LOCK_SIZE -gt 8 || test $OMP_NEST_LOCK_ALIGN -gt $OMP_NEST_LOCK_SIZE; then
|
|
OMP_NEST_LOCK_KIND=8
|
|
fi
|
|
OMP_LOCK_25_KIND=$OMP_LOCK_25_SIZE
|
|
OMP_NEST_LOCK_25_KIND=$OMP_NEST_LOCK_25_SIZE
|
|
if test $OMP_LOCK_25_SIZE -gt 8 || test $OMP_LOCK_25_ALIGN -gt $OMP_LOCK_25_SIZE; then
|
|
OMP_LOCK_25_KIND=8
|
|
fi
|
|
if test $OMP_NEST_LOCK_25_SIZE -gt 8 || test $OMP_NEST_LOCK_25_ALIGN -gt $OMP_NEST_LOCK_25_SIZE; then
|
|
OMP_NEST_LOCK_25_KIND=8
|
|
fi
|
|
if test "$ac_cv_fc_compiler_gnu" = yes; then
|
|
if test $OMP_DEPEND_KIND -eq 16; then
|
|
if test $OMP_INT128_SIZE -ne 16; then
|
|
AC_MSG_ERROR([unsupported system, cannot find Fortran int kind=16, needed for omp_depend_kind])
|
|
fi
|
|
else
|
|
if test $OMP_DEPEND_KIND -ne 8; then
|
|
AC_MSG_ERROR([unsupported system, cannot find Fortran integer kind for omp_depend_kind])
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
AC_SUBST(INTPTR_T_KIND)
|
|
AC_SUBST(OMP_LOCK_SIZE)
|
|
AC_SUBST(OMP_LOCK_ALIGN)
|
|
AC_SUBST(OMP_NEST_LOCK_SIZE)
|
|
AC_SUBST(OMP_NEST_LOCK_ALIGN)
|
|
AC_SUBST(OMP_LOCK_KIND)
|
|
AC_SUBST(OMP_NEST_LOCK_KIND)
|
|
AC_SUBST(OMP_LOCK_25_SIZE)
|
|
AC_SUBST(OMP_LOCK_25_ALIGN)
|
|
AC_SUBST(OMP_NEST_LOCK_25_SIZE)
|
|
AC_SUBST(OMP_NEST_LOCK_25_ALIGN)
|
|
AC_SUBST(OMP_LOCK_25_KIND)
|
|
AC_SUBST(OMP_NEST_LOCK_25_KIND)
|
|
AC_SUBST(OMP_DEPEND_KIND)
|
|
CFLAGS="$save_CFLAGS"
|
|
|
|
# Determine what GCC version number to use in filesystem paths.
|
|
GCC_BASE_VER
|
|
|
|
AC_CONFIG_FILES(omp.h omp_lib.h omp_lib.f90 libgomp_f.h)
|
|
AC_CONFIG_FILES(Makefile testsuite/Makefile libgomp.spec)
|
|
AC_CONFIG_FILES([testsuite/libgomp-test-support.pt.exp:testsuite/libgomp-test-support.exp.in])
|
|
AC_CONFIG_FILES([testsuite/libgomp-site-extra.exp])
|
|
AC_OUTPUT
|