Unverified Commit 4d458af0 authored by Kai Szuttor's avatar Kai Szuttor Committed by GitHub

Merge pull request #2506 from fweik/caliper

Caliper: A Performance Analysis Toolbox in a Library
parents 5994107a 0179267a
Pipeline #5509 failed with stages
in 64 minutes and 10 seconds
......@@ -71,6 +71,7 @@ if( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT APPLE )
endif()
option(WARNINGS_ARE_ERRORS "Treat warnings as errors during compilation" OFF)
option(WITH_CCACHE "Use ccache compiler invocation." OFF)
option(WITH_PROFILER "Enable profiler annotations." OFF)
if(WITH_CCACHE)
find_program(CCACHE ccache)
......
......@@ -80,6 +80,8 @@ endfunction(UNIT_TEST)
add_subdirectory(core)
add_subdirectory(config)
add_subdirectory(profiler)
if(SCAFACOS)
add_subdirectory(scafacos)
endif(SCAFACOS)
......@@ -88,7 +90,6 @@ if(WITH_SCRIPT_INTERFACE)
add_subdirectory(script_interface)
endif()
if(WITH_PYTHON)
add_subdirectory(python)
endif()
......@@ -181,6 +181,7 @@ endif()
target_link_libraries(EspressoCore PUBLIC EspressoConfig)
target_link_libraries(EspressoCore PUBLIC Boost::serialization Boost::mpi MPI::MPI_CXX)
target_link_libraries(EspressoCore PRIVATE Profiler)
if(FFTW3_FOUND)
target_include_directories(EspressoCore PRIVATE SYSTEM ${FFTW3_INCLUDE_DIR})
......
......@@ -40,11 +40,14 @@
#include "immersed_boundaries.hpp"
#include "short_range_loop.hpp"
#include <profiler/profiler.hpp>
#include <cassert>
ActorList forceActors;
void init_forces() {
ESPRESSO_PROFILER_CXX_MARK_FUNCTION;
/* The force initialization depends on the used thermostat and the
thermodynamic ensemble */
......@@ -90,6 +93,7 @@ void check_forces() {
}
void force_calc() {
ESPRESSO_PROFILER_CXX_MARK_FUNCTION;
espressoSystemInterface.update();
......@@ -201,6 +205,7 @@ void force_calc() {
}
void calc_long_range_forces() {
ESPRESSO_PROFILER_CXX_MARK_FUNCTION;
#ifdef ELECTROSTATICS
/* calculate k-space part of electrostatic interaction. */
switch (coulomb.method) {
......
......@@ -62,6 +62,8 @@
#include "immersed_boundaries.hpp"
#include "npt.hpp"
#include <profiler/profiler.hpp>
#include <cmath>
#include <cstdio>
#include <cstdlib>
......@@ -215,6 +217,8 @@ void integrate_ensemble_init() {
/************************************************************/
void integrate_vv(int n_steps, int reuse_forces) {
ESPRESSO_PROFILER_CXX_MARK_FUNCTION;
/* Prepare the Integrator */
on_integration_start();
......@@ -246,6 +250,7 @@ void integrate_vv(int n_steps, int reuse_forces) {
1: do not recalculate forces. Mostly when reading checkpoints with forces
*/
if (reuse_forces == -1 || (recalc_forces && reuse_forces != 1)) {
ESPRESSO_PROFILER_MARK_BEGIN("Initial Force Calculation");
thermo_heat_up();
#ifdef LB
......@@ -290,6 +295,7 @@ void integrate_vv(int n_steps, int reuse_forces) {
handle_collisions();
}
#endif
ESPRESSO_PROFILER_MARK_END("Initial Force Calculation");
}
if (check_runtime_errors())
......@@ -302,7 +308,9 @@ void integrate_vv(int n_steps, int reuse_forces) {
#endif
/* Integration loop */
ESPRESSO_PROFILER_CXX_MARK_LOOP_BEGIN(integration_loop, "Integration loop");
for (int step = 0; step < n_steps; step++) {
ESPRESSO_PROFILER_CXX_MARK_LOOP_ITERATION(integration_loop, step);
INTEG_TRACE(fprintf(stderr, "%d: STEP %d\n", this_node, step));
#ifdef BOND_CONSTRAINT
......@@ -459,6 +467,7 @@ void integrate_vv(int n_steps, int reuse_forces) {
break;
}
}
ESPRESSO_PROFILER_CXX_MARK_LOOP_END(integration_loop);
// VIRTUAL_SITES update vel
#ifdef VIRTUAL_SITES
if (virtual_sites()->need_ghost_comm_before_vel_update()) {
......
......@@ -19,10 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CORE_SHORT_RANGE_HPP
#define CORE_SHORT_RANGE_HPP
#include <utility>
#include <boost/iterator/indirect_iterator.hpp>
#include "algorithm/for_each_pair.hpp"
#include "cells.hpp"
#include "collision.hpp"
......@@ -30,6 +26,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "integrate.hpp"
#include "nonbonded_interactions/nonbonded_interaction_data.hpp"
#include <boost/iterator/indirect_iterator.hpp>
#include <profiler/profiler.hpp>
#include <utility>
/**
* @brief Distance vector and length handed to pair kernels.
*/
......@@ -101,6 +102,7 @@ void decide_distance(CellIterator first, CellIterator last,
template <typename ParticleKernel, typename PairKernel>
void short_range_loop(ParticleKernel &&particle_kernel,
PairKernel &&pair_kernel) {
ESPRESSO_PROFILER_CXX_MARK_FUNCTION;
auto first = boost::make_indirect_iterator(local_cells.begin());
auto last = boost::make_indirect_iterator(local_cells.end());
......
add_library(Profiler INTERFACE)
target_include_directories(Profiler INTERFACE "include")
if(WITH_PROFILER)
find_package(caliper REQUIRED)
target_link_libraries(Profiler INTERFACE caliper-mpi)
target_compile_definitions(Profiler INTERFACE HAVE_CALIPER)
endif()
#ifndef PROFILER_PROFILER_HPP
#define PROFILER_PROFILER_HPP
#ifdef HAVE_CALIPER
#include <caliper/cali.h>
#define ESPRESSO_PROFILER_CXX_MARK_FUNCTION CALI_CXX_MARK_FUNCTION
#define ESPRESSO_PROFILER_CXX_MARK_LOOP_BEGIN CALI_CXX_MARK_LOOP_BEGIN
#define ESPRESSO_PROFILER_CXX_MARK_LOOP_END CALI_CXX_MARK_LOOP_END
#define ESPRESSO_PROFILER_CXX_MARK_LOOP_ITERATION CALI_CXX_MARK_LOOP_ITERATION
#define ESPRESSO_PROFILER_MARK_FUNCTION_BEGIN CALI_MARK_FUNCTION_BEGIN
#define ESPRESSO_PROFILER_MARK_FUNCTION_END CALI_MARK_FUNCTION_END
#define ESPRESSO_PROFILER_MARK_LOOP_BEGIN CALI_MARK_LOOP_BEGIN
#define ESPRESSO_PROFILER_MARK_LOOP_END CALI_MARK_LOOP_END
#define ESPRESSO_PROFILER_MARK_ITERATION_BEGIN CALI_MARK_ITERATION_BEGIN
#define ESPRESSO_PROFILER_MARK_ITERATION_END CALI_MARK_ITERATION_END
#define ESPRESSO_PROFILER_WRAP_STATEMENT CALI_WRAP_STATEMENT
#define ESPRESSO_PROFILER_MARK_BEGIN CALI_MARK_BEGIN
#define ESPRESSO_PROFILER_MARK_END CALI_MARK_END
#else
#define ESPRESSO_PROFILER_CXX_MARK_FUNCTION
#define ESPRESSO_PROFILER_CXX_MARK_LOOP_BEGIN(A, B)
#define ESPRESSO_PROFILER_CXX_MARK_LOOP_END(A)
#define ESPRESSO_PROFILER_CXX_MARK_LOOP_ITERATION(A, B)
#define ESPRESSO_PROFILER_MARK_FUNCTION_BEGIN
#define ESPRESSO_PROFILER_MARK_FUNCTION_END
#define ESPRESSO_PROFILER_MARK_LOOP_BEGIN(A, B)
#define ESPRESSO_PROFILER_MARK_LOOP_END(A)
#define ESPRESSO_PROFILER_MARK_ITERATION_BEGIN(A, B)
#define ESPRESSO_PROFILER_MARK_ITERATION_END(A)
#define ESPRESSO_PROFILER_WRAP_STATEMENT(A, B)
#define ESPRESSO_PROFILER_MARK_BEGIN(A)
#define ESPRESSO_PROFILER_MARK_END(A)
#endif
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment