Skip to content

Commit

Permalink
Check for OpenMP version at configure time
Browse files Browse the repository at this point in the history
Only accept OpenMP >= 4.5, due to the "priority" clause that we use
since commit 6f6f5e7, and also document that in the INSTALL file.

If explicitly required with --enable-openmp, fail configuration if the
version is not available.

https://www.openmp.org/wp-content/uploads/openmp-4.5.pdf

Resolves: #1315
  • Loading branch information
dmnks authored and pmatilai committed Sep 2, 2020
1 parent 07293ea commit 6a780f1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
6 changes: 6 additions & 0 deletions INSTALL
Expand Up @@ -142,6 +142,12 @@ If you plan on using cryptographic signatures you will need a version
of GPG, available from
http://www.gnupg.org/

OpenMP multithreading support is automatically enabled if your C compiler has
support for OpenMP version 4.5 or higher (to disable, pass the --disable-openmp
option to configure). For GCC, OpenMP 4.5 is fully supported since GCC 6.1,
which is available from
http://www.gnu.org/

To compile RPM:
--------------

Expand Down
25 changes: 23 additions & 2 deletions configure.ac
Expand Up @@ -167,11 +167,32 @@ AC_SUBST(WITH_LZMA_LIB)

# AC_OPENMP supports --enable/disable-openmp out of the box, but it doesn't
# actually give us a way to conditionalize the build based on that. Argh.
# Version 4.5 (201511) introduced "priority" clause for tasks.
OPENMP_CFLAGS=
AC_OPENMP
AS_IF([test "x$ac_cv_prog_c_openmp" != x &&
test "x$ac_cv_prog_c_openmp" != unsupported],[
AC_DEFINE(ENABLE_OPENMP, 1, [Enable multithreading support?])
test "x$ac_cv_prog_c_openmp" != xunsupported],[
old_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $OPENMP_CFLAGS"
AC_MSG_CHECKING([OpenMP is at least version 4.5])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[#include <omp.h>],
[#if _OPENMP < 201511
exit(1);
#endif
]
)],
[AC_MSG_RESULT([yes])
AC_DEFINE(ENABLE_OPENMP, 1, [Enable multithreading support?])
],
[AC_MSG_RESULT([no])
if test "$enable_openmp" = "yes"; then
AC_MSG_ERROR([OpenMP too old])
fi
]
)
CFLAGS=$old_CFLAGS
])
AC_SUBST(OPENMP_CFLAGS)

Expand Down

0 comments on commit 6a780f1

Please sign in to comment.