2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
35 #ifndef GMX_SIMD_SUPPORT_H
36 #define GMX_SIMD_SUPPORT_H
39 /*! \libinternal \file
41 * \brief Functions to query compiled and supported SIMD architectures
43 * \author Erik Lindahl <erik.lindahl@scilifelab.se>
46 * \ingroup module_simd
49 #include "gromacs/hardware/cpuinfo.h"
56 /*! \brief Enumerated options for SIMD architectures */
59 None
, //!< Disable all SIMD support
60 Reference
, //!< Gromacs reference software SIMD
61 Generic
, //!< Placeholder for future support for gcc generic SIMD
63 X86_Sse4_1
, //!< SSE4.1
64 X86_Avx128Fma
, //!< 128-bit Avx with FMA (Amd)
65 X86_Avx
, //!< 256-bit Avx
67 X86_Avx2_128
, //!< 128-bit AVX2, better than 256-bit for AMD Ryzen
68 X86_Avx512
, //!< AVX_512
69 X86_Avx512Knl
, //!< AVX_512_KNL
70 X86_Mic
, //!< Knight's corner
71 Arm_Neon
, //!< 32-bit ARM NEON
72 Arm_NeonAsimd
, //!< 64-bit ARM AArch64 Advanced SIMD
73 Arm_Sve
, //!< ARM Scalable Vector Extensions
74 Ibm_Vmx
, //!< IBM VMX SIMD (Altivec on Power6 and later)
75 Ibm_Vsx
, //!< IBM VSX SIMD (Power7 and later)
76 Fujitsu_HpcAce
//!< Fujitsu K-computer
79 /*! \libinternal \brief Return a string with the name of a SIMD type
81 * \param s SIMD type to turn into string
83 const std::string
& simdString(SimdType s
);
85 /*! \libinternal \brief Return the SIMD type that would fit this hardware best */
86 SimdType
simdSuggested(const CpuInfo
& c
);
88 /*! \libinternal \brief Return the SIMD type the library was compiled with */
89 SimdType
simdCompiled();
91 /*! \libinternal \brief Check if binary was compiled with the provided SIMD type
93 * \param s SIMD type to query. If this matches the suggested type
94 * for this cpu, the routine returns quietly.
95 * \param log If not nullptr, statistics will be printed to the file.
96 * If we do not have a match there will also be a warning.
97 * \param warnToStdErr If true, warnings will also be printed to stderr.
99 bool simdCheck(SimdType s
, FILE* log
, bool warnToStdErr
);
106 #endif // GMX_SIMD_SUPPORT_H