Skip to content
Permalink
Browse files

Merge #3141

3141: Remove debug macros r=RudolfWeeber a=jngrad

Fixes partially #3095

Remove debug macros in the integration loop, thermostat, halo, cell system and ghost manager that are preventing further refactoring of the core. Some debug messages were converted to comments. The code was also cleaned up, mostly to limit the scope of intermediate variables, make pointers const and change integer flags to the bool type.

Co-authored-by: Jean-Noël Grad <jgrad@icp.uni-stuttgart.de>
  • Loading branch information...
bors and jngrad committed Sep 10, 2019
2 parents 87905ae + 6940b73 commit 7161bad4055f5356570c8ebdac0229d8fdf92965
Showing with 295 additions and 1,175 deletions.
  1. +0 −19 doc/sphinx/installation.rst
  2. +0 −7 maintainer/configs/nocheck-maxset.hpp
  3. +0 −8 src/config/features.def
  4. +2 −11 src/core/cells.cpp
  5. +1 −1 src/core/cells.hpp
  6. +2 −3 src/core/collision.cpp
  7. +0 −3 src/core/collision.hpp
  8. +4 −17 src/core/communication.cpp
  9. +6 −7 src/core/communication.hpp
  10. +32 −55 src/core/debug.cpp
  11. +0 −47 src/core/debug.hpp
  12. +2 −25 src/core/domain_decomposition.cpp
  13. +9 −10 src/core/electrostatics_magnetostatics/coulomb.cpp
  14. +9 −9 src/core/electrostatics_magnetostatics/dipole.cpp
  15. +9 −22 src/core/electrostatics_magnetostatics/elc.cpp
  16. +3 −3 src/core/electrostatics_magnetostatics/magnetic_non_p3m_methods.cpp
  17. +4 −3 src/core/electrostatics_magnetostatics/magnetic_non_p3m_methods.hpp
  18. +0 −1 src/core/electrostatics_magnetostatics/mdlc_correction.cpp
  19. +32 −31 src/core/electrostatics_magnetostatics/mmm2d.cpp
  20. +3 −3 src/core/electrostatics_magnetostatics/mmm2d.hpp
  21. +0 −38 src/core/electrostatics_magnetostatics/p3m-common.cpp
  22. +0 −10 src/core/electrostatics_magnetostatics/p3m-common.hpp
  23. +11 −153 src/core/electrostatics_magnetostatics/p3m-dipolar.cpp
  24. +1 −1 src/core/electrostatics_magnetostatics/p3m-dipolar.hpp
  25. +13 −167 src/core/electrostatics_magnetostatics/p3m.cpp
  26. +1 −2 src/core/electrostatics_magnetostatics/p3m.hpp
  27. +23 −42 src/core/event.cpp
  28. +3 −2 src/core/event.hpp
  29. +1 −1 src/core/forces.cpp
  30. +36 −115 src/core/ghosts.cpp
  31. +1 −1 src/core/global.hpp
  32. +0 −1 src/core/grid.cpp
  33. +22 −74 src/core/grid_based_algorithms/halo.cpp
  34. +1 −1 src/core/grid_based_algorithms/halo.hpp
  35. +3 −3 src/core/grid_based_algorithms/lb_boundaries.cpp
  36. +1 −1 src/core/integrate.cpp
  37. +2 −2 src/core/integrate.hpp
  38. +0 −49 src/core/io/reader/readpdb.cpp
  39. +0 −54 src/core/io/writer/h5md_core.cpp
  40. +10 −71 src/core/layered.cpp
  41. +8 −8 src/core/metadynamics.cpp
  42. +0 −6 src/core/nsquare.cpp
  43. +0 −1 src/core/polymer.cpp
  44. +0 −1 src/core/pressure_inline.hpp
  45. +2 −3 src/core/random.cpp
  46. +1 −1 src/core/short_range_loop.hpp
  47. +17 −52 src/core/thermostat.cpp
  48. +15 −23 src/core/thermostat.hpp
  49. +1 −1 src/core/virtual_sites.cpp
  50. +2 −2 src/python/espressomd/integrate.pxd
  51. +2 −4 src/utils/include/utils/constants.hpp
@@ -548,23 +548,6 @@ The following flags control the debug output of various sections of
|es|. You will however understand the output very often only by
looking directly at the code.
- ``COMM_DEBUG`` Output from the asynchronous communication code.
- ``EVENT_DEBUG`` Notifications for event calls, i.e. the ``on_...`` functions in
``initialize.c``. Useful if some module does not correctly respond to
changes of e.g. global variables.
- ``CELL_DEBUG`` Cellsystem output.
- ``GHOST_DEBUG`` Cellsystem output specific to the handling of ghost cells and the
ghost cell communication.
- ``HALO_DEBUG``
- ``P3M_DEBUG``
- ``THERMO_DEBUG`` Output from the thermostats.
- ``VIRTUAL_SITES_DEBUG``
- ``ASYNC_BARRIER`` Introduce a barrier after each asynchronous command completion. Helps
@@ -576,8 +559,6 @@ looking directly at the code.
- ``CUDA_DEBUG``
- ``H5MD_DEBUG``
@@ -66,13 +66,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define EXPERIMENTAL_FEATURES

// DEBUG Switches
#define COMM_DEBUG
#define EVENT_DEBUG
#define CELL_DEBUG
#define GHOST_DEBUG
#define HALO_DEBUG
#define P3M_DEBUG
#define THERMO_DEBUG
#define VIRTUAL_SITES_DEBUG
#ifdef CUDA
#define CUDA_DEBUG
@@ -110,16 +110,8 @@ NO_INTRA_NB notest
/* Debugging */
ADDITIONAL_CHECKS

