Commit 646ac7fe authored by Leo Pound Singer's avatar Leo Pound Singer

Add common configuration macro for OpenMP

Addresses #4558.
Original: b9c615752e341639f4c29c50d179bd925eed2379
parent 0d982ae5
# -*- mode: autoconf; -*-
# lalsuite_build.m4 - top level build macros
#
# serial 128
# serial 129
# restrict which LALSUITE_... patterns can appearing in output (./configure);
# useful for debugging problems with unexpanded LALSUITE_... Autoconf macros
......@@ -1387,3 +1387,56 @@ AC_DEFUN([LALSUITE_ENABLE_HELP2MAN],[
LALSUITE_ENABLE_MODULE([HELP2MAN])
# end $0
])
AC_DEFUN([LALSUITE_ENABLE_OPENMP],[
# $0: check for OpenMP support
# check for OpenMP
AC_OPENMP
# check that compiler supports C99 variable length arrays in OpenMP for loops.
# Apple's llvm-gcc-4.2 is buggy and does not.
AS_IF([test "x$OPENMP_CFLAGS" != "x"],
[
AC_MSG_CHECKING([if compiler supports C99 VLAs in OpenMP for loops])
LALSUITE_PUSH_UVARS
CFLAGS="$OPENMP_CFLAGS"
AC_LINK_IFELSE([
AC_LANG_PROGRAM(, [
int i, n = 10;
#pragma omp parallel for
for (i = 0; i < 10; i ++)
{ int a@<:@n@:>@; }
])
],
[AC_MSG_RESULT([yes])],
[
AC_MSG_RESULT([no, disabling OpenMP])
OPENMP_CFLAGS=
]
)
LALSUITE_POP_UVARS
]
)
# Disable OpenMP by default.
# FIXME: OpenMP should be on by default, but it breaks condor_compiling lalapps.
AS_IF(
[test "x$enable_openmp" = "x"],
[OPENMP_CFLAGS=]
)
# add compiler flags for OpenMP
AS_IF(
[test "x$OPENMP_CFLAGS" = "x" -a "x$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp" != "xnone needed"],
[
openmp="false"
LALSUITE_ADD_FLAGS([C],[-Wno-unknown-pragmas],[])
],
[
openmp="true"
LALSUITE_ADD_FLAGS([C],[${OPENMP_CFLAGS}],[])
]
)
LALSUITE_ENABLE_MODULE([OPENMP])
# end $0
])
......@@ -419,35 +419,8 @@ if test "${cuda}" = "true"; then
fi
# check for OpenMP
AC_OPENMP
# Disable OpenMP by default.
# FIXME: OpenMP should be on by default, but it breaks condor_compiling lalapps.
AS_IF(
[test "x$enable_openmp" = "x"],
[OPENMP_CFLAGS=]
)
# add compiler flags for OpenMP
AS_IF(
[test "x$OPENMP_CFLAGS" = "x" -a "x$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp" != "xnone needed"],
[
OPENMP_ENABLE_VAL="DISABLED"
LALSUITE_ADD_FLAGS([C],[-Wno-unknown-pragmas],[])
],
[
OPENMP_ENABLE_VAL="ENABLED"
LALSUITE_ADD_FLAGS([C],[${OPENMP_CFLAGS}],[])
]
)
# create Automake conditional so that we know whether we need to build
# OpenMP-specific tests
AM_CONDITIONAL([HAVE_OPENMP],[test "x$OPENMP_ENABLE_VAL" = "xENABLED"])
# create Automake conditional so that we know whether we need to build
# OpenMP-specific tests
AM_CONDITIONAL([HAVE_OPENMP],[test "x$OPENMP_ENABLE_VAL" = "xENABLED"])
# add gcc specific flags
LALSUITE_ENABLE_OPENMP
LALSUITE_ADD_GCC_FLAGS
# link any executables against LALApps library
......
......@@ -141,32 +141,7 @@ AC_CHECK_HEADERS([unistd.h])
AC_CHECK_LIB([m],[main],,[AC_MSG_ERROR([could not find the math library])])
# check for OpenMP
AC_OPENMP
# check that compiler supports C99 variable length arrays in OpenMP for loops.
# Apple's llvm-gcc-4.2 is buggy and does not.
AS_IF([test "x$OPENMP_CFLAGS" != "x"],
[
AC_MSG_CHECKING([if compiler supports C99 VLAs in OpenMP for loops])
LALSUITE_PUSH_UVARS
CFLAGS="$OPENMP_CFLAGS"
AC_LINK_IFELSE([
AC_LANG_PROGRAM(, [
int i, n = 10;
#pragma omp parallel for
for (i = 0; i < 10; i ++)
{ int a@<:@n@:>@; }
])
],
[AC_MSG_RESULT([yes])],
[
AC_MSG_RESULT([no, disabling OpenMP])
OPENMP_CFLAGS=
]
)
LALSUITE_POP_UVARS
]
)
LALSUITE_ENABLE_OPENMP
# check for HEALPix
PKG_CHECK_MODULES([CHEALPIX],[chealpix],[true],[false])
......@@ -259,25 +234,6 @@ LALSUITE_USE_SWIG
# configure Doxygen documentation
LALSUITE_USE_DOXYGEN
# Disable OpenMP by default.
# FIXME: OpenMP should be on by default, but it breaks condor_compiling lalapps.
AS_IF(
[test "x$enable_openmp" = "x"],
[OPENMP_CFLAGS=]
)
# add compiler flags for OpenMP
AS_IF(
[test "x$OPENMP_CFLAGS" = "x"],
[
OPENMP_ENABLE_VAL="DISABLED"
LALSUITE_ADD_FLAGS([C],[-Wno-unknown-pragmas],[])
],
[
OPENMP_ENABLE_VAL="ENABLED"
LALSUITE_ADD_FLAGS([C],[${OPENMP_CFLAGS}],[])
]
)
# add gcc specific flags
LALSUITE_ADD_GCC_FLAGS
......
......@@ -124,32 +124,7 @@ AC_CHECK_HEADERS([unistd.h])
AC_CHECK_LIB([m],[main],,[AC_MSG_ERROR([could not find the math library])])
# check for OpenMP
AC_OPENMP
# check that compiler supports C99 variable length arrays in OpenMP for loops.
# Apple's llvm-gcc-4.2 is buggy and does not.
AS_IF([test "x$OPENMP_CFLAGS" != "x"],
[
AC_MSG_CHECKING([if compiler supports C99 VLAs in OpenMP for loops])
LALSUITE_PUSH_UVARS
CFLAGS="$OPENMP_CFLAGS"
AC_LINK_IFELSE([
AC_LANG_PROGRAM(, [
int i, n = 10;
#pragma omp parallel for
for (i = 0; i < 10; i ++)
{ int a@<:@n@:>@; }
])
],
[AC_MSG_RESULT([yes])],
[
AC_MSG_RESULT([no, disabling OpenMP])
OPENMP_CFLAGS=
]
)
LALSUITE_POP_UVARS
]
)
LALSUITE_ENABLE_OPENMP
# check for gsl
PKG_CHECK_MODULES([GSL],[gsl],[true],[false])
......@@ -209,25 +184,6 @@ LALSUITE_USE_SWIG
# configure Doxygen documentation
LALSUITE_USE_DOXYGEN
# Disable OpenMP by default.
# FIXME: OpenMP should be on by default, but it breaks condor_compiling lalapps.
AS_IF(
[test "x$enable_openmp" = "x"],
[OPENMP_CFLAGS=]
)
# add compiler flags for OpenMP
AS_IF(
[test "x$OPENMP_CFLAGS" = "x"],
[
OPENMP_ENABLE_VAL="DISABLED"
LALSUITE_ADD_FLAGS([C],[-Wno-unknown-pragmas],[])
],
[
OPENMP_ENABLE_VAL="ENABLED"
LALSUITE_ADD_FLAGS([C],[${OPENMP_CFLAGS}],[])
]
)
# add gcc specific flags
LALSUITE_ADD_GCC_FLAGS
......
......@@ -120,7 +120,7 @@ AC_DEFINE([HAVE_GETHOSTNAME_PROTOTYPE],[1],
AC_CHECK_LIB([m],[main],,[AC_MSG_ERROR([could not find the math library])])
# check for OpenMP
AC_OPENMP
LALSUITE_ENABLE_OPENMP
# check for gsl
PKG_CHECK_MODULES([GSL],[gsl],[true],[false])
......@@ -143,29 +143,6 @@ LALSUITE_USE_SWIG
# configure Doxygen documentation
LALSUITE_USE_DOXYGEN
# Disable OpenMP by default.
# FIXME: OpenMP should be on by default, but it breaks condor_compiling lalapps.
AS_IF(
[test "x$enable_openmp" = "x"],
[OPENMP_CFLAGS=]
)
# add compiler flags for OpenMP
AS_IF(
[test "x$OPENMP_CFLAGS" = "x"],
[
OPENMP_ENABLE_VAL="DISABLED"
LALSUITE_ADD_FLAGS([C],[-Wno-unknown-pragmas],[])
],
[
OPENMP_ENABLE_VAL="ENABLED"
LALSUITE_ADD_FLAGS([C],[${OPENMP_CFLAGS}],[])
]
)
# create Automake conditional so that we know whether we need to build
# OpenMP-specific tests
AM_CONDITIONAL([HAVE_OPENMP],[test "x$OPENMP_ENABLE_VAL" = "xENABLED"])
# add gcc specific flags
LALSUITE_ADD_GCC_FLAGS
......
......@@ -17,7 +17,7 @@ test_programs += XLALSimAddInjectionTest
test_programs += InitialSpinRotationTest
#test_programs += TestTaylorTFourier
#test_programs += SpinTaylorT4DynamicsTest
#if HAVE_OPENMP
#if OPENMP
#test_programs += OpenMPTest
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment