Browse Source

fix: arg parsing upper bound,

fix: stencil k BUG,
add: compiler performance flags
master
Daniel Kapla 4 months ago
parent
commit
4982900683
3 changed files with 10 additions and 10 deletions
  1. +1
    -1
      Exercise_01/src/Makefile
  2. +5
    -5
      Exercise_01/src/Solver.h
  3. +4
    -4
      Exercise_01/src/main.cpp

+ 1
- 1
Exercise_01/src/Makefile View File

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

+ 5
- 5
Exercise_01/src/Solver.h View File

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

+ 4
- 4
Exercise_01/src/main.cpp View File

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