fix: arg parsing upper bound,

fix: stencil k BUG,
add: compiler performance flags
master
Daniel Kapla 10 months ago
parent 7f716ffae6
commit 4982900683
  1. 2
      Exercise_01/src/Makefile
  2. 10
      Exercise_01/src/Solver.h
  3. 8
      Exercise_01/src/main.cpp

@ -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

@ -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.)

@ -80,14 +80,14 @@ int main(int argn, char* argv[]) {
std::cerr << "error: Parsing arg 3 <iterations> failed" << std::endl;
return -1;
}
if (resolution < 10 || resolution > 65536) {
if (resolution < 10 || resolution > 1073741824) {
std::cerr << "error: arg 1 <resolution> " << 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> " << iterations
<< "out of domain [0, 65536]" << std::endl;
<< "out of domain [0, 1073741824 = 2^30]" << std::endl;
return -1;
}

Loading…
Cancel
Save