From 49829006836ca211c71f2d07c5846411712cae9d Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 29 Mar 2022 12:35:46 +0200 Subject: [PATCH] fix: arg parsing upper bound, fix: stencil k BUG, add: compiler performance flags --- Exercise_01/src/Makefile | 2 +- Exercise_01/src/Solver.h | 10 +++++----- Exercise_01/src/main.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Exercise_01/src/Makefile b/Exercise_01/src/Makefile index 96222e3..71859aa 100644 --- a/Exercise_01/src/Makefile +++ b/Exercise_01/src/Makefile @@ -1,7 +1,7 @@ CPP=g++ MPICPP=mpic++ -CPPFLAGS= -std=c++17 -O3 -Wall -Wpedantic -pedantic +CPPFLAGS= -std=c++17 -O3 -march=native -mtune=native -ffast-math -Wall -Wpedantic -pedantic OUT=main seriel: main.cpp Matrix.h Solver.h diff --git a/Exercise_01/src/Solver.h b/Exercise_01/src/Solver.h index e438e4e..546b253 100644 --- a/Exercise_01/src/Solver.h +++ b/Exercise_01/src/Solver.h @@ -29,11 +29,11 @@ public: _nx{nx}, _ny{ny}, _xmin{xmin}, _xmax{xmax}, _ymin{ymin}, _ymax{ymax}, - _stencil{ 4.0 / (h * h) + 4.0 * k * k, /* Center */ - -1.0 / (h * h), /* Bottom */ - -1.0 / (h * h), /* Left */ - -1.0 / (h * h), /* Up */ - -1.0 / (h * h)}, /* Right */ + _stencil{ 4.0 / (h * h) + k * k, /* Center */ + -1.0 / (h * h), /* Bottom */ + -1.0 / (h * h), /* Left */ + -1.0 / (h * h), /* Up */ + -1.0 / (h * h)}, /* Right */ _rhs(nx, ny, 0.), _sol(nx, ny, 0.), _tmp(nx, ny, 0.) diff --git a/Exercise_01/src/main.cpp b/Exercise_01/src/main.cpp index 6c274ca..9836368 100644 --- a/Exercise_01/src/main.cpp +++ b/Exercise_01/src/main.cpp @@ -80,14 +80,14 @@ int main(int argn, char* argv[]) { std::cerr << "error: Parsing arg 3 failed" << std::endl; return -1; } - if (resolution < 10 || resolution > 65536) { + if (resolution < 10 || resolution > 1073741824) { std::cerr << "error: arg 1 " << resolution - << " out of domain [10, 65536]" << std::endl; + << " out of domain [10, 1073741824 = 2^30]" << std::endl; return -1; } - if (iterations > 65536) { + if (iterations > 1073741824) { std::cerr << "error: arg 2 " << iterations - << "out of domain [0, 65536]" << std::endl; + << "out of domain [0, 1073741824 = 2^30]" << std::endl; return -1; }