From 8b7f2d16750c2c433c4aaebeaf4123a1fccc10f4 Mon Sep 17 00:00:00 2001 From: Erik Lindahl Date: Wed, 30 Jul 2014 14:34:32 +0200 Subject: [PATCH] Improve Gromacs portability This patch addresses a few general portability issues that we have experienced at least on Fujitsu compilers (K computer) and (partly) for Pathscale x86 compilers. - I have added a generic compiler definition fallback for boost, so it will work on unidentified compilers. - There is now a define for gmock-1.7.0 to handle the case where wcscasecmp() is not available. We use this by default since it is not important for us. - If we do not find atomics for sparc64 we now warn and fall back on mutexes rather than the compile dying. - The compiler flag checks have been updated from cmake-3.0, and more warning checks added. - Since some non-GCC compilers set _GNUC_ for compatibilty, we do not assume all such compilers support tr1, but use the internal tr1/tuple definition in Gmock by default. - Before using the sched.h affinity functions, we now check that all the functions we need are supported, rather than just one of them. Change-Id: I31b7f0f46a9d03a627c73a0789b4a9b24fa860ee --- CMakeLists.txt | 17 +++-- cmake/CheckCCompilerFlag.cmake | 6 ++ cmake/CheckCXXCompilerFlag.cmake | 6 +- ...rkaround.cmake => TestSchedAffinity.cmake} | 64 +++++++++++----- cmake/gmxGetGmockTupleWorkaround.cmake | 73 +++++++++++++++++++ src/config.h.cmakein | 7 +- src/external/boost/README | 13 +++- .../boost/boost/config/compiler/generic.hpp | 71 ++++++++++++++++++ .../boost/config/select_compiler_config.hpp | 9 ++- src/external/gmock-1.7.0/CMakeLists.txt | 4 +- src/external/gmock-1.7.0/README.Gromacs | 6 ++ src/external/gmock-1.7.0/gtest/src/gtest.cc | 2 +- .../thread_mpi/include/thread_mpi/atomic.h | 3 +- src/gromacs/gmxlib/gmx_cpuid.c | 10 ++- src/gromacs/gmxlib/gmx_thread_affinity.c | 14 ++-- src/gromacs/onlinehelp/helpwritercontext.cpp | 2 +- 16 files changed, 254 insertions(+), 53 deletions(-) rename cmake/{gmxGetMsvcTupleWorkaround.cmake => TestSchedAffinity.cmake} (57%) create mode 100644 cmake/gmxGetGmockTupleWorkaround.cmake create mode 100644 src/external/boost/boost/config/compiler/generic.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 2abc0d729a..246920662f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -325,14 +325,20 @@ include(gmxManageOpenMP) ##################################################################### # The cmake/Check{C,CXX}CompilerFlag.cmake files in the GROMACS distribution -# are used with permission from CMake v2.8.9 so that GROMACS can detect -# invalid options with the Intel Compilers. +# are used with permission from CMake v3.0.0 so that GROMACS can detect +# invalid options with the Intel Compilers, and we have added a line +# to detect warnings with the Fujitsu compilers on K computer. +# CMake-3.0 also has a bug where the FAIL_REGEX pattern for AIX contains +# a semicolon. Since this is also used as a separator in lists inside CMake, +# that string ends up being split into two separate patterns, and the last +# part is just a single word that also matches other messages. We solved this +# by replacing the semicolon with a period that matches any character. +# # These files should be removed from the source tree when a CMake version that # includes the features in question becomes required for building GROMACS. include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) - include(gmxCFlags) gmx_c_flags() @@ -410,8 +416,6 @@ check_function_exists(fileno HAVE_FILENO) check_function_exists(_commit HAVE__COMMIT) check_function_exists(sigaction HAVE_SIGACTION) check_function_exists(sysconf HAVE_SYSCONF) -check_function_exists(sched_setaffinity HAVE_SCHED_SETAFFINITY) -check_function_exists(sched_getaffinity HAVE_SCHED_GETAFFINITY) check_function_exists(rsqrt HAVE_RSQRT) check_function_exists(rsqrtf HAVE_RSQRTF) check_function_exists(sqrtf HAVE_SQRTF) @@ -420,6 +424,9 @@ include(CheckLibraryExists) check_library_exists(m sqrt "" HAVE_LIBM) check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME) +include(TestSchedAffinity) +test_sched_affinity(HAVE_SCHED_AFFINITY) + include(TestBigEndian) test_big_endian(GMX_INTEGER_BIG_ENDIAN) diff --git a/cmake/CheckCCompilerFlag.cmake b/cmake/CheckCCompilerFlag.cmake index e65ba1b4a6..48d8177e09 100644 --- a/cmake/CheckCCompilerFlag.cmake +++ b/cmake/CheckCCompilerFlag.cmake @@ -64,7 +64,13 @@ MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT) FAIL_REGEX "[Uu]nknown option" # HP FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro FAIL_REGEX "command option .* is not recognized" # XL + FAIL_REGEX "command option .* contains an incorrect subargument" # XL + FAIL_REGEX "not supported in this configuration. ignored" # AIX + FAIL_REGEX "File with unknown suffix passed to linker" # PGI FAIL_REGEX "WARNING: unknown flag:" # Open64 + FAIL_REGEX "Incorrect command line option:" # Borland + FAIL_REGEX "Warning: illegal option" # SunStudio 12 + FAIL_REGEX "[Ww]arning: Invalid" # Fujitsu ) SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") ENDMACRO (CHECK_C_COMPILER_FLAG) diff --git a/cmake/CheckCXXCompilerFlag.cmake b/cmake/CheckCXXCompilerFlag.cmake index 660f5aaa62..a11373eb3f 100644 --- a/cmake/CheckCXXCompilerFlag.cmake +++ b/cmake/CheckCXXCompilerFlag.cmake @@ -64,9 +64,13 @@ MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) FAIL_REGEX "[Uu]nknown option" # HP FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro FAIL_REGEX "command option .* is not recognized" # XL - FAIL_REGEX "not supported in this configuration. ignored" # AIX + FAIL_REGEX "command option .* contains an incorrect subargument" # XL + FAIL_REGEX "not supported in this configuration. ignored" # AIX FAIL_REGEX "File with unknown suffix passed to linker" # PGI FAIL_REGEX "WARNING: unknown flag:" # Open64 + FAIL_REGEX "Incorrect command line option:" # Borland + FAIL_REGEX "Warning: illegal option" # SunStudio 12 + FAIL_REGEX "[Ww]arning: Invalid" # Fujitsu ) SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") ENDMACRO (CHECK_CXX_COMPILER_FLAG) diff --git a/cmake/gmxGetMsvcTupleWorkaround.cmake b/cmake/TestSchedAffinity.cmake similarity index 57% rename from cmake/gmxGetMsvcTupleWorkaround.cmake rename to cmake/TestSchedAffinity.cmake index 7096174d15..8fd2356073 100644 --- a/cmake/gmxGetMsvcTupleWorkaround.cmake +++ b/cmake/TestSchedAffinity.cmake @@ -1,7 +1,7 @@ # # This file is part of the GROMACS molecular simulation package. # -# Copyright (c) 2014, by the GROMACS development team, led by +# Copyright (c) 2012,2014, 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. @@ -32,21 +32,47 @@ # To help us fund GROMACS development, we humbly ask that you cite # the research papers on the package. Check out http://www.gromacs.org. -# GMock uses tuples extensively, and MSVC bundles a tuple library that -# is not compatible with the standard. r675 of googletest works around -# this properly, but that's not in GMock 1.7.0. That logic is -# duplicated here. See -# https://code.google.com/p/googletest/source/detail?r=675#, but note -# that its summary does not represent its code correctly. -# -# This function should be called to get the compile definitions -# suitable for working around MSVC to compile GMock, if any. -# Returns a string of options in VARIABLE -function(GET_MSVC_TUPLE_WORKAROUND_DEFINITIONS VARIABLE) - set(${VARIABLE} "") - if(MSVC AND MSVC_VERSION VERSION_EQUAL 1700) - # Fixes Visual Studio 2012 - set(${VARIABLE} "_VARIADIC_MAX=10") - endif() - set(${VARIABLE} ${${VARIABLE}} PARENT_SCOPE) -endfunction() +# - Define macro to check if all of the following work: +# sched_getaffinity() +# sched_setaffinity() +# CPU_ZERO() +# CPU_SET() +# CPU_ISSET() +# CPU_CLR() +# CPU_COUNT() + +# test_sched_affinity(VARIABLE) +# +# VARIABLE will be set to true if all of the functions link fine. + +MACRO(test_sched_affinity VARIABLE) + + if(NOT DEFINED sched_affinity_compile) + MESSAGE(STATUS "Checking for sched.h GNU affinity API") + + check_c_source_compiles( + "#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif +#include +int main(void) { + int i; + cpu_set_t mask; + CPU_ZERO(&mask); + sched_getaffinity(0, sizeof(cpu_set_t), &mask); + if(CPU_ISSET(0,&mask)) + { + CPU_CLR(0,&mask); + CPU_SET(0,&mask); + } + sched_setaffinity(0, sizeof(cpu_set_t), &mask); + return CPU_COUNT(&mask); +}" sched_affinity_compile) + endif(NOT DEFINED sched_affinity_compile) + + if(sched_affinity_compile) + set(${VARIABLE} 1 CACHE INTERNAL "Result of test for sched.h GNU affinity API" FORCE) + else() + set(${VARIABLE} 0 CACHE INTERNAL "Result of test for sched.h GNU affinity API" FORCE) + endif() +ENDMACRO(test_sched_affinity VARIABLE) diff --git a/cmake/gmxGetGmockTupleWorkaround.cmake b/cmake/gmxGetGmockTupleWorkaround.cmake new file mode 100644 index 0000000000..d9456bb8a3 --- /dev/null +++ b/cmake/gmxGetGmockTupleWorkaround.cmake @@ -0,0 +1,73 @@ +# +# This file is part of the GROMACS molecular simulation package. +# +# Copyright (c) 2014, 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. +# +# GROMACS is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation; either version 2.1 +# of the License, or (at your option) any later version. +# +# GROMACS is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with GROMACS; if not, see +# http://www.gnu.org/licenses, or write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# If you want to redistribute modifications to GROMACS, please +# consider that scientific software is very special. Version +# control is crucial - bugs must be traceable. We will be happy to +# consider code for inclusion in the official distribution, but +# derived work must not be called official GROMACS. Details are found +# in the README & COPYING files - if they are missing, get the +# official version at http://www.gromacs.org. +# +# To help us fund GROMACS development, we humbly ask that you cite +# the research papers on the package. Check out http://www.gromacs.org. + +# GMock uses tuples extensively, but since it is part of tr1 we cannot +# assume it is present - the Fujitsu compilers on K computer is one +# example of a system where it is not, and this is likely the case for many +# embedded systems too. +# +# In general, we can ask gmock to use its own internal implementation by +# defining GTEST_USE_OWN_TR1_TUPLE=1. This is safe for Gromacs, since we do +# not use tr1/tuple.h elsewhere. However, this workaround itself will not +# compile on MSVC - but this is the only architecture we know where it does +# not work. To make things even worse, on MSVC even the standard tr1/tuple +# implementation is not fully compatible, but we can make it work by setting +# _VARIADIC_MAX=10. This is similar to r675 of googletest, which is still not +# present in GMock 1.7.0. See +# https://code.google.com/p/googletest/source/detail?r=675#, but note +# that its summary does not represent its code correctly. +# +# To make all this work without user intervention, we first check what compiler +# we have, and if it is not MSVC we simply use the internal version. If we are +# using MSVC, we rely on the compiler's version, but set the variable necessary +# to make it compatible. +# +# This function should be called to get the compile definitions +# suitable for making sure we have a tuple implementation that works with gmock. +# +# Returns a string of options in VARIABLE +function(GET_GMOCK_TUPLE_WORKAROUND VARIABLE) + set(${VARIABLE} "") + if(MSVC OR (WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "Intel")) + if(MSVC_VERSION VERSION_EQUAL 1700) + # Fixes Visual Studio 2012 + set(${VARIABLE} "_VARIADIC_MAX=10") + endif() + # For MSVC different from 2012, or Intel on Windows, we reply on tr1/tuple working. + else() + # Use the built-in version on all other compilers. + set(${VARIABLE} "GTEST_USE_OWN_TR1_TUPLE=1") + endif() + set(${VARIABLE} ${${VARIABLE}} PARENT_SCOPE) +endfunction() diff --git a/src/config.h.cmakein b/src/config.h.cmakein index c0fe73d85e..897dae65df 100644 --- a/src/config.h.cmakein +++ b/src/config.h.cmakein @@ -307,11 +307,8 @@ /* Define to 1 if you have the sysconf() function */ #cmakedefine HAVE_SYSCONF -/* Define to 1 if you have the sched_getaffinity() function */ -#cmakedefine HAVE_SCHED_GETAFFINITY - -/* Define to 1 if you have the sched_setaffinity() function */ -#cmakedefine HAVE_SCHED_SETAFFINITY +/* Define to 1 if you have the all the affinity functions in sched.h */ +#cmakedefine HAVE_SCHED_AFFINITY /* Bytes in IEEE fp word are in big-endian order if set, little-endian if not. Only relevant when FLOAT_FORMAT_IEEE754 is defined. */ diff --git a/src/external/boost/README b/src/external/boost/README index c63c724ab8..a41bac446d 100644 --- a/src/external/boost/README +++ b/src/external/boost/README @@ -2,9 +2,14 @@ Steps to produce minimal version of BOOST: 1) Download Boost (current minimal version is derived from 1.55.0) 2) Extract 3) Edit Boost files to uncomment unnessary includes (search for GMX in minimal version and copy all changes) -4) run bcp with required files (currently exception/all.hpp, scoped_ptr.hpp) -5) delete source files which are not required. Currently: - libs/smart_ptr/src/sp_collector.cpp - libs/smart_ptr/src/sp_debug_hooks.cpp +4) Make sure our subset works even with compilers not listed + among the boost ones (in particular, Fujistu in native mode): + - Edit config/select_compiler_config.hpp to add the fallback + to a generic compiler capability file at the end. + - Add the generic compiler capability file config/compiler/generic.hpp +5) run bcp with required files (currently exception/all.hpp, scoped_ptr.hpp) +6) delete source files which are not required. Currently: + - libs/smart_ptr/src/sp_collector.cpp + - libs/smart_ptr/src/sp_debug_hooks.cpp Make sure that they are really not needed.If any source files are added make sure to add them to cmake. diff --git a/src/external/boost/boost/config/compiler/generic.hpp b/src/external/boost/boost/config/compiler/generic.hpp new file mode 100644 index 0000000000..58226932bb --- /dev/null +++ b/src/external/boost/boost/config/compiler/generic.hpp @@ -0,0 +1,71 @@ +// File created by Erik Lindahl July 2014 by copying most of the pathscale.hpp +// compiler definition in Boost-1.55. + +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for most recent version. + +// Settings for a generic compiler. We assume that long long exists, +// remove all C++11 support, and assume threads work. + +#ifndef BOOST_COMPILER +# define BOOST_COMPILER "Generic compiler" +#endif + +// It might seem stupid to assume a generic compiler to have threads, but it +// appears some Boost reference counting might not be thread-safe without this. +#define BOOST_HAS_THREADS +#define BOOST_HAS_PTHREADS + +#define BOOST_HAS_LONG_LONG +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SCOPED_ENUMS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_NUMERIC_LIMITS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_MS_INT64_NUMERIC_LIMITS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_HDR_UNORDERED_SET +#define BOOST_NO_CXX11_HDR_UNORDERED_MAP +#define BOOST_NO_CXX11_HDR_TYPEINDEX +#define BOOST_NO_CXX11_HDR_TUPLE +#define BOOST_NO_CXX11_HDR_THREAD +#define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +#define BOOST_NO_CXX11_HDR_REGEX +#define BOOST_NO_CXX11_HDR_RATIO +#define BOOST_NO_CXX11_HDR_RANDOM +#define BOOST_NO_CXX11_HDR_MUTEX +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_HDR_FUTURE +#define BOOST_NO_CXX11_HDR_FORWARD_LIST +#define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +#define BOOST_NO_CXX11_HDR_CODECVT +#define BOOST_NO_CXX11_HDR_CHRONO +#define BOOST_NO_CXX11_USER_DEFINED_LITERALS +#define BOOST_NO_CXX11_ALIGNAS +#define BOOST_NO_CXX11_TRAILING_RESULT_TYPES +#define BOOST_NO_CXX11_INLINE_NAMESPACES + diff --git a/src/external/boost/boost/config/select_compiler_config.hpp b/src/external/boost/boost/config/select_compiler_config.hpp index 0eeb7ad3ee..3b35416712 100644 --- a/src/external/boost/boost/config/select_compiler_config.hpp +++ b/src/external/boost/boost/config/select_compiler_config.hpp @@ -106,9 +106,10 @@ // example) also #define _MSC_VER # define BOOST_COMPILER_CONFIG "boost/config/compiler/visualc.hpp" -#elif defined (BOOST_ASSERT_CONFIG) -// this must come last - generate an error if we don't -// recognise the compiler: -# error "Unknown compiler - please configure (http://www.boost.org/libs/config/config.htm#configuring) and report the results to the main boost mailing list (http://www.boost.org/more/mailing_lists.htm#main)" +#else + +# warning Unknown boost compiler; using generic settings not tested for this compiler. +# define BOOST_COMPILER_CONFIG "boost/config/compiler/generic.hpp" + #endif diff --git a/src/external/gmock-1.7.0/CMakeLists.txt b/src/external/gmock-1.7.0/CMakeLists.txt index 3cb202bfd0..114e41834b 100644 --- a/src/external/gmock-1.7.0/CMakeLists.txt +++ b/src/external/gmock-1.7.0/CMakeLists.txt @@ -35,8 +35,8 @@ # As stated in README.Gromacs, this file is not part of GMock, but is written # specifically for the GROMACS build system from scratch. -include(gmxGetMsvcTupleWorkaround) -get_msvc_tuple_workaround_definitions(GMOCK_COMPILE_DEFINITIONS) +include(gmxGetGmockTupleWorkaround) +get_gmock_tuple_workaround(GMOCK_COMPILE_DEFINITIONS) set(GMOCK_COMPILE_DEFINITIONS ${GMOCK_COMPILE_DEFINITIONS} PARENT_SCOPE) # GTest/GMock suggest linking with pthreads when available for thread safety diff --git a/src/external/gmock-1.7.0/README.Gromacs b/src/external/gmock-1.7.0/README.Gromacs index 6275ec1d12..7560c11d51 100644 --- a/src/external/gmock-1.7.0/README.Gromacs +++ b/src/external/gmock-1.7.0/README.Gromacs @@ -14,3 +14,9 @@ gmock-1.7.0/gtest/src/ The file CMakeLists.txt in this directory is part of the Gromacs build system and has been written from scratch. + +In the default version, gmock-1.7.0 assumes wcscasecmp() to be present on Linux. +This is not the case on all platforms, so on line 1610 of gtest/src/gtest.cc +we have added a define to only use this if GTEST_HAS_WCSCASECMP is set. Since +we never set this define, we fall back on the alternative internal implementation +which should be perfectly fine for now. diff --git a/src/external/gmock-1.7.0/gtest/src/gtest.cc b/src/external/gmock-1.7.0/gtest/src/gtest.cc index 6de53dd019..e2b5c5b6f7 100644 --- a/src/external/gmock-1.7.0/gtest/src/gtest.cc +++ b/src/external/gmock-1.7.0/gtest/src/gtest.cc @@ -1607,7 +1607,7 @@ bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs, #if GTEST_OS_WINDOWS return _wcsicmp(lhs, rhs) == 0; -#elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID +#elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID && GTEST_HAS_WCSCASECMP return wcscasecmp(lhs, rhs) == 0; #else // Android, Mac OS X and Cygwin don't define wcscasecmp. diff --git a/src/external/thread_mpi/include/thread_mpi/atomic.h b/src/external/thread_mpi/include/thread_mpi/atomic.h index 895db00ff4..5a183ab6b5 100644 --- a/src/external/thread_mpi/include/thread_mpi/atomic.h +++ b/src/external/thread_mpi/include/thread_mpi/atomic.h @@ -169,7 +169,8 @@ extern "C" #elif defined(__FUJITSU) && defined(__sparc__) /* Fujitsu FX10 SPARC compiler requires gcc compatibility with -Xg */ -#error Atomics support for Fujitsu FX10 compiler requires -Xg (gcc compatibility) +#warning Atomics support for Fujitsu FX10 compiler requires -Xg (gcc compatibility) +#define TMPI_NO_ATOMICS #elif defined(_CRAYC) diff --git a/src/gromacs/gmxlib/gmx_cpuid.c b/src/gromacs/gmxlib/gmx_cpuid.c index 03b83fc432..fb1b076ee8 100644 --- a/src/gromacs/gmxlib/gmx_cpuid.c +++ b/src/gromacs/gmxlib/gmx_cpuid.c @@ -37,8 +37,10 @@ #endif #ifdef HAVE_SCHED_H -#define _GNU_SOURCE -#include +# ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +# endif +# include #endif #include @@ -555,7 +557,7 @@ cpuid_check_amd_x86(gmx_cpuid_t cpuid) /* Query APIC information on AMD */ if (max_extfn >= 0x80000008) { -#if (defined HAVE_SCHED_H && defined HAVE_SCHED_SETAFFINITY && defined HAVE_SYSCONF && defined __linux__) +#if (defined HAVE_SCHED_AFFINITY && defined HAVE_SYSCONF && defined __linux__) /* Linux */ unsigned int i; cpu_set_t cpuset, save_cpuset; @@ -669,7 +671,7 @@ cpuid_check_intel_x86(gmx_cpuid_t cpuid) if (max_stdfn >= 0xB) { /* Query x2 APIC information from cores */ -#if (defined HAVE_SCHED_H && defined HAVE_SCHED_SETAFFINITY && defined HAVE_SYSCONF && defined __linux__) +#if (defined HAVE_SCHED_AFFINITY && defined HAVE_SYSCONF && defined __linux__) /* Linux */ unsigned int i; cpu_set_t cpuset, save_cpuset; diff --git a/src/gromacs/gmxlib/gmx_thread_affinity.c b/src/gromacs/gmxlib/gmx_thread_affinity.c index 90970b6bd2..fb2064213e 100644 --- a/src/gromacs/gmxlib/gmx_thread_affinity.c +++ b/src/gromacs/gmxlib/gmx_thread_affinity.c @@ -35,10 +35,12 @@ #ifdef HAVE_CONFIG_H #include #endif -#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_GETAFFINITY) -#define _GNU_SOURCE -#include -#include +#if defined(HAVE_SCHED_H) +# ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +# endif +# include +# include #endif #include #include @@ -375,7 +377,7 @@ gmx_check_thread_affinity_set(FILE gmx_unused *fplog, int gmx_unused nthreads_hw_avail, gmx_bool gmx_unused bAfterOpenmpInit) { -#ifdef HAVE_SCHED_GETAFFINITY +#ifdef HAVE_SCHED_AFFINITY cpu_set_t mask_current; int i, ret, cpu_count, cpu_set; gmx_bool bAllSet; @@ -459,5 +461,5 @@ gmx_check_thread_affinity_set(FILE gmx_unused *fplog, fprintf(debug, "Default affinity mask found\n"); } } -#endif /* HAVE_SCHED_GETAFFINITY */ +#endif /* HAVE_SCHED_AFFINITY */ } diff --git a/src/gromacs/onlinehelp/helpwritercontext.cpp b/src/gromacs/onlinehelp/helpwritercontext.cpp index 649ab7849d..2a30686f39 100644 --- a/src/gromacs/onlinehelp/helpwritercontext.cpp +++ b/src/gromacs/onlinehelp/helpwritercontext.cpp @@ -357,7 +357,7 @@ class WrapperToVector : public WrapperInterface std::string toUpperCase(const std::string &text) { std::string result(text); - transform(result.begin(), result.end(), result.begin(), toupper); + std::transform(result.begin(), result.end(), result.begin(), toupper); return result; } -- 2.22.0