From: Mark Abraham Date: Sun, 17 Aug 2014 22:10:32 +0000 (+0000) Subject: Fixes and updates to BlueGene/Q support X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=45fe367e567fb581695e6f91d4eea08258ea6fdf;p=alexxy%2Fgromacs.git Fixes and updates to BlueGene/Q support Stopped hard-coding compilers, since these vary between sites. Moved compiler suppressions to gmxCFlags to follow standard practice better. Permitted use of software invsqrt, even though you don't want to use it. Suppressed several kinds of false-alarm warnings with whole-of-source compiler suppressions. I would preferred to keep the suppressions as file-level compiler flags, but the way we compile our list of source files for libgromacs makes this inconvenient, and the compiler would not accept the PBC-related suppression as a pragma, either. Build is now finally free of warnings (so long as you don't use the built-in LAPACK with bgclang-3.5). Restructured some helper functions that return strings whose getters might throw, so that there is a return value that will keep compilers happy in all cases. Change-Id: I7158e165575934be2b76beee7c10f860ccf58b76 --- diff --git a/cmake/Platform/BlueGeneQ-base.cmake b/cmake/Platform/BlueGeneQ-base.cmake index 5edacb98f1..1827a5e680 100644 --- a/cmake/Platform/BlueGeneQ-base.cmake +++ b/cmake/Platform/BlueGeneQ-base.cmake @@ -172,7 +172,7 @@ macro(__BlueGeneQ_set_static_flags compiler_id lang) set(CMAKE_${lang}_LINK_EXECUTABLE " ${BG/Q_${lang}_DEFAULT_EXE_FLAGS}") - if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ${compiler_id} STREQUAL "XL") + if(CMAKE_BUILD_TYPE MATCHES "Deb" AND ${compiler_id} STREQUAL "XL") # Work around an unknown compiler bug triggered in # compute_globals(). Using -O0 disables -qhot and this seems # to break the normal OpenMP flag -qsmp unless qualified with diff --git a/cmake/Platform/BlueGeneQ-static-XL-C.cmake b/cmake/Platform/BlueGeneQ-static-XL-C.cmake index a814ac765f..3999635f62 100644 --- a/cmake/Platform/BlueGeneQ-static-XL-C.cmake +++ b/cmake/Platform/BlueGeneQ-static-XL-C.cmake @@ -73,17 +73,11 @@ include(BlueGeneQ-static) __BlueGeneQ_set_static_flags(XL C) __BlueGeneQ_set_static_flags(XL CXX) -# This suppression stops the following information message from -# almost every source file at -O3: -# 1500-036: (I) The NOSTRICT option (default at OPT(3)) has the potential to alter the semantics of a program. Please refer to documentation on the STRICT/NOSTRICT option for more information. -set(COMPILER_SUPPRESSION "-qsuppress=1500-036") - set(CMAKE_SYSTEM_NAME BlueGeneQ-static CACHE STRING "Cross-compiling for BlueGene/Q" FORCE) # xl.ndebug is appropriate for production calculations. For debugging, -# use xl to add back error checks and assertions -set(CMAKE_C_COMPILER /bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpixlc_r) -set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG ${COMPILER_SUPPRESSION}" CACHE STRING "Compiler optimization flags") -set(CMAKE_CXX_COMPILER /bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpixlcxx_r) -set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG ${COMPILER_SUPPRESSION}" CACHE STRING "Compiler optimization flags") +# use xl to add back error checks and assertions. Using the +# thread-safe compiler version is required, so use (e.g.) +# CMAKE_C_COMPILER=/bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpixlc_r +# CMAKE_CXX_COMPILER=/bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpixlcxx_r mark_as_advanced(CMAKE_XL_CreateExportList) # No idea what spams this diff --git a/cmake/Platform/BlueGeneQ-static-XL-CXX.cmake b/cmake/Platform/BlueGeneQ-static-XL-CXX.cmake index a814ac765f..3999635f62 100644 --- a/cmake/Platform/BlueGeneQ-static-XL-CXX.cmake +++ b/cmake/Platform/BlueGeneQ-static-XL-CXX.cmake @@ -73,17 +73,11 @@ include(BlueGeneQ-static) __BlueGeneQ_set_static_flags(XL C) __BlueGeneQ_set_static_flags(XL CXX) -# This suppression stops the following information message from -# almost every source file at -O3: -# 1500-036: (I) The NOSTRICT option (default at OPT(3)) has the potential to alter the semantics of a program. Please refer to documentation on the STRICT/NOSTRICT option for more information. -set(COMPILER_SUPPRESSION "-qsuppress=1500-036") - set(CMAKE_SYSTEM_NAME BlueGeneQ-static CACHE STRING "Cross-compiling for BlueGene/Q" FORCE) # xl.ndebug is appropriate for production calculations. For debugging, -# use xl to add back error checks and assertions -set(CMAKE_C_COMPILER /bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpixlc_r) -set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG ${COMPILER_SUPPRESSION}" CACHE STRING "Compiler optimization flags") -set(CMAKE_CXX_COMPILER /bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpixlcxx_r) -set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG ${COMPILER_SUPPRESSION}" CACHE STRING "Compiler optimization flags") +# use xl to add back error checks and assertions. Using the +# thread-safe compiler version is required, so use (e.g.) +# CMAKE_C_COMPILER=/bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpixlc_r +# CMAKE_CXX_COMPILER=/bgsys/drivers/ppcfloor/comm/xl.ndebug/bin/mpixlcxx_r mark_as_advanced(CMAKE_XL_CreateExportList) # No idea what spams this diff --git a/cmake/Platform/BlueGeneQ-static-bgclang-cxx.cmake b/cmake/Platform/BlueGeneQ-static-bgclang-cxx.cmake new file mode 100644 index 0000000000..410c2247d7 --- /dev/null +++ b/cmake/Platform/BlueGeneQ-static-bgclang-cxx.cmake @@ -0,0 +1,79 @@ +# +# 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. +# +#============================================================================= +# CMake - Cross Platform Makefile Generator +# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium +# Copyright 2010 Todd Gamblin +# Copyright 2012 Julien Bigot +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +#============================================================================= + +include(BlueGeneQ-static) +__BlueGeneQ_set_static_flags(bgclang C) +__BlueGeneQ_set_static_flags(bgclang CXX) + +set(CMAKE_SYSTEM_NAME BlueGeneQ-static CACHE STRING "Cross-compiling for BlueGene/Q" FORCE) + +# Use (e.g.) bgclang and bgclang++ as base compilers inside mpicc and +# mpicxx diff --git a/cmake/gmxCFlags.cmake b/cmake/gmxCFlags.cmake index 64f10ced52..65a394de2c 100644 --- a/cmake/gmxCFlags.cmake +++ b/cmake/gmxCFlags.cmake @@ -200,12 +200,18 @@ MACRO(gmx_c_flags) endif() # xlc + # The suppressions below stop information messages about -O3 + # causing non-strict IEEE compliance that changes the semantics of + # the program (duh; 1500-036), warnings about correct PBC-related use of + # maximum array indices of DIM-sized C arrays (1500-010). if (CMAKE_C_COMPILER_ID MATCHES "XL") GMX_TEST_CFLAG(CFLAGS_OPT "-qarch=auto -qtune=auto" GMXC_CFLAGS) GMX_TEST_CFLAG(CFLAGS_LANG "-qlanglvl=extc99" GMXC_CFLAGS) + GMX_TEST_CFLAG(CFLAGS_LANG "-qsuppress=1500-036 -qsuppress=1500-010" GMXC_CFLAGS) endif() if (CMAKE_CXX_COMPILER_ID MATCHES "XL") GMX_TEST_CXXFLAG(CXXFLAGS_OPT "-qarch=auto -qtune=auto" GMXC_CXXFLAGS) + GMX_TEST_CXXFLAG(CFLAGS_LANG "-qsuppress=1500-036 -qsuppress=1500-010" GMXC_CXXFLAGS) endif() # msvc diff --git a/cmake/gmxManageBlueGene.cmake b/cmake/gmxManageBlueGene.cmake index ab4130ee2f..300519789b 100644 --- a/cmake/gmxManageBlueGene.cmake +++ b/cmake/gmxManageBlueGene.cmake @@ -51,7 +51,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "BlueGene.*static") set(BUILD_SHARED_LIBS OFF CACHE BOOL "Static BlueGene build toolchain selected, so shared libraries are disabled" FORCE) endif() -set(GMX_SOFTWARE_INVSQRT OFF CACHE BOOL "Do not use software reciprocal square root on BlueGene" FORCE) +set(GMX_SOFTWARE_INVSQRT OFF CACHE BOOL "Do not use software reciprocal square root on BlueGene") set(GMX_X11 OFF CACHE BOOL "X11 not compatible with BlueGene, disabled!" FORCE) set(GMX_GPU OFF CACHE BOOL "Cannot do GPU acceleration on BlueGene" FORCE) diff --git a/docs/install-guide/install-guide.md b/docs/install-guide/install-guide.md index 9ab4db6b10..6ffabb4444 100644 --- a/docs/install-guide/install-guide.md +++ b/docs/install-guide/install-guide.md @@ -909,18 +909,22 @@ accuracy and costs twice as much time moving memory around. You need to arrange for FFTW to be installed correctly, following the above instructions. -`mpicc` is used for compiling and linking. This can make it awkward to +MPI wrapper compilers should be used for compiling and linking. Both +xlc and bgclang are supported back ends - either might prove to be +faster in practice. The MPI wrapper compilers can make it awkward to attempt to use IBM's optimized BLAS/LAPACK called ESSL (see the -section on -[linear algebra libraries](#linear-algebra-libraries)). Since mdrun is -the only part of GROMACS that should normally run on the compute -nodes, and there is nearly no need for linear algebra support for -mdrun, it is recommended to use the GROMACS built-in linear algebra -routines - it is rare for this to run slowly. +section on [linear algebra +libraries](#linear-algebra-libraries)). Since mdrun is the only part +of GROMACS that should normally run on the compute nodes, and there is +nearly no need for linear algebra support for mdrun, it is recommended +to use the GROMACS built-in linear algebra routines - this is never +a problem for normal simulations. The recommended configuration is to use - cmake .. -DCMAKE_TOOLCHAIN_FILE=Platform/BlueGeneQ-static-XL-CXX \ + cmake .. -DCMAKE_C_COMPILER=mpicc \ + -DCMAKE_CXX_COMPILER=mpicxx \ + -DCMAKE_TOOLCHAIN_FILE=Platform/BlueGeneQ-static-XL-CXX \ -DCMAKE_PREFIX_PATH=/your/fftw/installation/prefix \ -DGMX_MPI=ON \ -DGMX_BUILD_MDRUN_ONLY=ON @@ -928,7 +932,9 @@ The recommended configuration is to use make install which will build a statically-linked MPI-enabled mdrun for the compute -nodes. Otherwise, GROMACS default configuration behaviour applies. +nodes. Or use the Platform/BlueGeneQ-static-bgclang-cxx +toolchain file if compiling with bgclang. Otherwise, GROMACS default configuration +behaviour applies. It is possible to configure and make the remaining GROMACS tools with the compute-node toolchain, but as none of those tools are MPI-aware diff --git a/src/gromacs/commandline/tests/CMakeLists.txt b/src/gromacs/commandline/tests/CMakeLists.txt index 62e09d9c01..e9718d6b6b 100644 --- a/src/gromacs/commandline/tests/CMakeLists.txt +++ b/src/gromacs/commandline/tests/CMakeLists.txt @@ -58,3 +58,10 @@ gmx_add_unit_test(CommandLineUnitTests commandline-test cmdlineprogramcontext.cpp pargs.cpp $) + +if (CMAKE_CXX_COMPILER_ID MATCHES "XL") + # This suppression stops a very verbose cascade of messages about the + # mocks, which is probably a compiler issue. + # 1540-2924 (W) Cannot pass an argument of non-POD class type "const gmx::CommandLineHelpContext" through ellipsis. + set_property(SOURCE cmdlinemodulemanager.cpp PROPERTY COMPILE_FLAGS "-qsuppress=1540-2924") +endif() diff --git a/src/gromacs/gmxlib/copyrite.cpp b/src/gromacs/gmxlib/copyrite.cpp index 85264a933f..e085a7bdf7 100644 --- a/src/gromacs/gmxlib/copyrite.cpp +++ b/src/gromacs/gmxlib/copyrite.cpp @@ -618,12 +618,16 @@ const char *GromacsVersion() const char *ShortProgram(void) { + const char *programName = NULL; + try { // TODO: Use the display name once it doesn't break anything. - return gmx::getProgramContext().programName(); + programName = gmx::getProgramContext().programName(); } GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR; + + return programName; } const char *Program(void) diff --git a/src/gromacs/gmxlib/network.c b/src/gromacs/gmxlib/network.c index ac2026214b..ba89f43949 100644 --- a/src/gromacs/gmxlib/network.c +++ b/src/gromacs/gmxlib/network.c @@ -201,6 +201,17 @@ static int mpi_hostname_hash(void) } #if defined GMX_LIB_MPI && defined GMX_TARGET_BGQ + +#ifdef __clang__ +/* IBM's declaration of this function in + * /bgsys/drivers/V1R2M2/ppc64/spi/include/kernel/process.h + * erroneously fails to specify __INLINE__, despite + * /bgsys/drivers/V1R2M2/ppc64/spi/include/kernel/cnk/process_impl.h + * specifiying __INLINE__, so bgclang thinks they are different enough + * to complain about. */ +static uint64_t Kernel_GetJobID(); +#endif + #include static int bgq_nodenum(void) diff --git a/src/gromacs/gmxlib/oenv.cpp b/src/gromacs/gmxlib/oenv.cpp index ebe3d156da..01eda5251e 100644 --- a/src/gromacs/gmxlib/oenv.cpp +++ b/src/gromacs/gmxlib/oenv.cpp @@ -204,28 +204,40 @@ xvg_format_t output_env_get_xvg_format(const output_env_t oenv) const char *output_env_get_program_name(const output_env_t oenv) { + const char *programName = NULL; + try { - return oenv->programContext.fullBinaryPath(); + programName = oenv->programContext.fullBinaryPath(); } GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR; + + return programName; } const char *output_env_get_short_program_name(const output_env_t oenv) { + const char *programName = NULL; + try { // TODO: Use the display name once it doesn't break anything. - return oenv->programContext.programName(); + programName = oenv->programContext.programName(); } GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR; + + return programName; } const char *output_env_get_cmd_line(const output_env_t oenv) { + const char *commandLine = NULL; + try { - return oenv->programContext.commandLine(); + commandLine = oenv->programContext.commandLine(); } GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR; + + return commandLine; } diff --git a/src/gromacs/onlinehelp/tests/CMakeLists.txt b/src/gromacs/onlinehelp/tests/CMakeLists.txt index 01dd85eff8..1e47c92f7b 100644 --- a/src/gromacs/onlinehelp/tests/CMakeLists.txt +++ b/src/gromacs/onlinehelp/tests/CMakeLists.txt @@ -35,6 +35,13 @@ gmx_add_unit_test_object_library(onlinehelp-test-shared mock_helptopic.cpp) +if (CMAKE_CXX_COMPILER_ID MATCHES "XL") + # This suppression stops a very verbose cascade of messages about the + # mocks, which is probably a compiler issue. + # 1540-2924 (W) Cannot pass an argument of non-POD class type "const gmx::HelpWriterContext" through ellipsis. + set_property(SOURCE mock_helptopic.cpp PROPERTY COMPILE_FLAGS "-qsuppress=1540-2924") +endif() + gmx_add_unit_test(OnlineHelpUnitTests onlinehelp-test helpformat.cpp helpmanager.cpp