mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-13 09:28:23 +01:00
Adjustment to set the threads via command line
This commit is contained in:
parent
6b8368d9f7
commit
1dbee6d8d9
@ -1,15 +1,17 @@
|
||||
#include <tug/Simulation.hpp>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <chrono>
|
||||
|
||||
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]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user