--- /dev/null
+#
+# This file is part of the GROMACS molecular simulation package.
+#
+# Copyright (c) 2016, 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.
+
+import os.path
+
+# TODO when merging this to master, update gcc to 4.8
+build_options = ['gcc-4.7', 'cmake-3.4.3']
+extra_projects = [Project.REGRESSIONTESTS]
+
+def run_build(context, cmake_opts):
+ context.chdir(context.workspace.build_dir)
+ context.run_cmake(cmake_opts)
+ context.build_target(target=None)
+
+ context.chdir(context.workspace.get_project_dir(Project.REGRESSIONTESTS))
+ cmd = ['perl', 'gmxtest.pl', 'all']
+ if cmake_opts['GMX_DOUBLE'] == 'ON':
+ cmd += ['-double']
+ context.run_cmd(cmd, failure_message='Regression tests failed to execute')
+
+def do_build(context):
+ cmake_opts=dict()
+ cmake_opts['CMAKE_BUILD_TYPE'] = 'Reference'
+ context.env.set_env_var('GMX_NO_TERM', '1')
+ context.env.prepend_path_env(os.path.join(context.workspace.build_dir, 'bin'))
+
+ cmake_opts['GMX_DOUBLE'] = 'ON'
+ run_build(context, cmake_opts)
+
+ cmake_opts['GMX_DOUBLE'] = 'OFF'
+ run_build(context, cmake_opts)
+
+ context.workspace.upload_revision(project=Project.REGRESSIONTESTS, file_glob='*reference*')
#$res0 = shift;# || die "I need the residue offset\n";
$pdb = shift || die "I need the name of the pdb file with correct atom numbers\n";
$core = shift || "core.ndx";
-$tbl = "$ENV{GMXDATA}/gromacs/top/atom_nom.tbl";
+$tbl = "$ENV{GMXDATA}/top/atom_nom.tbl";
printf "[ distance_restraints ]\n";
printf "; Read an xplor distance restraint file, and output GROMACS distance restraints.\n";
; bond as an improper dihedral
; 0 = do not generate such
; bonds angles dihedrals impropers all_dihedrals nrexcl HH14 RemoveDih
- 1 1 3 1 1 3 1 0
+ 1 1 3 1 1 3 1 0
[ ACE ]
[ atoms ]
C O
-C N
[ impropers ]
- -C CA N H improper_Z_N_X_Y
- CA +N C O improper_O_C_X_Y
+ -C CA N H improper_Z_N_X_Y
+ CA +N C O improper_O_C_X_Y
[ ARG ]
[ atoms ]
- N opls_238 -0.500 1
+ N opls_238 -0.500 1
H opls_241 0.300 1
- CA opls_224B 0.140 1
- HA opls_140 0.060 1
- CB opls_136 -0.120 2
- HB1 opls_140 0.060 2
- HB2 opls_140 0.060 2
- CG opls_308 -0.050 3
- HG1 opls_140 0.060 3
- HG2 opls_140 0.060 3
- CD opls_307 0.190 4
- HD1 opls_140 0.060 4
- HD2 opls_140 0.060 4
- NE opls_303 -0.700 5
- HE opls_304 0.440 5
- CZ opls_302 0.640 5
+ CA opls_224B 0.140 1
+ HA opls_140 0.060 1
+ CB opls_136 -0.120 2
+ HB1 opls_140 0.060 2
+ HB2 opls_140 0.060 2
+ CG opls_308 -0.050 3
+ HG1 opls_140 0.060 3
+ HG2 opls_140 0.060 3
+ CD opls_307 0.190 4
+ HD1 opls_140 0.060 4
+ HD2 opls_140 0.060 4
+ NE opls_303 -0.700 5
+ HE opls_304 0.440 5
+ CZ opls_302 0.640 5
NH1 opls_300 -0.800 6
HH11 opls_301 0.460 6
HH12 opls_301 0.460 6
HD2 opls_140 0.060 4
NE opls_749 -0.620 5
HE opls_304 0.350 5; guessed charge
- CZ opls_752 0.550 6
+ CZ opls_752 0.550 6
NH1 opls_750 -0.785 6
- HH1 opls_301 0.340 6; guessed charge
+ HH1 opls_301 0.340 6; guessed charge
NH2 opls_751 -0.785 7
- HH21 opls_301 0.360 7; guessed charge
+ HH21 opls_301 0.360 7; guessed charge
HH22 opls_301 0.360 7; guessed charge
C opls_235 0.500 8
O opls_236 -0.500 8
CB CG
CG OD1
CG OD2
- C O
- -C N
+ C O
+ -C N
[ dihedrals ] ; override some with residue-specific ones
N CA CB CG dih_ASP_chi1_N_C_C_C
CG CB CA C dih_ASP_chi1_C_C_C_CO
[ impropers ]
- -C CA N H improper_Z_N_X_Y
- CA +N C O improper_O_C_X_Y
- CB OD1 CG OD2 improper_O_C_X_Y
+ -C CA N H improper_Z_N_X_Y
+ CA +N C O improper_O_C_X_Y
+ CB OD1 CG OD2 improper_O_C_X_Y
[ ASPH ]
[ atoms ]
- N opls_238 -0.500 0
- H opls_241 0.300 0
- CA opls_224B 0.140 1
- HA opls_140 0.060 1
+ N opls_238 -0.500 0
+ H opls_241 0.300 0
+ CA opls_224B 0.140 1
+ HA opls_140 0.060 1
CB opls_136 -0.120 2
HB1 opls_140 0.060 2
HB2 opls_140 0.060 2
N CA CB CG dih_GLN_chi1_N_C_C_C
CG CB CA C dih_GLN_chi1_C_C_C_CO
CB CG CD NE2 dih_GLN_chi3_C_C_CO_N
- CG CD OE1 HE1 dih_GLN_chi4_C_C_O_H
+ CG CD OE1 HE1 dih_GLN_chi4_C_C_O_H
[ impropers ]
- -C CA N H improper_Z_N_X_Y
- CA +N C O improper_O_C_X_Y
- CG NE2 CD OE1 improper_O_C_X_Y
- CD HE21 NE2 HE22 improper_Z_N_X_Y
- HE1 OE1 CD NE2 improper_O_C_X_Y
+ -C CA N H improper_Z_N_X_Y
+ CA +N C O improper_O_C_X_Y
+ CG NE2 CD OE1 improper_O_C_X_Y
+ CD HE21 NE2 HE22 improper_Z_N_X_Y
+ HE1 OE1 CD NE2 improper_O_C_X_Y
[ GLU ]
CG CB CA C dih_HIS_chi1_C_C_C_CO
CA CB CG ND1 dih_HIS_chi2_C_C_C_N
[ impropers ]
- -C CA N H improper_Z_N_X_Y
- CA +N C O improper_O_C_X_Y
- ND1 CD2 CG CB improper_Z_CA_X_Y
- CG CE1 ND1 HD1 improper_Z_N_X_Y
- CG NE2 CD2 HD2 improper_Z_CA_X_Y
- ND1 NE2 CE1 HE1 improper_Z_CA_X_Y
+ -C CA N H improper_Z_N_X_Y
+ CA +N C O improper_O_C_X_Y
+ ND1 CD2 CG CB improper_Z_CA_X_Y
+ CG CE1 ND1 HD1 improper_Z_N_X_Y
+ CG NE2 CD2 HD2 improper_Z_CA_X_Y
+ ND1 NE2 CE1 HE1 improper_Z_CA_X_Y
-[ HISE ]
+[ HISE ]
[ atoms ]
N opls_238 -0.500 1
H opls_241 0.300 1
CA opls_224B 0.140 1
HA opls_140 0.060 1
CB opls_505 -0.005 2
- HB1 opls_140 0.060 2
- HB2 opls_140 0.060 2
+ HB1 opls_140 0.060 2
+ HB2 opls_140 0.060 2
CG opls_507 -0.015 3
ND1 opls_511 -0.490 3
CD2 opls_508 0.015 4
- HD2 opls_146 0.115 4
- CE1 opls_506 0.182 5
+ HD2 opls_146 0.115 4
+ CE1 opls_506 0.295 5
HE1 opls_146 0.115 5
NE2 opls_503 -0.570 6
HE2 opls_504 0.420 6
CH3 HH33
-C N
[ impropers ]
- -C CH3 N H improper_Z_N_X_Y
-
+ -C CH3 N H improper_Z_N_X_Y
+
[ NH2 ]
[ atoms ]
- N opls_237 -0.760 1
+ N opls_237 -0.760 1
H1 opls_240 0.380 1
H2 opls_240 0.380 1
[ bonds ]
-C N
- N H1
+ N H1
N H2
[ impropers ]
- -C H1 N H2 improper_Z_N_X_Y
+ -C H1 N H2 improper_Z_N_X_Y
-[ NHE ]
+[ NHE ]
; same as NH2
[ atoms ]
- N opls_237 -0.760 1
+ N opls_237 -0.760 1
H1 opls_240 0.380 1
H2 opls_240 0.380 1
[ bonds ]
-C N
- N H1
+ N H1
N H2
[ impropers ]
- -C H1 N H2 improper_Z_N_X_Y
-
+ -C H1 N H2 improper_Z_N_X_Y
+
[ PHE ]
[ atoms ]
N opls_238 -0.500 1
C O
-C N
[ impropers ]
- -C CA N H improper_Z_N_X_Y
- CA +N C O improper_O_C_X_Y
- CG CE2 CD2 HD2 improper_Z_CA_X_Y
- CD2 CZ CE2 HE2 improper_Z_CA_X_Y
- CD1 CZ CE1 HE1 improper_Z_CA_X_Y
- CG CE1 CD1 HD1 improper_Z_CA_X_Y
- CD1 CD2 CG CB improper_Z_CA_X_Y
- CE1 CE2 CZ OH improper_Z_CA_X_Y
+ -C CA N H improper_Z_N_X_Y
+ CA +N C O improper_O_C_X_Y
+ CG CE2 CD2 HD2 improper_Z_CA_X_Y
+ CD2 CZ CE2 HE2 improper_Z_CA_X_Y
+ CD1 CZ CE1 HE1 improper_Z_CA_X_Y
+ CG CE1 CD1 HD1 improper_Z_CA_X_Y
+ CD1 CD2 CG CB improper_Z_CA_X_Y
+ CE1 CE2 CZ OH improper_Z_CA_X_Y
[ VAL ]
H opls_241 0.300 1
CA opls_224B 0.140 1
HA opls_140 0.060 1
- CB opls_137 -0.060 2
+ CB opls_137 -0.060 2
HB opls_140 0.060 2
CG1 opls_135 -0.180 3
HG11 opls_140 0.060 3
; Use at your own risk!
[ DMSO ]
[ atoms ]
-OD opls_125 -0.459 1
-SD opls_124 0.139 1
-CD1 opls_139 -0.020 1
-HD11 opls_140 0.060 1
-HD12 opls_140 0.060 1
-HD13 opls_140 0.060 1
-CD2 opls_139 -0.020 1
-HD21 opls_140 0.060 1
-HD22 opls_140 0.060 1
-HD23 opls_140 0.060 1
+OD opls_125 -0.459 1
+SD opls_124 0.139 1
+CD1 opls_139 -0.020 1
+HD11 opls_140 0.060 1
+HD12 opls_140 0.060 1
+HD13 opls_140 0.060 1
+CD2 opls_139 -0.020 1
+HD21 opls_140 0.060 1
+HD22 opls_140 0.060 1
+HD23 opls_140 0.060 1
[ bonds ]
- OD SD
- SD CD1
- SD CD2
+ OD SD
+ SD CD1
+ SD CD2
CD1 HD11
- CD1 HD12
- CD1 HD13
- CD2 HD21
- CD2 HD22
- CD2 HD23
+ CD1 HD12
+ CD1 HD13
+ CD2 HD21
+ CD2 HD22
+ CD2 HD23
public:
//! \copydoc gmx::CommandLineModuleManager::CMainFunction
typedef CommandLineModuleManager::CMainFunction CMainFunction;
+ //! \copydoc gmx::CommandLineModuleManager::InitSettingsFunction
+ typedef CommandLineModuleManager::InitSettingsFunction InitSettingsFunction;
/*! \brief
* Creates a wrapper module for the given main function.
* \param[in] name Name for the module.
* \param[in] shortDescription One-line description for the module.
* \param[in] mainFunction Main function to wrap.
+ * \param[in] settingsFunction Initializer for settings (can be null).
*
* Does not throw. This is essential for correct implementation of
* CommandLineModuleManager::runAsMainCMain().
*/
CMainCommandLineModule(const char *name, const char *shortDescription,
- CMainFunction mainFunction)
+ CMainFunction mainFunction,
+ InitSettingsFunction settingsFunction)
: name_(name), shortDescription_(shortDescription),
- mainFunction_(mainFunction)
+ mainFunction_(mainFunction), settingsFunction_(settingsFunction)
{
}
return shortDescription_;
}
- virtual void init(CommandLineModuleSettings * /*settings*/)
+ virtual void init(CommandLineModuleSettings *settings)
{
+ if (settingsFunction_ != nullptr)
+ {
+ settingsFunction_(settings);
+ }
}
virtual int run(int argc, char *argv[])
{
const char *name_;
const char *shortDescription_;
CMainFunction mainFunction_;
+ InitSettingsFunction settingsFunction_;
};
//! \}
CMainFunction mainFunction)
{
CommandLineModulePointer module(
- new CMainCommandLineModule(name, shortDescription, mainFunction));
+ new CMainCommandLineModule(name, shortDescription, mainFunction,
+ nullptr));
+ addModule(std::move(module));
+}
+
+void CommandLineModuleManager::addModuleCMainWithSettings(
+ const char *name, const char *shortDescription,
+ CMainFunction mainFunction, InitSettingsFunction settingsFunction)
+{
+ CommandLineModulePointer module(
+ new CMainCommandLineModule(name, shortDescription, mainFunction,
+ settingsFunction));
addModule(std::move(module));
}
int CommandLineModuleManager::runAsMainCMain(
int argc, char *argv[], CMainFunction mainFunction)
{
- CMainCommandLineModule module(argv[0], NULL, mainFunction);
+ CMainCommandLineModule module(argv[0], nullptr, mainFunction, nullptr);
+ return runAsMainSingleModule(argc, argv, &module);
+}
+
+// static
+int CommandLineModuleManager::runAsMainCMainWithSettings(
+ int argc, char *argv[], CMainFunction mainFunction,
+ InitSettingsFunction settingsFunction)
+{
+ CMainCommandLineModule module(argv[0], nullptr, mainFunction, settingsFunction);
return runAsMainSingleModule(argc, argv, &module);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016, 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.
class CommandLineModuleGroup;
class CommandLineModuleGroupData;
+class CommandLineModuleSettings;
class CommandLineProgramContext;
class ICommandLineModule;
class IFileOutputRedirector;
public:
//! Function pointer type for a C main function.
typedef int (*CMainFunction)(int argc, char *argv[]);
+ //! Function pointer to a settings provider.
+ typedef void (*InitSettingsFunction)(CommandLineModuleSettings *settings);
/*! \brief
* Implements a main() method that runs a single module.
*/
static int runAsMainCMain(int argc, char *argv[],
CMainFunction mainFunction);
+ /*! \brief
+ * Implements a main() method that runs a given function with custom
+ * settings.
+ *
+ * This method does the same as runAsMainCMain(), but additionally
+ * calls \p settingsFunction to initialize CommandLineModuleSettings.
+ * This allows specifying, e.g., a different default nice level.
+ */
+ static int runAsMainCMainWithSettings(int argc, char *argv[],
+ CMainFunction mainFunction,
+ InitSettingsFunction settingsFunction);
/*! \brief
* Initializes a command-line module manager.
*/
void addModuleCMain(const char *name, const char *shortDescription,
CMainFunction mainFunction);
+ /*! \brief
+ * Adds a module that runs a given main()-like function with custom
+ * settings.
+ *
+ * This method does the same as runAsMainCMain(), but additionally
+ * calls \p settingsFunction to initialize CommandLineModuleSettings.
+ * This allows specifying, e.g., a different default nice level.
+ */
+ void addModuleCMainWithSettings(const char *name, const char *shortDescription,
+ CMainFunction mainFunction,
+ InitSettingsFunction settingsFunction);
/*! \brief
* Registers a module of a certain type to this manager.
*
gmx_domdec_comm_t *comm = dd->comm;
if (comm->bCartesianPP_PME)
{
- int pmenode = dd_simnode2pmenode(dd, cr, cr->sim_nodeid);
#if GMX_MPI
+ int pmenode = dd_simnode2pmenode(dd, cr, cr->sim_nodeid);
ivec coords;
MPI_Cart_coords(cr->mpi_comm_mysim, cr->sim_nodeid, DIM, coords);
coords[comm->cartpmedim]++;
bReceive = FALSE;
}
}
+#else
+ GMX_RELEASE_ASSERT(false, "Without MPI we should not have Cartesian PP-PME with #PMEnodes < #DDnodes");
#endif
}
else
}
}
-static void receive_ddindex2simnodeid(gmx_domdec_t gmx_unused *dd,
- t_commrec gmx_unused *cr)
+static void receive_ddindex2simnodeid(gmx_domdec_t *dd,
+ t_commrec *cr)
{
#if GMX_MPI
gmx_domdec_comm_t *comm = dd->comm;
cr->mpi_comm_mysim);
sfree(buf);
}
+#else
+ GMX_UNUSED_VALUE(dd);
+ GMX_UNUSED_VALUE(cr);
#endif
}
{
int pull_type; //!< such as constraint, umbrella, ...
int geometry; //!< such as distance, direction, cylinder
+ int ngroup; //!< the number of pull groups involved
ivec dim; //!< pull dimension with geometry distance
int ndim; //!< nr of pull_dim != 0
real k; //!< force constants in tpr file
/*!\{*/
int npullcrds; //!< nr of umbrella pull coordinates for reading
t_pullcoord *pcrd; //!< the pull coordinates
+ gmx_bool bPrintCOM; //!< COMs of pull groups writtn in pullx.xvg
gmx_bool bPrintRefValue; //!< Reference value for the coordinate written in pullx.xvg
gmx_bool bPrintComp; //!< Components of pull distance written to pullx.xvg ?
- int nCOMGrpsPullx; //!< Number of grps of which the COM is listed in pullx.xvg (COM of grp 1 or grp 2 or both)
/*!\}*/
/*!
}
/* Read overall pull info */
- header->npullcrds = ir->pull->ncoord;
- header->nCOMGrpsPullx = 0;
- if (ir->pull->bPrintCOM)
- {
- header->nCOMGrpsPullx += ir->pull->ngroup;
- }
+ header->npullcrds = ir->pull->ncoord;
+ header->bPrintCOM = ir->pull->bPrintCOM;
header->bPrintRefValue = ir->pull->bPrintRefValue;
header->bPrintComp = ir->pull->bPrintComp;
{
header->pcrd[i].pull_type = ir->pull->coord[i].eType;
header->pcrd[i].geometry = ir->pull->coord[i].eGeom;
+ header->pcrd[i].ngroup = ir->pull->coord[i].ngroup;
header->pcrd[i].k = ir->pull->coord[i].k;
header->pcrd[i].init_dist = ir->pull->coord[i].init;
epullg_names[header->pcrd[i].geometry], header->pcrd[i].k, header->pcrd[i].init_dist,
int2YN(header->pcrd[i].dim[XX]), int2YN(header->pcrd[i].dim[YY]), int2YN(header->pcrd[i].dim[ZZ]),
header->pcrd[i].ndim, use ? "Yes" : "No");
- }
- switch (header->nCOMGrpsPullx)
- {
- case 0:
- printf("\tNo pull group coordinates expected in pullx files.\n");
- break;
- case 1:
- printf("\tPull group coordinates of one group expected in pullx files.\n");
- break;
- case 2:
- printf("\tPull group coordinates of two groups expected in pullx files.\n");
- break;
+ printf("\tPull group coordinates of %d groups expected in pullx files.\n", ir->pull->bPrintCOM ? header->pcrd[i].ngroup : 0);
}
printf("\tReference value of the coordinate%s expected in pullx files.\n",
header->bPrintRefValue ? "" : " not");
* No reference columns, one column per pull coordinate
*
* - in position output pullx.xvg:
- * * optionally, ndim columns for COM of of grp1 or grp2, depending on on mdp options
- * pull-print-com1 & pull-print-com2);
+ * * optionally, ndim columns for COMs of all groups (depending on on mdp options pull-print-com);
* * The displacement, always one column. Note: with pull-print-components = yes, the dx/dy/dz would
* be written separately into pullx file, but this is not supported and throws an error below;
* * optionally, the position of the reference coordinate (depending on pull-print-ref-value)
for (g = 0; g < header->npullcrds; g++)
{
nColRefCrd[g] = (header->bPrintRefValue ? 1 : 0);
- nColCOMCrd[g] = header->pcrd[g].ndim*header->nCOMGrpsPullx;
+ nColCOMCrd[g] = (header->bPrintCOM ? header->pcrd[g].ndim*header->pcrd[g].ngroup : 0);
nColThisCrd[g] = 1 + nColCOMCrd[g] + nColRefCrd[g];
}
}
for (i = 0; i < header->npullcrds; i++)
{
printf("\tColumns for pull coordinate %d\n", i+1);
- printf("\t\tcenter-of-mass of groups: %d\n"
- "\t\tdisplacement wrt. reference: %d\n"
+ printf("\t\treaction coordinate: %d\n"
+ "\t\tcenter-of-mass of groups: %d\n"
"\t\treference position column: %s\n",
- nColCOMCrd[i], 1, (header->bPrintRefValue ? "Yes" : "No"));
+ 1, nColCOMCrd[i], (header->bPrintRefValue ? "Yes" : "No"));
}
printf("\tFound %d times in %s\n", nt, fn);
bFirst = FALSE;
{
column += nColThisCrd[j];
}
- column += nColCOMCrd[g];
pos = y[column][i];
}
for (int i = 0; i < npoints; i++)
{
- float r = -1.0 + 2.0 * (float(i) + 0.5) / npoints;
+ float r = float(2*i - npoints + 1) / npoints;
result.push_back(gmx::erfinv(r));
}
for (int i = 0; i < npoints; i++)
{
- double r = -1.0 + 2.0 * (double(i) + 0.5) / npoints;
+ double r = double(2*i - npoints + 1) / npoints;
result.push_back(gmx::erfinv(r));
}
for (int i = 0; i < npoints; i++)
{
- float r = -1.0 + 2.0 * (float(i) + 0.5) / npoints;
+ float r = float(2*i - npoints + 1) / npoints;
EXPECT_FLOAT_EQ_TOL(r, std::erf(gmx::erfinv(r)), gmx::test::ulpTolerance(10));
}
}
for (int i = 0; i < npoints; i++)
{
- double r = -1.0 + 2.0 * (double(i) + 0.5) / npoints;
+ double r = double(2*i - npoints + 1) / npoints;
EXPECT_DOUBLE_EQ_TOL(r, std::erf(gmx::erfinv(r)), gmx::test::ulpTolerance(10));
}
}
* - The 1D block-grid contains as many blocks as super-clusters.
*/
int num_threads_z = 1;
- if ((nb->dev_info->prop.major == 3 && nb->dev_info->prop.minor == 7) ||
- (nb->dev_info->prop.major == 6 && nb->dev_info->prop.minor == 0))
+ if (nb->dev_info->prop.major == 3 && nb->dev_info->prop.minor == 7)
{
num_threads_z = 2;
}
* NTHREAD_Z controls the number of j-clusters processed concurrently on NTHREAD_Z
* warp-pairs per block.
*
- * - On CC 2.0-3.5, 5.0, and 5.2, NTHREAD_Z == 1, translating to 64 th/block with 16
- * blocks/multiproc, is the fastest even though this setup gives low occupancy.
+ * - On CC 2.0-3.5, and >=5.0 NTHREAD_Z == 1, translating to 64 th/block with 16
+ * blocks/multiproc, is the fastest even though this setup gives low occupancy
+ * (except on 6.0).
* NTHREAD_Z > 1 results in excessive register spilling unless the minimum blocks
* per multiprocessor is reduced proportionally to get the original number of max
* threads in flight (and slightly lower performance).
- * - On CC 3.7 and 6.0 there are enough registers to double the number of threads; using
+ * - On CC 3.7 there are enough registers to double the number of threads; using
* NTHREADS_Z == 2 is fastest with 16 blocks (TODO: test with RF and other kernels
* with low-register use).
*
/* Kernel launch bounds for different compute capabilities. The value of NTHREAD_Z
* determines the number of threads per block and it is chosen such that
* 16 blocks/multiprocessor can be kept in flight.
- * - CC 3.0/3.5/5.x, >=6.1: NTHREAD_Z=1, (64, 16) bounds
- * - CC 3.7, 6.0: NTHREAD_Z=2, (128, 16) bounds
+ * - CC 3.0,3.5, and >=5.0: NTHREAD_Z=1, (64, 16) bounds
+ * - CC 3.7: NTHREAD_Z=2, (128, 16) bounds
*
* Note: convenience macros, need to be undef-ed at the end of the file.
*/
-#if GMX_PTX_ARCH == 370 || GMX_PTX_ARCH == 600
+#if GMX_PTX_ARCH == 370
#define NTHREAD_Z (2)
#define MIN_BLOCKS_PER_MP (16)
#else
#define NTHREAD_Z (1)
#define MIN_BLOCKS_PER_MP (16)
-#endif /* GMX_PTX_ARCH == 370 || GMX_PTX_ARCH == 600 */
+#endif /* GMX_PTX_ARCH == 370 */
#define THREADS_PER_BLOCK (c_clSize*c_clSize*NTHREAD_Z)
#if GMX_PTX_ARCH >= 350
}
return new Impl(handle);
}
- explicit Impl(DIR *handle) : dirent_handle(handle)
- {
- // TODO: Use memory allocation that throws, and handle
- // exception safety (close handle) in such a case.
- /* On some platforms no space is present for d_name in dirent.
- * Since d_name is guaranteed to be the last entry, allocating
- * extra space for dirent will allow more size for d_name.
- * GMX_MAX_PATH should always be >= the max possible d_name.
- */
- smalloc(direntp_large, sizeof(*direntp_large) + GMX_PATH_MAX);
- }
+ explicit Impl(DIR *handle) : dirent_handle(handle) {}
~Impl()
{
- sfree(direntp_large);
closedir(dirent_handle);
}
bool nextFile(std::string *filename)
{
errno = 0;
- dirent *p;
- int rc = readdir_r(dirent_handle, direntp_large, &p);
- if (p == NULL && rc == 0)
- {
- filename->clear();
- return false;
- }
- else if (rc != 0)
+ dirent *p = readdir(dirent_handle);
+ if (p == NULL)
{
- GMX_THROW_WITH_ERRNO(
- FileIOError("Failed to list files in a directory"),
- "readdir_r", errno);
+ if (errno == 0)
+ {
+ // All the files have been found.
+ filename->clear();
+ return false;
+ }
+ else
+ {
+ GMX_THROW_WITH_ERRNO(
+ FileIOError("Failed to list files in a directory"),
+ "readdir", errno);
+ }
}
- *filename = direntp_large->d_name;
+ *filename = p->d_name;
return true;
}
private:
DIR *dirent_handle;
- dirent *direntp_large;
};
#else
class DirectoryEnumerator::Impl
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016, 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.
/*! \libinternal \brief
* Lists files in a directory.
*
+ * If multiple threads share the same DirectoryEnumerator, they must
+ * take responsibility for their mutual synchronization, particularly
+ * with regard to calling nextFile().
+ *
* \inlibraryapi
* \ingroup module_utility
*/
* If `bThrow` passed to the constructor was `false` and the directory
* was not successfully opened, the first call to this function will
* return `false`.
+ *
+ * This method is not thread safe when called on the same
+ * object by multiple threads. Such use requires external
+ * synchronization.
*/
bool nextFile(std::string *filename);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016, 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.
const char *name_;
};
-// TODO: Consider removing duplication with CMainCommandLineModule from
-// cmdlinemodulemanager.cpp.
-class NoNiceModule : public gmx::ICommandLineModule
+//! Initializer for a module that defaults to nice level zero.
+void initSettingsNoNice(gmx::CommandLineModuleSettings *settings)
{
- public:
- //! \copydoc gmx::CommandLineModuleManager::CMainFunction
- typedef gmx::CommandLineModuleManager::CMainFunction CMainFunction;
-
- /*! \brief
- * Creates a wrapper module for the given main function.
- *
- * \param[in] name Name for the module.
- * \param[in] shortDescription One-line description for the module.
- * \param[in] mainFunction Main function to wrap.
- *
- * Does not throw.
- */
- NoNiceModule(const char *name, const char *shortDescription,
- CMainFunction mainFunction)
- : name_(name), shortDescription_(shortDescription),
- mainFunction_(mainFunction)
- {
- }
-
- virtual const char *name() const
- {
- return name_;
- }
- virtual const char *shortDescription() const
- {
- return shortDescription_;
- }
-
- virtual void init(gmx::CommandLineModuleSettings *settings)
- {
- settings->setDefaultNiceLevel(0);
- }
- virtual int run(int argc, char *argv[])
- {
- return mainFunction_(argc, argv);
- }
- virtual void writeHelp(const gmx::CommandLineHelpContext &context) const
- {
- writeCommandLineHelpCMain(context, name_, mainFunction_);
- }
-
- private:
- const char *name_;
- const char *shortDescription_;
- CMainFunction mainFunction_;
-};
+ settings->setDefaultNiceLevel(0);
+}
/*! \brief
* Convenience function for creating and registering a module.
gmx::CommandLineModuleManager::CMainFunction mainFunction,
const char *name, const char *shortDescription)
{
- gmx::CommandLineModulePointer module(
- new NoNiceModule(name, shortDescription, mainFunction));
- manager->addModule(std::move(module));
+ manager->addModuleCMainWithSettings(name, shortDescription, mainFunction,
+ &initSettingsNoNice);
}
/*! \brief
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2016, 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.
*/
#include "gmxpre.h"
+#include "gromacs/commandline/cmdlinemodule.h"
#include "gromacs/commandline/cmdlinemodulemanager.h"
#include "mdrun/mdrun_main.h"
+namespace
+{
+
+//! Initializer for a module that defaults to nice level zero.
+void initSettingsNoNice(gmx::CommandLineModuleSettings *settings)
+{
+ settings->setDefaultNiceLevel(0);
+}
+
+}
+
int main(int argc, char *argv[])
{
- return gmx::CommandLineModuleManager::runAsMainCMain(argc, argv, &gmx_mdrun);
+ return gmx::CommandLineModuleManager::runAsMainCMainWithSettings(
+ argc, argv, &gmx_mdrun, &initSettingsNoNice);
}