Permalink
Browse files

Merge branch 'master' into c++14

  • Loading branch information...
evaleev committed Apr 12, 2017
2 parents 229f7e2 + 9f542e4 commit f30837a9ea1e2134f9e1fb8e01572a00cf067ba1
View
@@ -102,7 +102,7 @@
/* Define to the equivalent of the C99 'restrict' keyword, or to
nothing if this is not supported. Do not define if restrict is
supported directly. */
#define restrict @RESTRICT_KEYWORD@
#define MADNESS_RESTRICT @RESTRICT_KEYWORD@
/* Work around a bug in Sun C++: it does not support _Restrict or
__restrict__, even though the corresponding Sun C compiler ends up with
"#define restrict _Restrict" or "#define restrict __restrict__" in the
View
@@ -0,0 +1,36 @@
dnl @synopsis ACX_CXX_RESTRICT
dnl
dnl This macro determines whether the C++ compiler supports the
dnl "restrict" keyword introduced in C99, or an equivalent. Does
dnl nothing if the compiler accepts the keyword. Otherwise, if the
dnl compiler supports an equivalent (like GCC's __restrict__) defines
dnl "restrict" to be that. Otherwise, defines "restrict" to be empty.
dnl
dnl @category Obsolete
dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
dnl @version 2005-05-31
dnl @license GPLWithACException
AC_DEFUN([ACX_CXX_RESTRICT],
[AC_CACHE_CHECK([for C++ restrict keyword], acx_cv_cxx_restrict,
[acx_cv_cxx_restrict=unsupported
AC_LANG_SAVE
AC_LANG_PUSH([C++])
# Try the official restrict keyword, then gcc's __restrict__, then
# SGI's __restrict. __restrict has slightly different semantics than
# restrict (it's a bit stronger, in that __restrict pointers can't
# overlap even with non __restrict pointers), but I think it should be
# okay under the circumstances where restrict is normally used.
for acx_kw in restrict __restrict__ __restrict; do
AC_TRY_COMPILE([], [float * $acx_kw x;], [acx_cv_cxx_restrict=$acx_kw; break])
done
AC_LANG_RESTORE
])
if test "$acx_cv_cxx_restrict" != "restrict"; then
acx_kw="$acx_cv_cxx_restrict"
if test "$acx_kw" = unsupported; then acx_kw=""; fi
AC_DEFINE_UNQUOTED(MADNESS_RESTRICT, $acx_kw, [Define to equivalent of C99 restrict keyword, or to nothing if this is not supported. Do not define if restrict is supported directly.])
fi
AC_MSG_RESULT([$acx_cv_cxx_restrict])
AC_LANG_POP
])
@@ -82,7 +82,7 @@ AC_DEFUN([ACX_ENABLE_OPTIMAL], [
;;
Portland)
acx_enable_optimal_flags="$acx_enable_optimal_flags -fastsse -Mflushz -Mcache_align -Drestrict=__restrict"
acx_enable_optimal_flags="$acx_enable_optimal_flags -fastsse -Mflushz -Mcache_align"
AC_MSG_NOTICE([Appending -pgf90libs to LIBS so can link against Fortran BLAS/linalg])
LIBS="$LIBS -pgf90libs"
if test "x$HAVE_CRAYXT" = xyes; then
View
@@ -124,6 +124,9 @@ ACX_DETECT_CXX
# add the -std=c++14 or -std=c++1y flag to CXXFLAGS if necessary.
AX_CXX_COMPILE_STDCXX(14,[noext],[mandatory])
# Detect which version of (__)restrict(__) is supported and define MADNESS_RESTRICT to it
ACX_CXX_RESTRICT
# Set debugging
ACX_ENABLE_DEBUGGING
@@ -133,7 +136,7 @@ ACX_ENABLE_OPTIMIZATION
# Set warning flags by compiler vendor
ACX_ENABLE_WARN
# Selelect best compilation flags
# Select best compilation flags
ACX_ENABLE_OPTIMAL
# Get optional external libraries inplace so that building will partially check them
@@ -192,7 +195,6 @@ CPPFLAGS="$ac_save_CPPFLAGS"
# Types
AC_TYPE_PID_T
AC_C_RESTRICT
ACX_CHECK_TLS
AC_TYPE_SIZE_T
#AC_TYPE_UINT64_T
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
@@ -105,7 +105,7 @@ namespace madness {
if (world.rank()==0) printf("timer: %20.20s %8.2fs %8.2fs\n", msg, cpu, wall);
}
extern void drot(long n, double* restrict a, double* restrict b, double s, double c, long inc);
extern void drot(long n, double* MADNESS_RESTRICT a, double* MADNESS_RESTRICT b, double s, double c, long inc);
/// Given overlap matrix, return rotation with 3rd order error to orthonormalize the vectors
@@ -124,7 +124,7 @@ namespace madness {
void drot3(long n, double* restrict a, double* restrict b, double s, double c, long inc) {
void drot3(long n, double* MADNESS_RESTRICT a, double* MADNESS_RESTRICT b, double s, double c, long inc) {
if (inc == 1) {
n*=3;
for (long i=0; i<n; i+=3) {
View
@@ -22,7 +22,7 @@ typedef Function<double,3> functionT;
typedef std::vector<functionT> vecfuncT;
/// Simple (?) version of BLAS-1 DROT(N, DX, INCX, DY, INCY, DC, DS)
void drot(long n, double* restrict a, double* restrict b, double s, double c, long inc) {
void drot(long n, double* MADNESS_RESTRICT a, double* MADNESS_RESTRICT b, double s, double c, long inc) {
if (inc == 1) {
for (long i=0; i<n; ++i) {
double aa = a[i]*c - b[i]*s;
@@ -68,7 +68,7 @@ void matrix_inner(DistributedMatrix<T>& A,
}
// Computes sum(mu,nu on atom a) C[mu,i] S[mu,nu] C[nu,j]
static inline double PM_q(const tensorT & S, const double * restrict Ci, const double * restrict Cj, int lo, int nbf)
static inline double PM_q(const tensorT & S, const double * MADNESS_RESTRICT Ci, const double * MADNESS_RESTRICT Cj, int lo, int nbf)
{
double qij = 0.0;
if (nbf == 1) { // H atom in STO-3G ... often lots of these!
@@ -112,7 +112,7 @@ class SystolicFixOrbitalOrders : public SystolicMatrixAlgorithm<double> {
return nswitched == 0;
}
void kernel(int i, int j, double * restrict Ui, double * restrict Uj) {
void kernel(int i, int j, double * MADNESS_RESTRICT Ui, double * MADNESS_RESTRICT Uj) {
const int m = get_rowdim();
double sold = Ui[i]*Ui[i] + Uj[j]*Uj[j];
double snew = Ui[j]*Ui[j] + Uj[i]*Uj[i];
@@ -153,8 +153,8 @@ class SystolicPMOrbitalLocalize : public SystolicMatrixAlgorithm<double> {
// Applies rotation between orbitals i and j for Pipek Mezy
void localize_PM_ij(const int seti, const int setj,
double * restrict Ci, double * restrict Cj,
double * restrict Ui, double * restrict Uj)
double * MADNESS_RESTRICT Ci, double * MADNESS_RESTRICT Cj,
double * MADNESS_RESTRICT Ui, double * MADNESS_RESTRICT Uj)
{
if(seti == setj){
std::vector<double> Qi(natom), Qj(natom);
@@ -278,12 +278,12 @@ class SystolicPMOrbitalLocalize : public SystolicMatrixAlgorithm<double> {
return (ndone_iter == 0 && tol == thresh);
}
void kernel(int i, int j, double * restrict rowi, double * restrict rowj) {
void kernel(int i, int j, double * MADNESS_RESTRICT rowi, double * MADNESS_RESTRICT rowj) {
double * restrict Ci = rowi;
double * restrict Cj = rowj;
double * restrict Ui = Ci + nao;
double * restrict Uj = Cj + nao;
double * MADNESS_RESTRICT Ci = rowi;
double * MADNESS_RESTRICT Cj = rowj;
double * MADNESS_RESTRICT Ui = Ci + nao;
double * MADNESS_RESTRICT Uj = Cj + nao;
localize_PM_ij(set[i], set[j],
Ci, Cj,
@@ -214,7 +214,7 @@ class ProjRLMFunctor : public FunctionFunctorInterface<double,3> {
}
}
virtual void operator()(const Vector<double*,3>& xvals, double* restrict fvals, int npts) const {
virtual void operator()(const Vector<double*,3>& xvals, double* MADNESS_RESTRICT fvals, int npts) const {
double* x = new double[npts];
double* y = new double[npts];
Oops, something went wrong.

0 comments on commit f30837a

Please sign in to comment.