COMM_DEBUG
EVENT_DEBUG
CELL_DEBUG
GHOST_DEBUG
HALO_DEBUG
P3M_DEBUG
THERMO_DEBUG
VIRTUAL_SITES_DEBUG
CUDA_DEBUG
H5MD_DEBUG


# External switches
@@ -64,7 +64,7 @@ CellStructure cell_structure;
/** On of Cells::Resort, announces the level of resort needed.
*/
unsigned resort_particles = Cells::RESORT_NONE;
int rebuild_verletlist = 1;
bool rebuild_verletlist = true;

CellPList CellStructure::local_cells() const { return ::local_cells; }

@@ -251,9 +251,6 @@ static void invalidate_ghosts() {
void cells_re_init(int new_cs, double range) {
CellPList tmp_local;

CELL_TRACE(fprintf(stderr, "%d: cells_re_init: convert type (%d->%d)\n",
this_node, cell_structure.type, new_cs));

invalidate_ghosts();

topology_release(cell_structure.type);
@@ -285,7 +282,6 @@ void cells_re_init(int new_cs, double range) {
/************************************************************/

void realloc_cells(int size) {
CELL_TRACE(fprintf(stderr, "%d: realloc_cells %d\n", this_node, size));
/* free all memory associated with cells to be deleted. */
for (auto &c : cells) {
c.resize(0);
@@ -367,8 +363,6 @@ ParticleList sort_and_fold_parts(const CellStructure &cs, CellPList cells) {
}

void cells_resort_particles(int global_flag) {
CELL_TRACE(fprintf(stderr, "%d: entering cells_resort_particles %d\n",
this_node, global_flag));

invalidate_ghosts();

@@ -413,14 +407,11 @@ void cells_resort_particles(int global_flag) {
/* Particles are now sorted, but Verlet lists are invalid
and p_old has to be reset. */
resort_particles = Cells::RESORT_NONE;
rebuild_verletlist = 1;
rebuild_verletlist = true;

realloc_particlelist(&displaced_parts, 0);

on_resort_particles(local_cells.particles());

CELL_TRACE(
fprintf(stderr, "%d: leaving cells_resort_particles\n", this_node));
}

/*************************************************/
@@ -205,7 +205,7 @@ extern CellStructure cell_structure;
* the Verlet criterion. Moreover, the Verlet list has to be
* rebuilt.
*/
extern int rebuild_verletlist;
extern bool rebuild_verletlist;

/*@}*/

@@ -233,14 +233,13 @@ bool validate_collision_parameters() {
make_particle_type_exist(collision_params.part_type_after_glueing);
}

recalc_forces = 1;
rebuild_verletlist = 1;
recalc_forces = true;
rebuild_verletlist = true;
on_ghost_flags_change();

return true;
}

//* Allocate memory for the collision queue /
void prepare_local_collision_queue() { local_collision_queue.clear(); }

void queue_collision(const int part1, const int part2) {
@@ -93,9 +93,6 @@ extern Collision_parameters collision_params;
COLLISION_MODE_ERROR|COLLISION_MODE_BOND.
*/
/*@{*/
/** raise a background error on collision, to allow further processing in Tcl.
Can be combined with a bonding mode, if desired
*/

void prepare_local_collision_queue();

@@ -127,27 +127,14 @@ int n_nodes = -1;

// create the forward declarations
#define CB(name) void name(int node, int param);
#ifndef DOXYGEN
/* this conditional on DOXYGEN prevents an interaction in Doxygen between
* CALLBACK_LIST and whatever follows next, e.g. a function "int foo();"
* would otherwise become "CALLBACK_LIST int foo();" */
CALLBACK_LIST

#undef CB

#ifdef DOXYGEN
(void); /* this line prevents an interaction in Doxygen between
CALLBACK_LIST and the anonymous namespace that follows */
#endif

namespace {
#ifdef COMM_DEBUG
// create the list of names
#define CB(name) #name,

/** List of callback names for debugging. */
std::vector<std::string> names{CALLBACK_LIST};
#undef CB
#endif
} // namespace

/** Forward declarations */

int mpi_check_runtime_errors();

@@ -26,7 +26,7 @@
* It is the header file for communication.cpp.
*
* The asynchronous MPI communication is used during the script
* evaluation. Except for the master node that interprets the Tcl
* evaluation. Except for the master node that interprets the interface
* script, all other nodes wait in mpi_loop() for the master node to
* issue an action using mpi_call(). mpi_loop() immediately
* executes an MPI_Bcast and therefore waits for the master node to
@@ -36,18 +36,17 @@
* the action issued. If applicable, the second parameter is the node
* number of the slave this request is dedicated to.
*
* To add new actions (e.g. to implement new Tcl commands), do the
* To add new actions (e.g. to implement new interface functionality), do the
* following:
* - write the mpi_* function that is executed on the master
* - write the mpi_*_slave function
* - write the @c mpi_* function that is executed on the master
* - write the @c mpi_*_slave function
* - Add your slave function to \ref CALLBACK_LIST in communication.cpp
*
* After this your procedure is free to do anything. However, it has
* to be in (MPI) sync with what your new mpi_*_slave does. This
* to be in (MPI) sync with what your new @c mpi_*_slave does. This
* procedure is called immediately after the broadcast with the
* arbitrary integer as parameter. To this aim it has also to be added
* to \ref CALLBACK_LIST. A debug message will be created automatically
* in \ref anonymous_namespace{communication.cpp}::names "names".
* to \ref CALLBACK_LIST.
*/

#include "MpiCallbacks.hpp"

0 comments on commit 7161bad

Please sign in to comment.
You can’t perform that action at this time.