#include "gromacs/math/units.h"
#include "gromacs/math/vec.h"
#include "gromacs/random/random.h"
-#include "gromacs/simd/simd.h"
#include "gromacs/timing/wallcycle.h"
#include "gromacs/timing/walltime_accounting.h"
#include "gromacs/topology/mtop_util.h"
gmx_fatal(FARGS, "Unknown integrator %s", ei_names[inputrec->eI]);
}
-#ifdef GMX_SIMD
- /* Make sure we don't detect SIMD overflow generated before this point */
- gmx_simd_check_and_reset_overflow();
-#endif
-
while (bNotLastFrame)
{
frame_step = rerun_fr.step;
epot = enerd->term[F_EPOT];
bEnergyOutOfBounds = FALSE;
-#ifdef GMX_SIMD_X86_SSE2_OR_HIGHER
- /* With SSE the energy can overflow, check for this */
- if (gmx_simd_check_and_reset_overflow())
- {
- if (debug)
- {
- fprintf(debug, "Found an SSE overflow, assuming the energy is out of bounds\n");
- }
- bEnergyOutOfBounds = TRUE;
- }
-#endif
+
/* If the compiler doesn't optimize this check away
* we catch the NAN energies.
* The epot>GMX_REAL_MAX check catches inf values,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
return (float)gmx_simd4_dotproduct3_d_ibm_qpx(a, b);
}
-/* Function to check whether SIMD operations have resulted in overflow.
- * For now, this is unfortunately a dummy for this architecture.
- */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
- return 0;
-}
-
#endif /* GMX_SIMD_IMPLEMENTATION_IBM_QPX_H */
return gmx_simd_reduce_f_ibm_vmx(c);
}
-/* Function to check whether SIMD operations have resulted in overflow.
- * For now, this is unfortunately a dummy for this architecture.
- */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
- return 0;
-}
-
#endif /* GMX_SIMD_IMPLEMENTATION_IBM_VMX_H */
return vec_extract(sum, 0);
}
-/* Function to check whether SIMD operations have resulted in overflow.
- * For now, this is unfortunately a dummy for this architecture.
- */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
- return 0;
-}
-
/* Undefine our temporary work-arounds so they are not used by mistake */
#undef gmx_vsx_f2d
#undef gmx_vsx_d2f
return _mm512_mul_ps(_mm512_set1_ps(0.693147180559945286226764), _mm512_log2ae23_ps(x));
}
-/* Function to check whether SIMD operations have resulted in overflow */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
- int MXCSR;
- int sse_overflow;
- /* The overflow flag is bit 3 in the register */
- const unsigned int flag = 0x8;
-
- MXCSR = _mm_getcsr();
- if (MXCSR & flag)
- {
- sse_overflow = 1;
- /* Set the overflow flag to zero */
- MXCSR = MXCSR & ~flag;
- _mm_setcsr(MXCSR);
- }
- else
- {
- sse_overflow = 0;
- }
- return sse_overflow;
-}
-
#endif /* GMX_SIMD_IMPL_INTEL_MIC_H */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/*! \} */
-/*! \brief Return 1 if SIMD floating-point ops have overflowed, and reset check.
-
- * This function to check whether SIMD operations have resulted in overflow,
- * and returns 1 if it occured, 0 otherwise.
- * For now, this is unfortunately a dummy for all architectures except x86.
- */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
- return 0;
-}
-
/*! \} */
/*! \endcond */
return d;
}
-/* Function to check whether SIMD operations have resulted in overflow */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
- int MXCSR;
- int sse_overflow;
-
- MXCSR = _mm_getcsr();
- /* The overflow flag is bit 3 in the register */
- if (MXCSR & 0x0008)
- {
- sse_overflow = 1;
- /* Set the overflow flag to zero */
- MXCSR = MXCSR & 0xFFF7;
- _mm_setcsr(MXCSR);
- }
- else
- {
- sse_overflow = 0;
- }
- return sse_overflow;
-}
-
#endif /* GMX_SIMD_IMPL_X86_AVX_256_H */
return d;
}
-/* Function to check whether SIMD operations have resulted in overflow */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
- int MXCSR;
- int sse_overflow;
- /* The overflow flag is bit 3 in the register */
- const unsigned int flag = 0x8;
-
- MXCSR = _mm_getcsr();
- if (MXCSR & flag)
- {
- sse_overflow = 1;
- /* Set the overflow flag to zero */
- MXCSR = MXCSR & ~flag;
- _mm_setcsr(MXCSR);
- }
- else
- {
- sse_overflow = 0;
- }
- return sse_overflow;
-}
-
#endif /* GMX_SIMD_IMPL_X86_AVX_512F_H */
return f;
}
-/* Function to check whether SIMD operations have resulted in overflow */
-static int
-gmx_simd_check_and_reset_overflow(void)
-{
- int MXCSR;
- int sse_overflow;
-
- MXCSR = _mm_getcsr();
- /* The overflow flag is bit 3 in the register */
- if (MXCSR & 0x0008)
- {
- sse_overflow = 1;
- /* Set the overflow flag to zero */
- MXCSR = MXCSR & 0xFFF7;
- _mm_setcsr(MXCSR);
- }
- else
- {
- sse_overflow = 0;
- }
- return sse_overflow;
-}
-
/* SSE2 is already 4-wide in single, so we just reuse float datatype for SIMD4.
* SSE2 cannot do double-precision SIMD4.
*/