From: Roland Schulz Date: Thu, 4 Sep 2014 16:48:52 +0000 (-0400) Subject: Merge release-5-0 into master X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=03a4b73135622b130ad38c8b75363ba865a849de;p=alexxy%2Fgromacs.git Merge release-5-0 into master Conflicts: CMakeLists.txt trivial share/template/cmake/FindGROMACS.cmakein deleted in master src/gromacs/utility/gmx_header_config_gen.h.cmakein applied to src/gromacs/utility/gmx_header_config.h src/gromacs/commandline/pargs.cpp applied to src/gromacs/commandline/cmdlinemodulemanager.cpp src/gromacs/gmxlib/gmx_thread_affinity.c trivial src/gromacs/gmxlib/main.cpp applied to src/gromacs/utility/basenetwork.cpp src/gromacs/gmxlib/nonbonded/nb_kernel_sparc64_hpc_ace_double/*.c Merged the template and rerun the generator src/gromacs/gmxlib/nonbonded/nb_kernel_sparc64_hpc_ace_double/nb_kernel_template_sparc64_hpc_ace_double.pre trivial src/gromacs/utility/futil.cpp change unnecessary (function deleted) Other changes: src/gromacs/fileio/vmdio.c removed duplicate config.h Change-Id: Ib4237944773e41d7b52e8c0ee181da717d2b26f3 --- 03a4b73135622b130ad38c8b75363ba865a849de diff --cc CMakeLists.txt index 5aafe926ad,e87e6464ac..66144b8960 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@@ -81,13 -128,14 +81,14 @@@ if(CMAKE_CONFIGURATION_TYPES "List of configuration types" FORCE) endif() -set(build_types_with_explicit_flags RELEASE DEBUG RELWITHDEBUGINFO RELWITHASSERT MINSIZEREL) +set(build_types_with_explicit_flags RELEASE DEBUG RELWITHDEBUGINFO RELWITHASSERT MINSIZEREL PROFILE) -enable_language(C) -enable_language(CXX) + set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON) - set(CPACK_PACKAGE_NAME "gromacs") -set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) +set(CPACK_PACKAGE_VERSION_MAJOR ${GMX_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${GMX_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${GMX_VERSION_PATCH}) +set(CPACK_PACKAGE_VERSION ${GMX_VERSION_STRING}) set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") set(CPACK_PACKAGE_VENDOR "gromacs.org") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Gromacs - a toolkit for high-performance molecular simulation") @@@ -312,12 -380,17 +325,15 @@@ if(GMX_SIMD STREQUAL "AVX_256 endif() - -set(PKG_CFLAGS "") if(GMX_DOUBLE) add_definitions(-DGMX_DOUBLE) - set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_DOUBLE") + list(APPEND INSTALLED_HEADER_DEFINITIONS "-DGMX_DOUBLE") + if(GMX_RELAXED_DOUBLE_PRECISION) + add_definitions(-DGMX_RELAXED_DOUBLE_PRECISION) + endif() endif() if(GMX_SOFTWARE_INVSQRT) - set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_SOFTWARE_INVSQRT") + list(APPEND INSTALLED_HEADER_DEFINITIONS "-DGMX_SOFTWARE_INVSQRT") endif() if(WIN32 AND NOT CYGWIN) diff --cc src/gromacs/commandline/cmdlinemodulemanager.cpp index ac5f422d33,01d9fa7401..b026f8b0db --- a/src/gromacs/commandline/cmdlinemodulemanager.cpp +++ b/src/gromacs/commandline/cmdlinemodulemanager.cpp @@@ -560,45 -542,7 +560,45 @@@ int CommandLineModuleManager::run(int a { return 0; } - int rc = module->run(argc, argv); + + CommandLineModuleSettings settings; + module->init(&settings); + optionsHolder.adjustFromSettings(settings); + + // Open the debug file. + if (optionsHolder.debugLevel() > 0) + { + std::string filename(impl_->programContext_.programName()); + if (gmx_node_num() > 1) + { + filename.append(formatString("%d", gmx_node_rank())); + } + filename.append(".debug"); + + fprintf(stderr, "Will write debug log file: %s\n", filename.c_str()); + gmx_init_debug(optionsHolder.debugLevel(), filename.c_str()); + } - #if defined(HAVE_UNISTD_H) && !defined(GMX_NO_NICE) ++#if defined(HAVE_UNISTD_H) && !defined(GMX_NO_NICE) && !defined(__MINGW32__) + // Set the nice level unless disabled in the configuration. + if (optionsHolder.niceLevel() != 0) + { + static bool bNiceSet = false; // Only set it once. + if (!bNiceSet) + { + if (nice(optionsHolder.niceLevel()) == -1) + { + // Do nothing, but use the return value to avoid warnings. + } + bNiceSet = true; + } + } +#endif + + int rc = 0; + if (!(module == impl_->helpModule_ && !bMaster)) + { + rc = module->run(argc, argv); + } if (!bQuiet) { gmx_thanx(stderr); diff --cc src/gromacs/gmxlib/gmx_cpuid.c index bdbda35b85,020e37aa55..c786c0e5bb --- a/src/gromacs/gmxlib/gmx_cpuid.c +++ b/src/gromacs/gmxlib/gmx_cpuid.c @@@ -57,10 -57,10 +59,10 @@@ #endif #ifdef HAVE_UNISTD_H /* sysconf() definition */ - #include + #include #endif -#include "gmx_cpuid.h" +#include "gromacs/legacyheaders/gmx_cpuid.h" diff --cc src/gromacs/gmxlib/gmx_thread_affinity.c index 385856f71d,d38b2cfba1..703ec4cf71 --- a/src/gromacs/gmxlib/gmx_thread_affinity.c +++ b/src/gromacs/gmxlib/gmx_thread_affinity.c @@@ -32,10 -32,10 +32,10 @@@ * To help us fund GROMACS development, we humbly ask that you cite * the research papers on the package. Check out http://www.gromacs.org. */ -#ifdef HAVE_CONFIG_H -#include -#endif +#include "gmxpre.h" + +#include "config.h" - #if defined(HAVE_SCHED_H) + #ifdef HAVE_SCHED_AFFINITY # ifndef _GNU_SOURCE # define _GNU_SOURCE 1 # endif diff --cc src/gromacs/gmxlib/nonbonded/nb_kernel_sparc64_hpc_ace_double/make_nb_kernel_sparc64_hpc_ace_double.py index d1b1ba034d,6a567035f6..d1b1ba034d mode 100755,100644..100644 --- a/src/gromacs/gmxlib/nonbonded/nb_kernel_sparc64_hpc_ace_double/make_nb_kernel_sparc64_hpc_ace_double.py +++ b/src/gromacs/gmxlib/nonbonded/nb_kernel_sparc64_hpc_ace_double/make_nb_kernel_sparc64_hpc_ace_double.py diff --cc src/gromacs/gmxpreprocess/toputil.c index 7b3fff08a2,3cf53cd7d9..9c4da0eb1b --- a/src/gromacs/gmxpreprocess/toputil.c +++ b/src/gromacs/gmxpreprocess/toputil.c @@@ -34,10 -34,11 +34,11 @@@ * To help us fund GROMACS development, we humbly ask that you cite * the research papers on the package. Check out http://www.gromacs.org. */ -#ifdef HAVE_CONFIG_H -#include -#endif +#include "gmxpre.h" + +#include "config.h" + #include #include #include diff --cc src/gromacs/utility/basenetwork.cpp index 8c7bffbf54,0000000000..64ef078feb mode 100644,000000..100644 --- a/src/gromacs/utility/basenetwork.cpp +++ b/src/gromacs/utility/basenetwork.cpp @@@ -1,277 -1,0 +1,277 @@@ +/* + * This file is part of the GROMACS molecular simulation package. + * + * Copyright (c) 1991-2000, University of Groningen, The Netherlands. + * Copyright (c) 2001-2004, The GROMACS development team. + * Copyright (c) 2013,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. + */ +#include "gmxpre.h" + +#include "basenetwork.h" + +#include "config.h" + +#include +#include +#include +#include + +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#include "gromacs/utility/cstringutil.h" +#include "gromacs/utility/fatalerror.h" +#include "gromacs/utility/gmxmpi.h" +#include "gromacs/utility/programcontext.h" + +int gmx_gethostname(char *name, size_t len) +{ + if (len < 8) + { + gmx_incons("gmx_gethostname called with len<8"); + } - #if defined(HAVE_UNISTD_H) && !defined(__native_client__) ++#if defined(HAVE_UNISTD_H) && !defined(__native_client__) && !defined(__MINGW32__) + if (gethostname(name, len-1) != 0) + { + std::strncpy(name, "unknown", 8); + return -1; + } + return 0; +#else + std::strncpy(name, "unknown", 8); + return -1; +#endif +} + +gmx_bool gmx_mpi_initialized(void) +{ +#ifndef GMX_MPI + return 0; +#else + int n; + MPI_Initialized(&n); + + return n; +#endif +} + +int gmx_node_num(void) +{ +#ifndef GMX_MPI + return 1; +#else +#ifdef GMX_THREAD_MPI + if (!gmx_mpi_initialized()) + { + return 1; + } +#endif + int i; + (void) MPI_Comm_size(MPI_COMM_WORLD, &i); + return i; +#endif +} + +int gmx_node_rank(void) +{ +#ifndef GMX_MPI + return 0; +#else +#ifdef GMX_THREAD_MPI + if (!gmx_mpi_initialized()) + { + return 0; + } +#endif + int i; + (void) MPI_Comm_rank(MPI_COMM_WORLD, &i); + return i; +#endif +} + +static int mpi_hostname_hash(void) +{ + int hash_int; + +#ifndef GMX_LIB_MPI + /* We have a single physical node */ + hash_int = 0; +#else + int resultlen; + char mpi_hostname[MPI_MAX_PROCESSOR_NAME]; + + /* This procedure can only differentiate nodes with different names. + * Architectures where different physical nodes have identical names, + * such as IBM Blue Gene, should use an architecture specific solution. + */ + MPI_Get_processor_name(mpi_hostname, &resultlen); + + /* The string hash function returns an unsigned int. We cast to an int. + * Negative numbers are converted to positive by setting the sign bit to 0. + * This makes the hash one bit smaller. + * A 63-bit hash (with 64-bit int) should be enough for unique node hashes, + * even on a million node machine. 31 bits might not be enough though! + */ + hash_int = + (int)gmx_string_fullhash_func(mpi_hostname, gmx_string_hash_init); + if (hash_int < 0) + { + hash_int -= INT_MIN; + } +#endif + + return hash_int; +} + +#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) +{ + int hostnum; + Personality_t personality; + Kernel_GetPersonality(&personality, sizeof(personality)); + /* Each MPI rank has a unique coordinate in a 6-dimensional space + (A,B,C,D,E,T), with dimensions A-E corresponding to different + physical nodes, and T within each node. Each node has sixteen + physical cores, each of which can have up to four hardware + threads, so 0 <= T <= 63 (but the maximum value of T depends on + the confituration of ranks and OpenMP threads per + node). However, T is irrelevant for computing a suitable return + value for gmx_hostname_num(). + */ + hostnum = personality.Network_Config.Acoord; + hostnum *= personality.Network_Config.Bnodes; + hostnum += personality.Network_Config.Bcoord; + hostnum *= personality.Network_Config.Cnodes; + hostnum += personality.Network_Config.Ccoord; + hostnum *= personality.Network_Config.Dnodes; + hostnum += personality.Network_Config.Dcoord; + hostnum *= personality.Network_Config.Enodes; + hostnum += personality.Network_Config.Ecoord; + + if (debug) + { + std::fprintf(debug, + "Torus ID A: %d / %d B: %d / %d C: %d / %d D: %d / %d E: %d / %d\n" + "Node ID T: %d / %d core: %d / %d hardware thread: %d / %d\n", + personality.Network_Config.Acoord, + personality.Network_Config.Anodes, + personality.Network_Config.Bcoord, + personality.Network_Config.Bnodes, + personality.Network_Config.Ccoord, + personality.Network_Config.Cnodes, + personality.Network_Config.Dcoord, + personality.Network_Config.Dnodes, + personality.Network_Config.Ecoord, + personality.Network_Config.Enodes, + Kernel_ProcessorCoreID(), + 16, + Kernel_ProcessorID(), + 64, + Kernel_ProcessorThreadID(), + 4); + } + return hostnum; +} +#endif + +int gmx_physicalnode_id_hash(void) +{ + int hash; + +#ifndef GMX_MPI + hash = 0; +#else +#ifdef GMX_THREAD_MPI + /* thread-MPI currently puts the thread number in the process name, + * we might want to change this, as this is inconsistent with what + * most MPI implementations would do when running on a single node. + */ + hash = 0; +#else +#ifdef GMX_TARGET_BGQ + hash = bgq_nodenum(); +#else + hash = mpi_hostname_hash(); +#endif +#endif +#endif + + if (debug) + { + fprintf(debug, "In gmx_physicalnode_id_hash: hash %d\n", hash); + } + + return hash; +} + +#ifdef GMX_LIB_MPI +void gmx_abort(int errorno) +{ + const char *programName = "GROMACS"; + try + { + programName = gmx::getProgramContext().displayName(); + } + catch (const std::exception &) + { + } + const int nnodes = gmx_node_num(); + const int noderank = gmx_node_rank(); + if (nnodes > 1) + { + std::fprintf(stderr, "Halting parallel program %s on rank %d out of %d\n", + programName, noderank, nnodes); + } + else + { + std::fprintf(stderr, "Halting program %s\n", programName); + } + + MPI_Abort(MPI_COMM_WORLD, errorno); + std::exit(errorno); +} +#endif diff --cc src/gromacs/utility/gmx_header_config.h index 54a873e9fe,d70c1efd67..ae67ee1851 --- a/src/gromacs/utility/gmx_header_config.h +++ b/src/gromacs/utility/gmx_header_config.h @@@ -46,8 -53,4 +46,7 @@@ * \inlibraryapi * \ingroup module_utility */ -#include "gmx_header_config_gen.h" + - /* We currently don't support MingW. And ICC also defines it */ - #ifdef _MSC_VER ++#if defined( _WIN32 ) || defined( _WIN64 ) +#define GMX_NATIVE_WINDOWS +#endif diff --cc src/gromacs/utility/smalloc.c index 6b45a99a82,7d8e85c029..e542c55327 --- a/src/gromacs/utility/smalloc.c +++ b/src/gromacs/utility/smalloc.c @@@ -48,12 -48,14 +48,15 @@@ #ifdef WITH_DMALLOC #include #endif + #ifdef HAVE__ALIGNED_MALLOC + #include + #endif -#include "gromacs/legacyheaders/gmx_fatal.h" +#include "thread_mpi/threads.h" +#include "gromacs/utility/fatalerror.h" #ifdef PRINT_ALLOC_KB -#include "gromacs/legacyheaders/network.h" +#include "gromacs/utility/basenetwork.h" #include "gromacs/utility/gmxmpi.h" #endif