mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-15 18:38:23 +01:00
fix: reverted local profiling_openmp.cpp to commit 1dbee6d8, small updates in index.rst
This commit is contained in:
parent
6363585a00
commit
2d50f32e37
@ -10,8 +10,9 @@ Welcome to the documentation of the TUG project, a simulation program
|
|||||||
for solving transport equations in one- and two-dimensional uniform
|
for solving transport equations in one- and two-dimensional uniform
|
||||||
grids using cell centered finite differences.
|
grids using cell centered finite differences.
|
||||||
|
|
||||||
|
---------
|
||||||
Diffusion
|
Diffusion
|
||||||
-----------
|
---------
|
||||||
|
|
||||||
TUG can solve diffusion problems with heterogeneous and anisotropic
|
TUG can solve diffusion problems with heterogeneous and anisotropic
|
||||||
diffusion coefficients. The partial differential equation expressing
|
diffusion coefficients. The partial differential equation expressing
|
||||||
|
|||||||
@ -2,47 +2,60 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <easy/profiler.h>
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
EASY_MAIN_THREAD;
|
|
||||||
EASY_PROFILER_ENABLE;
|
|
||||||
profiler::startListen();
|
|
||||||
|
|
||||||
int n = 1000;
|
int n[4] = {100, 500, 1000, 2000};
|
||||||
|
int threads[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||||
|
int iterations[1] = {5};
|
||||||
|
int repetition = 1;
|
||||||
|
|
||||||
Grid grid = Grid(n, n);
|
ofstream myfile;
|
||||||
grid.setDomain(10, 10);
|
myfile.open("testLarge.csv");
|
||||||
|
|
||||||
MatrixXd concentrations = MatrixXd::Constant(n, n, 0);
|
for (int i = 0; i < size(n); i++){
|
||||||
concentrations(n/2,n/2) = 1;
|
cout << "Grid size: " << n[i] << " x " << n[i] << endl << endl;
|
||||||
grid.setConcentrations(concentrations);
|
myfile << "Grid size: " << n[i] << " x " << n[i] << endl << endl;
|
||||||
MatrixXd alpha = MatrixXd::Constant(n, n, 0.001);
|
for(int j = 0; j < size(iterations); j++){
|
||||||
|
cout << "Iterations: " << iterations[j] << endl;
|
||||||
Boundary bc = Boundary(grid);
|
myfile << "Iterations: " << iterations[j] << endl;
|
||||||
|
for (int k = 0; k < repetition; k++){
|
||||||
Simulation sim = Simulation(grid, bc, BTCS_APPROACH);
|
cout << "Wiederholung: " << k << endl;
|
||||||
sim.setSolver(THOMAS_ALGORITHM_SOLVER);
|
Grid grid = Grid(n[i], n[i]);
|
||||||
sim.setNumberThreads(1);
|
grid.setDomain(1, 1);
|
||||||
|
|
||||||
sim.setTimestep(0.001);
|
|
||||||
sim.setIterations(2);
|
|
||||||
sim.setOutputCSV(CSV_OUTPUT_OFF);
|
|
||||||
|
|
||||||
auto begin = std::chrono::high_resolution_clock::now();
|
|
||||||
|
|
||||||
EASY_BLOCK("SIMULATION");
|
MatrixXd concentrations = MatrixXd::Constant(n[i], n[i], 0);
|
||||||
sim.run();
|
concentrations(n[i]/2,n[i]/2) = 1;
|
||||||
EASY_END_BLOCK;
|
grid.setConcentrations(concentrations);
|
||||||
|
MatrixXd alpha = MatrixXd::Constant(n[i], n[i], 0.5);
|
||||||
|
|
||||||
auto end = std::chrono::high_resolution_clock::now();
|
Boundary bc = Boundary(grid);
|
||||||
|
|
||||||
auto milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(end - begin);
|
Simulation sim = Simulation(grid, bc, BTCS_APPROACH);
|
||||||
cout << milliseconds.count() << endl;
|
sim.setSolver(THOMAS_ALGORITHM_SOLVER);
|
||||||
|
|
||||||
profiler::dumpBlocksToFile("./mytest_profile.prof");
|
if(argc == 2){
|
||||||
profiler::stopListen();
|
int numThreads = atoi(argv[1]);
|
||||||
|
sim.setNumberThreads(numThreads);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
sim.setNumberThreads(1);
|
||||||
|
}
|
||||||
|
|
||||||
return(0);
|
sim.setTimestep(0.001);
|
||||||
}
|
sim.setIterations(iterations[j]);
|
||||||
|
sim.setOutputCSV(CSV_OUTPUT_OFF);
|
||||||
|
|
||||||
|
auto begin = std::chrono::high_resolution_clock::now();
|
||||||
|
sim.run();
|
||||||
|
auto end = std::chrono::high_resolution_clock::now();
|
||||||
|
auto milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(end - begin);
|
||||||
|
myfile << milliseconds.count() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cout << endl;
|
||||||
|
myfile << endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
myfile.close();
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user