mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-17 03:12:15 +00:00
New AX_OPENACC macro and supporting flags
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
# AC_OPENACC
|
||||
# ---------
|
||||
# Check which options need to be passed to the C compiler to support Openacc.
|
||||
# Set the OPENACC_CFLAGS / OPENACC_CXXFLAGS / OPENACC_FFLAGS variable to these
|
||||
# options.
|
||||
# The options are necessary at compile time (so the #pragmas are understood)
|
||||
# and at link time (so the appropriate library is linked with).
|
||||
# This macro takes care to not produce redundant options if $CC $CFLAGS already
|
||||
# supports Openacc.
|
||||
#
|
||||
# For each candidate option, we do a compile test first, then a link test;
|
||||
# if the compile test succeeds but the link test fails, that means we have
|
||||
# found the correct option but it doesn't work because the libraries are
|
||||
# broken. (This can happen, for instance, with SunPRO C and a bad combination
|
||||
# of operating system patches.)
|
||||
#
|
||||
# Several of the options in our candidate list can be misinterpreted by
|
||||
# compilers that don't use them to activate Openacc support; for example,
|
||||
# many compilers understand "-openacc" to mean "write output to a file
|
||||
# named 'penmp'" rather than "enable Openacc". We can't completely avoid
|
||||
# the possibility of clobbering files named 'penmp' or 'mp' in configure's
|
||||
# working directory; therefore, this macro will bomb out if any such file
|
||||
# already exists when it's invoked.
|
||||
AC_DEFUN([AX_C_OPENACC],
|
||||
[AC_REQUIRE([_AX_OPENACC_SAFE_WD])]dnl
|
||||
[AC_ARG_ENABLE([openacc],
|
||||
[AS_HELP_STRING([--disable-openacc], [do not use Openacc])])]dnl
|
||||
[
|
||||
OPENACC_[]_AC_LANG_PREFIX[]FLAGS=
|
||||
if test "$enable_openacc" != no; then
|
||||
AC_LANG_PUSH([C])
|
||||
AC_CACHE_CHECK([for $[]_AC_CC[] option to support Openacc],
|
||||
[ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc],
|
||||
[ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc='not found'
|
||||
dnl Try these flags:
|
||||
dnl (on by default) ''
|
||||
dnl GCC >= 4.2 -fopenacc
|
||||
dnl SunPRO C -xopenacc
|
||||
dnl Intel C -openacc
|
||||
dnl SGI C, PGI C -mp
|
||||
dnl Tru64 Compaq C -omp
|
||||
dnl IBM XL C (AIX, Linux) -qsmp=omp
|
||||
dnl Cray CCE -homp
|
||||
dnl NEC SX -Popenacc
|
||||
dnl Lahey Fortran (Linux) --openacc
|
||||
for ac_option in '' -fopenacc -openacc -acc; do
|
||||
|
||||
ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $ac_option"
|
||||
AC_COMPILE_IFELSE([
|
||||
#ifndef _OPENACC
|
||||
#error "OpenACC not supported"
|
||||
#endif
|
||||
#include <openacc.h>
|
||||
int main (void) { acc_init (0); return 0;}
|
||||
],
|
||||
[AC_LINK_IFELSE([
|
||||
#ifndef _OPENACC
|
||||
#error "OpenACC not supported"
|
||||
#endif
|
||||
#include <openacc.h>
|
||||
int main (void) { acc_init (0); return 0;}
|
||||
],
|
||||
[ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc=$ac_option],
|
||||
[ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc='unsupported'])])
|
||||
_AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS
|
||||
|
||||
if test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" != 'not found'; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" = 'not found'; then
|
||||
ac_cv_prog_[]_AC_LANG_ABBREV[]_openacc='unsupported'
|
||||
elif test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" = ''; then
|
||||
ac_cv_prog_[]_AC_LANG_ABBREV[]_openacc='none needed'
|
||||
fi
|
||||
dnl _AX_OPENACC_SAFE_WD checked that these files did not exist before we
|
||||
dnl started probing for Openacc support, so if they exist now, they were
|
||||
dnl created by the probe loop and it's safe to delete them.
|
||||
rm -f penmp mp])
|
||||
if test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" != 'unsupported' && \
|
||||
test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" != 'none needed'; then
|
||||
OPENACC_[]_AC_LANG_PREFIX[]FLAGS="$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc"
|
||||
fi
|
||||
AC_LANG_POP([C])
|
||||
fi
|
||||
])
|
||||
|
||||
# _AC_OPENACC_SAFE_WD
|
||||
# ------------------
|
||||
# AC_REQUIREd by AC_OPENACC. Checks both at autoconf time and at
|
||||
# configure time for files that AC_OPENACC clobbers.
|
||||
AC_DEFUN([_AX_OPENACC_SAFE_WD],
|
||||
[m4_syscmd([test ! -e penmp && test ! -e mp])]dnl
|
||||
[m4_if(sysval, [0], [], [m4_fatal(m4_normalize(
|
||||
[AX_OPENACC clobbers files named 'mp' and 'penmp'.
|
||||
To use AX_OPENACC you must not have either of these files
|
||||
at the top level of your source tree.]))])]dnl
|
||||
[if test -e penmp || test -e mp; then
|
||||
AC_MSG_ERROR(m4_normalize(
|
||||
[AX@&t@_OPENACC clobbers files named 'mp' and 'penmp'.
|
||||
Aborting configure because one of these files already exists.]))
|
||||
fi])
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
# AC_OPENACC
|
||||
# ---------
|
||||
# Check which options need to be passed to the C compiler to support Openacc.
|
||||
# Set the OPENACC_CFLAGS / OPENACC_CXXFLAGS / OPENACC_FFLAGS variable to these
|
||||
# options.
|
||||
# The options are necessary at compile time (so the #pragmas are understood)
|
||||
# and at link time (so the appropriate library is linked with).
|
||||
# This macro takes care to not produce redundant options if $CC $CFLAGS already
|
||||
# supports Openacc.
|
||||
#
|
||||
# For each candidate option, we do a compile test first, then a link test;
|
||||
# if the compile test succeeds but the link test fails, that means we have
|
||||
# found the correct option but it doesn't work because the libraries are
|
||||
# broken. (This can happen, for instance, with SunPRO C and a bad combination
|
||||
# of operating system patches.)
|
||||
#
|
||||
# Several of the options in our candidate list can be misinterpreted by
|
||||
# compilers that don't use them to activate Openacc support; for example,
|
||||
# many compilers understand "-openacc" to mean "write output to a file
|
||||
# named 'penmp'" rather than "enable Openacc". We can't completely avoid
|
||||
# the possibility of clobbering files named 'penmp' or 'mp' in configure's
|
||||
# working directory; therefore, this macro will bomb out if any such file
|
||||
# already exists when it's invoked.
|
||||
AC_DEFUN([AX_CXX_OPENACC],
|
||||
[AC_REQUIRE([_AX_OPENACC_SAFE_WD])]dnl
|
||||
[AC_ARG_ENABLE([openacc],
|
||||
[AS_HELP_STRING([--disable-openacc], [do not use Openacc])])]dnl
|
||||
[
|
||||
OPENACC_[]_AC_LANG_PREFIX[]FLAGS=
|
||||
if test "$enable_openacc" != no; then
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_CACHE_CHECK([for $[]_AC_CC[] option to support Openacc],
|
||||
[ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc],
|
||||
[ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc='not found'
|
||||
dnl Try these flags:
|
||||
dnl (on by default) ''
|
||||
dnl GCC >= 4.2 -fopenacc
|
||||
dnl SunPRO C -xopenacc
|
||||
dnl Intel C -openacc
|
||||
dnl SGI C, PGI C -mp
|
||||
dnl Tru64 Compaq C -omp
|
||||
dnl IBM XL C (AIX, Linux) -qsmp=omp
|
||||
dnl Cray CCE -homp
|
||||
dnl NEC SX -Popenacc
|
||||
dnl Lahey Fortran (Linux) --openacc
|
||||
for ac_option in '' -fopenacc -openacc -acc; do
|
||||
|
||||
ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $ac_option"
|
||||
AC_COMPILE_IFELSE([
|
||||
#ifndef _OPENACC
|
||||
#error "OpenACC not supported"
|
||||
#endif
|
||||
#include <openacc.h>
|
||||
int main (void) { acc_init (acc_get_device_type()); return 0;}
|
||||
],
|
||||
[AC_LINK_IFELSE([
|
||||
#ifndef _OPENACC
|
||||
#error "OpenACC not supported"
|
||||
#endif
|
||||
#include <openacc.h>
|
||||
int main (void) { acc_init (acc_get_device_type()); return 0;}
|
||||
],
|
||||
[ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc=$ac_option],
|
||||
[ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc='unsupported'])])
|
||||
_AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS
|
||||
|
||||
if test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" != 'not found'; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" = 'not found'; then
|
||||
ac_cv_prog_[]_AC_LANG_ABBREV[]_openacc='unsupported'
|
||||
elif test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" = ''; then
|
||||
ac_cv_prog_[]_AC_LANG_ABBREV[]_openacc='none needed'
|
||||
fi
|
||||
dnl _AX_OPENACC_SAFE_WD checked that these files did not exist before we
|
||||
dnl started probing for Openacc support, so if they exist now, they were
|
||||
dnl created by the probe loop and it's safe to delete them.
|
||||
rm -f penmp mp])
|
||||
if test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" != 'unsupported' && \
|
||||
test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" != 'none needed'; then
|
||||
OPENACC_[]_AC_LANG_PREFIX[]FLAGS="$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc"
|
||||
fi
|
||||
AC_LANG_POP([C++])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl _AC_OPENACC_SAFE_WD
|
||||
dnl ------------------
|
||||
dnl AC_REQUIREd by AC_OPENACC. Checks both at autoconf time and at
|
||||
dnl configure time for files that AC_OPENACC clobbers.
|
||||
dnl AC_DEFUN([_AX_OPENACC_SAFE_WD],
|
||||
dnl [m4_syscmd([test ! -e penmp && test ! -e mp])]dnl
|
||||
dnl [m4_if(sysval, [0], [], [m4_fatal(m4_normalize(
|
||||
dnl [AX_OPENACC clobbers files named 'mp' and 'penmp'.
|
||||
dnl To use AX_OPENACC you must not have either of these files
|
||||
dnl at the top level of your source tree.]))])]dnl
|
||||
dnl [if test -e penmp || test -e mp; then
|
||||
dnl AC_MSG_ERROR(m4_normalize(
|
||||
dnl [AX@&t@_OPENACC clobbers files named 'mp' and 'penmp'.
|
||||
dnl Aborting configure because one of these files already exists.]))
|
||||
dnl fi])
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
# AC_OPENACC
|
||||
# ---------
|
||||
# Check which options need to be passed to the C compiler to support Openacc.
|
||||
# Set the OPENACC_CFLAGS / OPENACC_CXXFLAGS / OPENACC_FFLAGS variable to these
|
||||
# options.
|
||||
# The options are necessary at compile time (so the #pragmas are understood)
|
||||
# and at link time (so the appropriate library is linked with).
|
||||
# This macro takes care to not produce redundant options if $CC $CFLAGS already
|
||||
# supports Openacc.
|
||||
#
|
||||
# For each candidate option, we do a compile test first, then a link test;
|
||||
# if the compile test succeeds but the link test fails, that means we have
|
||||
# found the correct option but it doesn't work because the libraries are
|
||||
# broken. (This can happen, for instance, with SunPRO C and a bad combination
|
||||
# of operating system patches.)
|
||||
#
|
||||
# Several of the options in our candidate list can be misinterpreted by
|
||||
# compilers that don't use them to activate Openacc support; for example,
|
||||
# many compilers understand "-openacc" to mean "write output to a file
|
||||
# named 'penmp'" rather than "enable Openacc". We can't completely avoid
|
||||
# the possibility of clobbering files named 'penmp' or 'mp' in configure's
|
||||
# working directory; therefore, this macro will bomb out if any such file
|
||||
# already exists when it's invoked.
|
||||
AC_DEFUN([AX_FC_OPENACC],
|
||||
[AC_REQUIRE([_AX_OPENACC_SAFE_WD])]dnl
|
||||
[AC_ARG_ENABLE([openacc],
|
||||
[AS_HELP_STRING([--disable-openacc], [do not use Openacc])])]dnl
|
||||
[
|
||||
OPENACC_[]_AC_LANG_PREFIX[]FLAGS=
|
||||
if test "$enable_openacc" != no; then
|
||||
AC_LANG_PUSH([Fortran])
|
||||
AC_CACHE_CHECK([for $[]_AC_CC[] option to support Openacc],
|
||||
[ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc],
|
||||
[ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc='not found'
|
||||
dnl Try these flags:
|
||||
dnl (on by default) ''
|
||||
dnl GCC >= 4.2 -fopenacc
|
||||
dnl SunPRO C -xopenacc
|
||||
dnl Intel C -openacc
|
||||
dnl SGI C, PGI C -mp
|
||||
dnl Tru64 Compaq C -omp
|
||||
dnl IBM XL C (AIX, Linux) -qsmp=omp
|
||||
dnl Cray CCE -homp
|
||||
dnl NEC SX -Popenacc
|
||||
dnl Lahey Fortran (Linux) --openacc
|
||||
for ac_option in '' -fopenacc -openacc -acc; do
|
||||
|
||||
ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $ac_option"
|
||||
AC_COMPILE_IFELSE([
|
||||
program main
|
||||
use openacc
|
||||
implicit none
|
||||
integer tid, np
|
||||
tid = 42
|
||||
call acc_init(0)
|
||||
end
|
||||
],
|
||||
[AC_LINK_IFELSE([
|
||||
program main
|
||||
use openacc
|
||||
implicit none
|
||||
integer tid, np
|
||||
tid = 42
|
||||
call acc_init(0)
|
||||
end
|
||||
],
|
||||
[ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc=$ac_option],
|
||||
[ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc='unsupported'])])
|
||||
_AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS
|
||||
|
||||
if test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" != 'unsupported'; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" = 'not found'; then
|
||||
ac_cv_prog_[]_AC_LANG_ABBREV[]_openacc='unsupported'
|
||||
elif test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" = ''; then
|
||||
ac_cv_prog_[]_AC_LANG_ABBREV[]_openacc='none needed'
|
||||
fi
|
||||
dnl _AX_OPENACC_SAFE_WD checked that these files did not exist before we
|
||||
dnl started probing for Openacc support, so if they exist now, they were
|
||||
dnl created by the probe loop and it's safe to delete them.
|
||||
rm -f penmp mp])
|
||||
if test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" != 'unsupported' && \
|
||||
test "$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc" != 'none needed'; then
|
||||
OPENACC_[]_AC_LANG_PREFIX[]FLAGS="$ax_cv_prog_[]_AC_LANG_ABBREV[]_openacc"
|
||||
fi
|
||||
AC_LANG_POP([Fortran])
|
||||
fi
|
||||
])
|
||||
|
||||
# _AC_OPENACC_SAFE_WD
|
||||
# ------------------
|
||||
# AC_REQUIREd by AC_OPENACC. Checks both at autoconf time and at
|
||||
# configure time for files that AC_OPENACC clobbers.
|
||||
AC_DEFUN([_AX_OPENACC_SAFE_WD],
|
||||
[m4_syscmd([test ! -e penmp && test ! -e mp])]dnl
|
||||
[m4_if(sysval, [0], [], [m4_fatal(m4_normalize(
|
||||
[AX_OPENACC clobbers files named 'mp' and 'penmp'.
|
||||
To use AX_OPENACC you must not have either of these files
|
||||
at the top level of your source tree.]))])]dnl
|
||||
[if test -e penmp || test -e mp; then
|
||||
AC_MSG_ERROR(m4_normalize(
|
||||
[AX@&t@_OPENACC clobbers files named 'mp' and 'penmp'.
|
||||
Aborting configure because one of these files already exists.]))
|
||||
fi])
|
||||
|
||||
@@ -852,6 +852,7 @@ with_amdlibdir
|
||||
with_cuda
|
||||
with_cudacc
|
||||
enable_openacc
|
||||
with_extraopenacc
|
||||
with_ccopenacc
|
||||
with_cxxopenacc
|
||||
with_fcopenacc
|
||||
@@ -1506,6 +1507,7 @@ Optional Features:
|
||||
--enable-openmp Specify whether to enable openmp.
|
||||
--disable-openmp do not use OpenMP
|
||||
--enable-openacc Specify whether to enable openacc.
|
||||
--disable-openacc do not use Openacc
|
||||
|
||||
Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
@@ -1551,6 +1553,8 @@ Optional Packages:
|
||||
--with-cuda=DIR Specify the CUDA install directory.
|
||||
--with-cudacc A comma-separated list of CCs to compile to, for
|
||||
example, --with-cudacc=50,60,70,75
|
||||
--with-extraopenacc additional [EXTRAOPENACC] flags to be added: will
|
||||
prepend to [EXTRAOPENACC]
|
||||
--with-ccopenacc additional [CCOPENACC] flags to be added: will
|
||||
prepend to [CCOPENACC]
|
||||
--with-cxxopenacc additional [CXXOPENACC] flags to be added: will
|
||||
@@ -10925,6 +10929,284 @@ fi
|
||||
|
||||
if test x"$pac_cv_openacc" == x"yes" ; then
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether additional EXTRAOPENACC flags should be added (should be invoked only once)" >&5
|
||||
printf %s "checking whether additional EXTRAOPENACC flags should be added (should be invoked only once)... " >&6; }
|
||||
|
||||
# Check whether --with-extraopenacc was given.
|
||||
if test ${with_extraopenacc+y}
|
||||
then :
|
||||
withval=$with_extraopenacc;
|
||||
EXTRAOPENACC="${withval} ${EXTRAOPENACC}"
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: EXTRAOPENACC = ${EXTRAOPENACC}" >&5
|
||||
printf "%s\n" "EXTRAOPENACC = ${EXTRAOPENACC}" >&6; }
|
||||
|
||||
else $as_nop
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if test -e penmp || test -e mp; then
|
||||
as_fn_error $? "AX_OPENACC clobbers files named 'mp' and 'penmp'. Aborting configure because one of these files already exists." "$LINENO" 5
|
||||
fi
|
||||
# Check whether --enable-openacc was given.
|
||||
if test ${enable_openacc+y}
|
||||
then :
|
||||
enableval=$enable_openacc;
|
||||
fi
|
||||
|
||||
OPENACC_CFLAGS=
|
||||
if test "$enable_openacc" != no; then
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to support Openacc" >&5
|
||||
printf %s "checking for $CC option to support Openacc... " >&6; }
|
||||
if test ${ax_cv_prog_c_openacc+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
ax_cv_prog_c_openacc='not found'
|
||||
for ac_option in '' -fopenacc -openacc -acc; do
|
||||
|
||||
ac_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS $ac_option"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#ifndef _OPENACC
|
||||
#error "OpenACC not supported"
|
||||
#endif
|
||||
#include <openacc.h>
|
||||
int main (void) { acc_init (0); return 0;}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
then :
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#ifndef _OPENACC
|
||||
#error "OpenACC not supported"
|
||||
#endif
|
||||
#include <openacc.h>
|
||||
int main (void) { acc_init (0); return 0;}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
ax_cv_prog_c_openacc=$ac_option
|
||||
else $as_nop
|
||||
ax_cv_prog_c_openacc='unsupported'
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
CFLAGS=$ac_save_CFLAGS
|
||||
|
||||
if test "$ax_cv_prog_c_openacc" != 'not found'; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test "$ax_cv_prog_c_openacc" = 'not found'; then
|
||||
ac_cv_prog_c_openacc='unsupported'
|
||||
elif test "$ax_cv_prog_c_openacc" = ''; then
|
||||
ac_cv_prog_c_openacc='none needed'
|
||||
fi
|
||||
rm -f penmp mp
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_prog_c_openacc" >&5
|
||||
printf "%s\n" "$ax_cv_prog_c_openacc" >&6; }
|
||||
if test "$ax_cv_prog_c_openacc" != 'unsupported' && \
|
||||
test "$ax_cv_prog_c_openacc" != 'none needed'; then
|
||||
OPENACC_CFLAGS="$ax_cv_prog_c_openacc"
|
||||
fi
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
fi
|
||||
|
||||
CCOPENACC="$ax_cv_prog_c_openacc";
|
||||
# Check whether --enable-openacc was given.
|
||||
if test ${enable_openacc+y}
|
||||
then :
|
||||
enableval=$enable_openacc;
|
||||
fi
|
||||
|
||||
OPENACC_CFLAGS=
|
||||
if test "$enable_openacc" != no; then
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to support Openacc" >&5
|
||||
printf %s "checking for $CXX option to support Openacc... " >&6; }
|
||||
if test ${ax_cv_prog_cxx_openacc+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
ax_cv_prog_cxx_openacc='not found'
|
||||
for ac_option in '' -fopenacc -openacc -acc; do
|
||||
|
||||
ac_save_CXXFLAGS=$CXXFLAGS
|
||||
CXXFLAGS="$CXXFLAGS $ac_option"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#ifndef _OPENACC
|
||||
#error "OpenACC not supported"
|
||||
#endif
|
||||
#include <openacc.h>
|
||||
int main (void) { acc_init (acc_get_device_type()); return 0;}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_cxx_try_compile "$LINENO"
|
||||
then :
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#ifndef _OPENACC
|
||||
#error "OpenACC not supported"
|
||||
#endif
|
||||
#include <openacc.h>
|
||||
int main (void) { acc_init (acc_get_device_type()); return 0;}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_cxx_try_link "$LINENO"
|
||||
then :
|
||||
ax_cv_prog_cxx_openacc=$ac_option
|
||||
else $as_nop
|
||||
ax_cv_prog_cxx_openacc='unsupported'
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
CXXFLAGS=$ac_save_CXXFLAGS
|
||||
|
||||
if test "$ax_cv_prog_cxx_openacc" != 'not found'; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test "$ax_cv_prog_cxx_openacc" = 'not found'; then
|
||||
ac_cv_prog_cxx_openacc='unsupported'
|
||||
elif test "$ax_cv_prog_cxx_openacc" = ''; then
|
||||
ac_cv_prog_cxx_openacc='none needed'
|
||||
fi
|
||||
rm -f penmp mp
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_prog_cxx_openacc" >&5
|
||||
printf "%s\n" "$ax_cv_prog_cxx_openacc" >&6; }
|
||||
if test "$ax_cv_prog_cxx_openacc" != 'unsupported' && \
|
||||
test "$ax_cv_prog_cxx_openacc" != 'none needed'; then
|
||||
OPENACC_CXXFLAGS="$ax_cv_prog_cxx_openacc"
|
||||
fi
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
fi
|
||||
|
||||
CXXOPENACC="$ax_cv_prog_cxx_openacc";
|
||||
# Check whether --enable-openacc was given.
|
||||
if test ${enable_openacc+y}
|
||||
then :
|
||||
enableval=$enable_openacc;
|
||||
fi
|
||||
|
||||
OPENACC_CFLAGS=
|
||||
if test "$enable_openacc" != no; then
|
||||
ac_ext=${ac_fc_srcext-f}
|
||||
ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
|
||||
ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_fc_compiler_gnu
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $FC option to support Openacc" >&5
|
||||
printf %s "checking for $FC option to support Openacc... " >&6; }
|
||||
if test ${ax_cv_prog_fc_openacc+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
ax_cv_prog_fc_openacc='not found'
|
||||
for ac_option in '' -fopenacc -openacc -acc; do
|
||||
|
||||
ac_save_FCFLAGS=$FCFLAGS
|
||||
FCFLAGS="$FCFLAGS $ac_option"
|
||||
cat > conftest.$ac_ext <<_ACEOF
|
||||
|
||||
program main
|
||||
use openacc
|
||||
implicit none
|
||||
integer tid, np
|
||||
tid = 42
|
||||
call acc_init(0)
|
||||
end
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_fc_try_compile "$LINENO"
|
||||
then :
|
||||
cat > conftest.$ac_ext <<_ACEOF
|
||||
|
||||
program main
|
||||
use openacc
|
||||
implicit none
|
||||
integer tid, np
|
||||
tid = 42
|
||||
call acc_init(0)
|
||||
end
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_fc_try_link "$LINENO"
|
||||
then :
|
||||
ax_cv_prog_fc_openacc=$ac_option
|
||||
else $as_nop
|
||||
ax_cv_prog_fc_openacc='unsupported'
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
FCFLAGS=$ac_save_FCFLAGS
|
||||
|
||||
if test "$ax_cv_prog_fc_openacc" != 'unsupported'; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test "$ax_cv_prog_fc_openacc" = 'not found'; then
|
||||
ac_cv_prog_fc_openacc='unsupported'
|
||||
elif test "$ax_cv_prog_fc_openacc" = ''; then
|
||||
ac_cv_prog_fc_openacc='none needed'
|
||||
fi
|
||||
rm -f penmp mp
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_prog_fc_openacc" >&5
|
||||
printf "%s\n" "$ax_cv_prog_fc_openacc" >&6; }
|
||||
if test "$ax_cv_prog_fc_openacc" != 'unsupported' && \
|
||||
test "$ax_cv_prog_fc_openacc" != 'none needed'; then
|
||||
OPENACC_FCFLAGS="$ax_cv_prog_fc_openacc"
|
||||
fi
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
fi
|
||||
|
||||
FCOPENACC="$ax_cv_prog_fc_openacc";
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether additional CCOPENACC flags should be added (should be invoked only once)" >&5
|
||||
printf %s "checking whether additional CCOPENACC flags should be added (should be invoked only once)... " >&6; }
|
||||
|
||||
@@ -10981,7 +11263,9 @@ printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
|
||||
CCOPENACC="$CCOPENACC $EXTRAOPENACC";
|
||||
CXXOPENACC="$CXXOPENACC $EXTRAOPENACC";
|
||||
FCOPENACC="$FCOPENACC $EXTRAOPENACC";
|
||||
OACCD=oaccd;
|
||||
OACCLD=oaccld;
|
||||
|
||||
|
||||
+29
-3
@@ -845,11 +845,35 @@ if test "x$pac_cv_ipk_size" != "x4"; then
|
||||
fi
|
||||
|
||||
PAC_ARG_OPENACC()
|
||||
dnl AC_ARG_ENABLE([openacc],
|
||||
dnl [AS_HELP_STRING([--disable-openacc], [do not use Openacc])])
|
||||
if test x"$pac_cv_openacc" == x"yes" ; then
|
||||
PAC_ARG_WITH_FLAGS(ccopenacc,CCOPENACC)
|
||||
PAC_ARG_WITH_FLAGS(extraopenacc,EXTRAOPENACC)
|
||||
dnl if test false; then
|
||||
AX_C_OPENACC()
|
||||
CCOPENACC="$ax_cv_prog_c_openacc";
|
||||
AX_CXX_OPENACC()
|
||||
CXXOPENACC="$ax_cv_prog_cxx_openacc";
|
||||
AX_FC_OPENACC()
|
||||
FCOPENACC="$ax_cv_prog_fc_openacc";
|
||||
dnl AX_OPENACC()
|
||||
dnl
|
||||
dnl CXXOPENACC="$ax_cv_prog_cxx_openacc";
|
||||
dnl FCOPENACC="$ax_cv_prog_fc_openacc";
|
||||
dnl else
|
||||
dnl AC_MSG_NOTICE([OpenACC 1 flags CC $CCOPENACC CXX $CXXOPENACC FC $FCOPENACC])
|
||||
PAC_ARG_WITH_FLAGS(ccopenacc,CCOPENACC)
|
||||
PAC_ARG_WITH_FLAGS(cxxopenacc,CXXOPENACC)
|
||||
PAC_ARG_WITH_FLAGS(fcopenacc,FCOPENACC)
|
||||
|
||||
dnl AC_MSG_NOTICE([OpenACC 2 flags CC $CCOPENACC CXX $CXXOPENACC FC $FCOPENACC])
|
||||
dnl CCOPENACC="$ax_cv_prog_c_openacc";
|
||||
dnl CXXOPENACC="$ax_cv_prog_cxx_openacc";
|
||||
dnl FCOPENACC="$ax_cv_prog_fc_openacc";
|
||||
dnl fi
|
||||
CCOPENACC="$CCOPENACC $EXTRAOPENACC";
|
||||
CXXOPENACC="$CXXOPENACC $EXTRAOPENACC";
|
||||
FCOPENACC="$FCOPENACC $EXTRAOPENACC";
|
||||
dnl AC_MSG_NOTICE([OpenACC 3 flags CC $CCOPENACC CXX $CXXOPENACC FC $FCOPENACC])
|
||||
OACCD=oaccd;
|
||||
OACCLD=oaccld;
|
||||
|
||||
@@ -1025,7 +1049,9 @@ AC_MSG_NOTICE([
|
||||
|
||||
OPENACC : ${pac_cv_openacc}
|
||||
FCOPENACC : ${FCOPENACC}
|
||||
|
||||
OACCD : ${OACCD}
|
||||
OACCLD : ${OACCLD}
|
||||
|
||||
BLAS : ${BLAS_LIBS}
|
||||
|
||||
METIS usable : ${psblas_cv_have_metis}
|
||||
|
||||
@@ -17,14 +17,17 @@ FINCLUDES=$(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR) $(FMFLAG). $(FMFLAG)$(PSBMODDIR)
|
||||
FFLAGS=-O0 -march=native -fopenacc -foffload=nvptx-none="-march=sm_70"
|
||||
CFLAGS=-O0 -march=native
|
||||
|
||||
SRCS=vectoacc.F90 datavect.F90
|
||||
VTC=vectoacc.o
|
||||
DVT=datavect.o
|
||||
CSRC=timers.c
|
||||
|
||||
OBJS=$(SRCS:.F90=.o) $(CSRC:.c=.o)
|
||||
|
||||
all: dir $(OBJS)
|
||||
$(FC) $(FFLAGS) $(OBJS) -o datavect $(FINCLUDES) $(PSBLAS_LIB) $(LDLIBS)
|
||||
/bin/mv datavect $(EXEDIR)
|
||||
all: dir psb_d_oacc_pde3d
|
||||
|
||||
#$(OBJS)
|
||||
# $(FC) $(FFLAGS) $(OBJS) -o datavect $(FINCLUDES) $(PSBLAS_LIB) $(LDLIBS)
|
||||
# /bin/mv datavect $(EXEDIR)
|
||||
|
||||
dir:
|
||||
@if test ! -d $(EXEDIR); then mkdir $(EXEDIR); fi
|
||||
|
||||
@@ -733,7 +733,8 @@ program psb_d_oacc_pde3d
|
||||
end if
|
||||
|
||||
! get parameters
|
||||
call get_parms(ctxt, kmethd, ptype, afmt, agfmt, idim, istopc, itmax, itrace, irst, ipart, parms)
|
||||
call get_parms(ctxt, kmethd, ptype, afmt, agfmt, idim, istopc,&
|
||||
& itmax, itrace, irst, ipart, parms)
|
||||
|
||||
! allocate and fill in the coefficient matrix, rhs and initial guess
|
||||
call psb_barrier(ctxt)
|
||||
|
||||
Reference in New Issue
Block a user