Merge release-5-0 into master
[alexxy/gromacs.git] / src / gromacs / legacyheaders / domdec.h
index 6bb20fb1d3e9897637499bba806655f248449fba..c44c7bf8406784fdd4ee17326d357a3266c521d4 100644 (file)
@@ -1,28 +1,45 @@
-/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
+/*
+ * This file is part of the GROMACS molecular simulation package.
  *
+ * Copyright (c) 2005,2006,2007,2008,2009,2010,2012,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.
  *
- * This file is part of Gromacs        Copyright (c) 1991-2008
- * David van der Spoel, Erik Lindahl, Berk Hess, University of Groningen.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
+ * 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.
  *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the research papers on the package. Check out http://www.gromacs.org
+ * 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.
  *
- * And Hey:
- * Gnomes, ROck Monsters And Chili Sauce
+ * 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.
  */
 
 #ifndef _domdec_h
 #define _domdec_h
 
-#include "typedefs.h"
-#include "types/commrec.h"
-#include "vsite.h"
-#include "genborn.h"
+#include "gromacs/legacyheaders/genborn.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/vsite.h"
+#include "gromacs/timing/wallcycle.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -94,7 +111,7 @@ init_domain_decomposition(FILE *fplog,
 
 void dd_init_bondeds(FILE *fplog,
                      gmx_domdec_t *dd, gmx_mtop_t *mtop,
-                     gmx_vsite_t *vsite, gmx_constr_t constr,
+                     gmx_vsite_t *vsite,
                      t_inputrec *ir, gmx_bool bBCheck, cginfo_mb_t *cginfo_mb);
 /* Initialize data structures for bonded interactions */
 
@@ -102,7 +119,7 @@ gmx_bool dd_bonded_molpbc(gmx_domdec_t *dd, int ePBC);
 /* Returns if we need to do pbc for calculating bonded interactions */
 
 void set_dd_parameters(FILE *fplog, gmx_domdec_t *dd, real dlb_scale,
-                       t_inputrec *ir, t_forcerec *fr,
+                       t_inputrec *ir,
                        gmx_ddbox_t *ddbox);
 /* Set DD grid dimensions and limits,
  * should be called after calling dd_init_bondeds.
@@ -122,6 +139,21 @@ void change_dd_dlb_cutoff_limit(t_commrec *cr);
  * possible after subsequently setting a shorter cut-off with change_dd_cutoff.
  */
 
+gmx_bool dd_dlb_is_locked(const gmx_domdec_t *dd);
+/* Return if the DLB lock is set */
+
+void dd_dlb_set_lock(gmx_domdec_t *dd, gmx_bool bValue);
+/* Set a lock such that with DLB=auto DLB can (not) get turned on */
+
+void dd_setup_dlb_resource_sharing(t_commrec           *cr,
+                                   const gmx_hw_info_t *hwinfo,
+                                   const gmx_hw_opt_t  *hw_opt);
+/* When domains (PP MPI ranks) share a GPU, the individual GPU wait times
+ * are meaningless, as it depends on the order in which tasks on the same
+ * GPU finish. Therefore there wait times need to be averaged over the ranks
+ * sharing the same GPU. This function sets up the communication for that.
+ */
+
 void setup_dd_grid(FILE *fplog, gmx_domdec_t *dd);
 
 void dd_collect_vec(gmx_domdec_t *dd,
@@ -131,7 +163,7 @@ void dd_collect_state(gmx_domdec_t *dd,
                       t_state *state_local, t_state *state);
 
 enum {
-    ddCyclStep, ddCyclPPduringPME, ddCyclF, ddCyclPME, ddCyclNr
+    ddCyclStep, ddCyclPPduringPME, ddCyclF, ddCyclWaitGPU, ddCyclPME, ddCyclNr
 };
 
 void dd_cycles_add(gmx_domdec_t *dd, float cycles, int ddCycl);
@@ -164,7 +196,7 @@ void dd_atom_sum_real(gmx_domdec_t *dd, real v[]);
 /* Sum the contributions to a real for each atom over the neighboring cells. */
 
 void dd_partition_system(FILE                *fplog,
-                         gmx_large_int_t      step,
+                         gmx_int64_t          step,
                          t_commrec           *cr,
                          gmx_bool             bMasterState,
                          int                  nstglobalcomm,
@@ -201,8 +233,8 @@ void dd_move_f_vsites(gmx_domdec_t *dd, rvec *f, rvec *fshift);
 void dd_clear_f_vsites(gmx_domdec_t *dd, rvec *f);
 
 void dd_move_x_constraints(gmx_domdec_t *dd, matrix box,
-                           rvec *x0, rvec *x1);
-/* Move x0 and also x1 if x1!=NULL */
+                           rvec *x0, rvec *x1, gmx_bool bX1IsCoord);
+/* Move x0 and also x1 if x1!=NULL. bX1IsCoord tells if to do PBC on x1 */
 
 void dd_move_x_vsites(gmx_domdec_t *dd, matrix box, rvec *x);
 
@@ -221,8 +253,7 @@ int dd_make_local_constraints(gmx_domdec_t *dd, int at_start,
                               t_ilist *il_local);
 
 void init_domdec_constraints(gmx_domdec_t *dd,
-                             gmx_mtop_t   *mtop,
-                             gmx_constr_t  constr);
+                             gmx_mtop_t   *mtop);
 
 void init_domdec_vsites(gmx_domdec_t *dd, int n_intercg_vsite);
 
