add easy profiler to CMAKE files
This commit is contained in:
parent
b7561b93e0
commit
23da250cba
@ -7,6 +7,7 @@ set(CMAKE_CXX_STANDARD 17)
|
|||||||
|
|
||||||
find_package(Eigen3 REQUIRED NO_MODULE)
|
find_package(Eigen3 REQUIRED NO_MODULE)
|
||||||
find_package(OpenMP)
|
find_package(OpenMP)
|
||||||
|
find_package(easy_profiler REQUIRED)
|
||||||
|
|
||||||
## SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -mfma")
|
## SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -mfma")
|
||||||
option(TUG_USE_OPENMP "Compile with OpenMP support" ON)
|
option(TUG_USE_OPENMP "Compile with OpenMP support" ON)
|
||||||
|
|||||||
@ -7,3 +7,4 @@ target_link_libraries(first_example tug)
|
|||||||
target_link_libraries(second_example tug)
|
target_link_libraries(second_example tug)
|
||||||
target_link_libraries(boundary_example1D tug)
|
target_link_libraries(boundary_example1D tug)
|
||||||
target_link_libraries(FTCS_2D_proto_example tug)
|
target_link_libraries(FTCS_2D_proto_example tug)
|
||||||
|
target_link_libraries(FTCS_2D_proto_example easy_profiler)
|
||||||
@ -7,13 +7,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <tug/Simulation.hpp>
|
#include <tug/Simulation.hpp>
|
||||||
|
#include <easy/profiler.h>
|
||||||
|
#define EASY_PROFILER_ENABLE ::profiler::setEnabled(true);
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
EASY_PROFILER_ENABLE;
|
||||||
|
profiler::startListen();
|
||||||
// **************
|
// **************
|
||||||
// **** GRID ****
|
// **** GRID ****
|
||||||
// **************
|
// **************
|
||||||
|
profiler::startListen();
|
||||||
// create a grid with a 20 x 20 field
|
// create a grid with a 20 x 20 field
|
||||||
int row = 20;
|
int row = 20;
|
||||||
int col = 20;
|
int col = 20;
|
||||||
@ -25,8 +29,8 @@ int main(int argc, char *argv[]) {
|
|||||||
// (optional) set the concentrations, e.g.:
|
// (optional) set the concentrations, e.g.:
|
||||||
// MatrixXd concentrations = MatrixXd::Constant(20,20,1000); // #row,#col,value
|
// MatrixXd concentrations = MatrixXd::Constant(20,20,1000); // #row,#col,value
|
||||||
// grid.setConcentrations(concentrations);
|
// grid.setConcentrations(concentrations);
|
||||||
MatrixXd concentrations = MatrixXd::Constant(20,20,0);
|
MatrixXd concentrations = MatrixXd::Constant(row, col,1);
|
||||||
// concentrations(0,0) = 2000;
|
concentrations(0,0) = 2000;
|
||||||
grid.setConcentrations(concentrations);
|
grid.setConcentrations(concentrations);
|
||||||
|
|
||||||
// (optional) set alphas of the grid, e.g.:
|
// (optional) set alphas of the grid, e.g.:
|
||||||
@ -64,7 +68,7 @@ int main(int argc, char *argv[]) {
|
|||||||
simulation.setTimestep(0.1); // timestep
|
simulation.setTimestep(0.1); // timestep
|
||||||
|
|
||||||
// (optional) set the number of iterations
|
// (optional) set the number of iterations
|
||||||
simulation.setIterations(1000);
|
simulation.setIterations(2);
|
||||||
|
|
||||||
// (optional) set kind of output [CSV_OUTPUT_OFF (default), CSV_OUTPUT_ON, CSV_OUTPUT_VERBOSE]
|
// (optional) set kind of output [CSV_OUTPUT_OFF (default), CSV_OUTPUT_ON, CSV_OUTPUT_VERBOSE]
|
||||||
simulation.setOutputCSV(CSV_OUTPUT_VERBOSE);
|
simulation.setOutputCSV(CSV_OUTPUT_VERBOSE);
|
||||||
@ -72,6 +76,10 @@ int main(int argc, char *argv[]) {
|
|||||||
// **** RUN SIMULATION ****
|
// **** RUN SIMULATION ****
|
||||||
|
|
||||||
// run the simulation
|
// run the simulation
|
||||||
simulation.run();
|
|
||||||
|
|
||||||
|
EASY_BLOCK("SIMULATION")
|
||||||
|
simulation.run();
|
||||||
|
EASY_END_BLOCK;
|
||||||
|
profiler::dumpBlocksToFile("test_profile.prof");
|
||||||
|
profiler::stopListen();
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user