Fixes and updates to BlueGene/Q support
authorMark Abraham <mark.j.abraham@gmail.com>
Sun, 17 Aug 2014 22:10:32 +0000 (22:10 +0000)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Mon, 1 Sep 2014 16:28:43 +0000 (18:28 +0200)
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

12 files changed:
cmake/Platform/BlueGeneQ-base.cmake
cmake/Platform/BlueGeneQ-static-XL-C.cmake
cmake/Platform/BlueGeneQ-static-XL-CXX.cmake
cmake/Platform/BlueGeneQ-static-bgclang-cxx.cmake [new file with mode: 0644]
cmake/gmxCFlags.cmake
cmake/gmxManageBlueGene.cmake
docs/install-guide/install-guide.md
src/gromacs/commandline/tests/CMakeLists.txt
src/gromacs/gmxlib/copyrite.cpp
src/gromacs/gmxlib/network.c
src/gromacs/gmxlib/oenv.cpp
src/gromacs/onlinehelp/tests/CMakeLists.txt

index 5edacb98f127451687fa46cbd3d5d47237932630..1827a5e680ae7ebd2851ab69331628e52192650e 100644 (file)
@@ -172,7 +172,7 @@ macro(__BlueGeneQ_set_static_flags compiler_id lang)
   set(CMAKE_${lang}_LINK_EXECUTABLE
     "<CMAKE_${lang}_COMPILER> ${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
index a814ac765f2beee6a80861cbeca4819810af0a44..3999635f62a71c2d933209762a6da1e79399a3c7 100644 (file)
@@ -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
index a814ac765f2beee6a80861cbeca4819810af0a44..3999635f62a71c2d933209762a6da1e79399a3c7 100644 (file)
@@ -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 (file)
index 0000000..410c224
--- /dev/null
@@ -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 <tgamblin@llnl.gov>
+# Copyright 2012 Julien Bigot <julien.bigot@cea.fr>
+# 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
index 64f10ced525823ccce41a625191a700d9a02b037..65a394de2c229cefafc5bfec49b8cdf0ade4bb98 100644 (file)
@@ -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
index ab4130ee2f9a5cffaae193347d6f10fc4866e27d..300519789b685aa9ada7237ec8f347e52eb95f99 100644 (file)
@@ -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)
 
index 9ab4db6b1095967e2d01bbd77527c1496098659d..6ffabb444454104b62e890aa4864340d2ebd0bdc 100644 (file)
@@ -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
index 62e09d9c01921206222d427041d0cbe18136cd08..e9718d6b6b1ede8ae1a00995d30af529a6325b54 100644 (file)
@@ -58,3 +58,10 @@ gmx_add_unit_test(CommandLineUnitTests commandline-test
                   cmdlineprogramcontext.cpp
                   pargs.cpp
                   $<TARGET_OBJECTS:onlinehelp-test-shared>)
+
+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()
index 85264a933f94be65cb0fc763deee4fd638d6a002..e085a7bdf703e3349cfb7f3030957ae9b80e49bf 100644 (file)
@@ -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)
index ac2026214b2d4448ab05d06a41bfaca373e6bd52..ba89f439494890053892c695373a44ad82a16ccf 100644 (file)
@@ -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 <spi/include/kernel/location.h>
 
 static int bgq_nodenum(void)
index ebe3d156da1961303144cfc9460121b2a3cef3d4..01eda5251e052252720b8f6c50a5dea05c5a4e8a 100644 (file)
@@ -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;
 }
index 01dd85eff81efb4e84a1abb9ef2aa31da8c5ddb2..1e47c92f7b594acfba944f0fb27d7800927d42a8 100644 (file)
 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