@@ -234,13 +265,12 @@ void dd_print_missing_interactions(FILE *fplog, t_commrec *cr,
 
 void dd_make_reverse_top(FILE *fplog,
                          gmx_domdec_t *dd, gmx_mtop_t *mtop,
-                         gmx_vsite_t *vsite, gmx_constr_t constr,
+                         gmx_vsite_t *vsite,
                          t_inputrec *ir, gmx_bool bBCheck);
 
 void dd_make_local_cgs(gmx_domdec_t *dd, t_block *lcgs);
 
-void dd_make_local_top(FILE *fplog,
-                       gmx_domdec_t *dd, gmx_domdec_zones_t *zones,
+void dd_make_local_top(gmx_domdec_t *dd, gmx_domdec_zones_t *zones,
                        int npbcdim, matrix box,
                        rvec cellsize_min, ivec npulse,
                        t_forcerec *fr,
@@ -260,13 +290,12 @@ void dd_init_local_state(gmx_domdec_t *dd,
 t_blocka *make_charge_group_links(gmx_mtop_t *mtop, gmx_domdec_t *dd,
                                   cginfo_mb_t *cginfo_mb);
 
-void dd_bonded_cg_distance(FILE *fplog,
-                           gmx_domdec_t *dd, gmx_mtop_t *mtop,
+void dd_bonded_cg_distance(FILE *fplog, gmx_mtop_t *mtop,
                            t_inputrec *ir, rvec *x, matrix box,
                            gmx_bool bBCheck,
                            real *r_2b, real *r_mb);
 
-void write_dd_pdb(const char *fn, gmx_large_int_t step, const char *title,
+void write_dd_pdb(const char *fn, gmx_int64_t step, const char *title,
                   gmx_mtop_t *mtop,
                   t_commrec *cr,
                   int natoms, rvec x[], matrix box);
@@ -285,7 +314,7 @@ real dd_choose_grid(FILE *fplog,
                     gmx_mtop_t *mtop, matrix box, gmx_ddbox_t *ddbox,
                     gmx_bool bDynLoadBal, real dlb_scale,
                     real cellsize_limit, real cutoff_dd,
-                    gmx_bool bInterCGBondeds, gmx_bool bInterCGMultiBody);
+                    gmx_bool bInterCGBondeds);
 /* Determines the optimal DD cell setup dd->nc and possibly npmenodes
  * for the system.
  * On the master node returns the actual cellsize limit used.