mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 20:36:01 +01:00
Update ax_openmp.m4
This commit is contained in:
parent
85e7592a6a
commit
a5139dd66d
@ -1,5 +1,5 @@
|
|||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
# http://www.gnu.org/software/autoconf-archive/ax_openmp.html
|
# https://www.gnu.org/software/autoconf-archive/ax_openmp.html
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
#
|
#
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
@ -38,6 +38,8 @@
|
|||||||
# LICENSE
|
# LICENSE
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||||
|
# Copyright (c) 2015 John W. Peterson <jwpeterson@gmail.com>
|
||||||
|
# Copyright (c) 2016 Nick R. Papior <nickpapior@gmail.com>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License as published by the
|
# under the terms of the GNU General Public License as published by the
|
||||||
@ -50,7 +52,7 @@
|
|||||||
# Public License for more details.
|
# Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License along
|
# You should have received a copy of the GNU General Public License along
|
||||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
# with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||||
# gives unlimited permission to copy, distribute and modify the configure
|
# gives unlimited permission to copy, distribute and modify the configure
|
||||||
@ -65,16 +67,19 @@
|
|||||||
# modified version of the Autoconf Macro, you may extend this special
|
# modified version of the Autoconf Macro, you may extend this special
|
||||||
# exception to the GPL to apply to your modified version as well.
|
# exception to the GPL to apply to your modified version as well.
|
||||||
|
|
||||||
#serial 8
|
#serial 14
|
||||||
|
|
||||||
AC_DEFUN([AX_OPENMP], [
|
AC_DEFUN([AX_OPENMP], [
|
||||||
AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
|
AC_PREREQ([2.69]) dnl for _AC_LANG_PREFIX
|
||||||
|
|
||||||
AC_CACHE_CHECK([for OpenMP flag of _AC_LANG compiler], ax_cv_[]_AC_LANG_ABBREV[]_openmp, [save[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
|
AC_CACHE_CHECK([for OpenMP flag of _AC_LANG compiler], ax_cv_[]_AC_LANG_ABBREV[]_openmp, [save[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
|
||||||
ax_cv_[]_AC_LANG_ABBREV[]_openmp=unknown
|
ax_cv_[]_AC_LANG_ABBREV[]_openmp=unknown
|
||||||
# Flags to try: -fopenmp (gcc), -openmp (icc), -mp (SGI & PGI),
|
# Flags to try: -fopenmp (gcc), -mp (SGI & PGI),
|
||||||
# -xopenmp (Sun), -omp (Tru64), -qsmp=omp (AIX), none
|
# -qopenmp (icc>=15), -openmp (icc),
|
||||||
ax_openmp_flags="-fopenmp -openmp -mp -xopenmp -omp -qsmp=omp none"
|
# -xopenmp (Sun), -omp (Tru64),
|
||||||
|
# -qsmp=omp (AIX),
|
||||||
|
# none
|
||||||
|
ax_openmp_flags="-fopenmp -openmp -qopenmp -mp -xopenmp -omp -qsmp=omp none"
|
||||||
if test "x$OPENMP_[]_AC_LANG_PREFIX[]FLAGS" != x; then
|
if test "x$OPENMP_[]_AC_LANG_PREFIX[]FLAGS" != x; then
|
||||||
ax_openmp_flags="$OPENMP_[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flags"
|
ax_openmp_flags="$OPENMP_[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flags"
|
||||||
fi
|
fi
|
||||||
@ -83,8 +88,27 @@ for ax_openmp_flag in $ax_openmp_flags; do
|
|||||||
none) []_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[] ;;
|
none) []_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[] ;;
|
||||||
*) []_AC_LANG_PREFIX[]FLAGS="$save[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flag" ;;
|
*) []_AC_LANG_PREFIX[]FLAGS="$save[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flag" ;;
|
||||||
esac
|
esac
|
||||||
AC_TRY_LINK_FUNC(omp_set_num_threads,
|
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
||||||
[ax_cv_[]_AC_LANG_ABBREV[]_openmp=$ax_openmp_flag; break])
|
@%:@include <omp.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
parallel_fill(int * data, int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
@%:@pragma omp parallel for
|
||||||
|
for (i = 0; i < n; ++i)
|
||||||
|
data[i] = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
int arr[100000];
|
||||||
|
omp_set_num_threads(2);
|
||||||
|
parallel_fill(arr, 100000);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
]])],[ax_cv_[]_AC_LANG_ABBREV[]_openmp=$ax_openmp_flag; break],[])
|
||||||
done
|
done
|
||||||
[]_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[]FLAGS
|
[]_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[]FLAGS
|
||||||
])
|
])
|
||||||
@ -97,3 +121,4 @@ else
|
|||||||
m4_default([$1], [AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])])
|
m4_default([$1], [AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])])
|
||||||
fi
|
fi
|
||||||
])dnl AX_OPENMP
|
])dnl AX_OPENMP
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user