diff --git a/examples/profiling_openmp.cpp b/examples/profiling_openmp.cpp index f41a0a0..1c83542 100644 --- a/examples/profiling_openmp.cpp +++ b/examples/profiling_openmp.cpp @@ -1,15 +1,17 @@ #include #include #include +#include int main(int argc, char *argv[]) { - int n[4] = {10, 20, 50, 100}; - int iterations[1] = {100}; - int repetition = 10; + 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; ofstream myfile; - myfile.open("time_measure_experiment_openmp_thread_1_EigenLU.csv"); + myfile.open("testLarge.csv"); for (int i = 0; i < size(n); i++){ cout << "Grid size: " << n[i] << " x " << n[i] << endl << endl; @@ -20,18 +22,25 @@ int main(int argc, char *argv[]) { for (int k = 0; k < repetition; k++){ cout << "Wiederholung: " << k << endl; Grid grid = Grid(n[i], n[i]); - grid.setDomain(n[i], n[i]); + grid.setDomain(1, 1); MatrixXd concentrations = MatrixXd::Constant(n[i], n[i], 0); - concentrations(5,5) = 1; + concentrations(n[i]/2,n[i]/2) = 1; grid.setConcentrations(concentrations); MatrixXd alpha = MatrixXd::Constant(n[i], n[i], 0.5); Boundary bc = Boundary(grid); Simulation sim = Simulation(grid, bc, BTCS_APPROACH); - sim.setSolver(EIGEN_LU_SOLVER); + sim.setSolver(THOMAS_ALGORITHM_SOLVER); + if(argc == 2){ + int numThreads = atoi(argv[1]); + sim.setNumberThreads(numThreads); + } + else{ + sim.setNumberThreads(1); + } sim.setTimestep(0.001); sim.setIterations(iterations[j]);