Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HyTeg Patches #16

Merged
merged 3 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions HyTeg/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Patches for HyTeg

This folder contains configuration and regression patches for the `HyTeg` project.

## General

The HyTeg project exposes 2 configuration options that can be switched:

- Solver
- CGSolver
- MinResSolver
- GMRESSolver
- Smoother
- SORSmoother
- SymmetricSORSmoother

## Configuration Patches

There are configuration patches for the whole configuration space available. The `feature_tags` of the info files will contain the names of the configuration options that are activated.

A configuration patch is of the form `$PTy_$SolverTy_$SmootherTy.patch` where `$SolverTy` and `$SmootherTy` are shorthands of the activated configuration option for that category.
`$PType` is one of `["p1","p2"]`. It switches the poisson problem to use a different problem setup, so this is loosely comparable to running a different workload [citation needed].

## Regression Patches

For each configuration option one or multiple regression patches of 5 severities (`1ms`, `10ms`, `100ms`, `1000ms` and `10000ms`) are available.
The `tags` in the `.info` file will contain the name of the confugration option that is affected. Artificial regressions will be introduced into a specific function in the source code.

The regressed function will always be the `solve` function of the solver or smoother selected.
16 changes: 16 additions & 0 deletions HyTeg/cg_solve_10000ms.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
description: Introduces an artificial regression of 10000ms into the solve function
of the CGSolver of HyTeg.
include_revisions:
revision_range:
start: f4711dadc3f61386e6ccdc704baa783253332db2
path: cg_solve_10000ms.patch
project_name: HyTeg
shortname: cg_solve_10000ms
tags:
- compile-time
- regression
- template
- 10000ms
- synthetic
- CGSolver
- HyTeg
40 changes: 40 additions & 0 deletions HyTeg/cg_solve_10000ms.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/src/hyteg/solvers/CGSolver.hpp b/src/hyteg/solvers/CGSolver.hpp
index 4696554c9..5a0790613 100644
--- a/src/hyteg/solvers/CGSolver.hpp
+++ b/src/hyteg/solvers/CGSolver.hpp
@@ -66,6 +66,7 @@ class CGSolver : public Solver< OperatorType >

void solve( const OperatorType& A, const FunctionType& x, const FunctionType& b, const uint_t level ) override
{
+ fp_util::busy_sleep_for_millisecs( 10000 );
if ( maxIter_ == 0 )
return;

diff --git a/src/hyteg/solvers/Solver.hpp b/src/hyteg/solvers/Solver.hpp
index 6d9ebb542..a9354816d 100644
--- a/src/hyteg/solvers/Solver.hpp
+++ b/src/hyteg/solvers/Solver.hpp
@@ -21,6 +21,23 @@

#include "core/DataTypes.h"

+namespace fp_util {
+ inline void busy_sleep_for_millisecs(unsigned Millisecs) {
+ auto start_us = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::high_resolution_clock::now().time_since_epoch());
+ auto end_us = start_us + std::chrono::milliseconds(Millisecs);
+ auto current_us = start_us;
+
+ while (current_us < end_us) {
+ for (long counter = 0; counter < 100'000; ++counter) {
+ asm volatile("" : "+g"(counter) : :); // prevent optimization
+ }
+ current_us = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::high_resolution_clock::now().time_since_epoch());
+ }
+ }
+}
+
namespace hyteg {
template < class OperatorType >
class Solver
16 changes: 16 additions & 0 deletions HyTeg/cg_solve_1000ms.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
description: Introduces an artificial regression of 1000ms into the solve function
of the CGSolver of HyTeg.
include_revisions:
revision_range:
start: f4711dadc3f61386e6ccdc704baa783253332db2
path: cg_solve_1000ms.patch
project_name: HyTeg
shortname: cg_solve_1000ms
tags:
- compile-time
- regression
- template
- 1000ms
- synthetic
- CGSolver
- HyTeg
40 changes: 40 additions & 0 deletions HyTeg/cg_solve_1000ms.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/src/hyteg/solvers/CGSolver.hpp b/src/hyteg/solvers/CGSolver.hpp
index 4696554c9..5a0790613 100644
--- a/src/hyteg/solvers/CGSolver.hpp
+++ b/src/hyteg/solvers/CGSolver.hpp
@@ -66,6 +66,7 @@ class CGSolver : public Solver< OperatorType >

void solve( const OperatorType& A, const FunctionType& x, const FunctionType& b, const uint_t level ) override
{
+ fp_util::busy_sleep_for_millisecs( 1000 );
if ( maxIter_ == 0 )
return;

diff --git a/src/hyteg/solvers/Solver.hpp b/src/hyteg/solvers/Solver.hpp
index 6d9ebb542..a9354816d 100644
--- a/src/hyteg/solvers/Solver.hpp
+++ b/src/hyteg/solvers/Solver.hpp
@@ -21,6 +21,23 @@

#include "core/DataTypes.h"

+namespace fp_util {
+ inline void busy_sleep_for_millisecs(unsigned Millisecs) {
+ auto start_us = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::high_resolution_clock::now().time_since_epoch());
+ auto end_us = start_us + std::chrono::milliseconds(Millisecs);
+ auto current_us = start_us;
+
+ while (current_us < end_us) {
+ for (long counter = 0; counter < 100'000; ++counter) {
+ asm volatile("" : "+g"(counter) : :); // prevent optimization
+ }
+ current_us = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::high_resolution_clock::now().time_since_epoch());
+ }
+ }
+}
+
namespace hyteg {
template < class OperatorType >
class Solver
16 changes: 16 additions & 0 deletions HyTeg/cg_solve_100ms.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
description: Introduces an artificial regression of 100ms into the solve function
of the CGSolver of HyTeg.
include_revisions:
revision_range:
start: f4711dadc3f61386e6ccdc704baa783253332db2
path: cg_solve_100ms.patch
project_name: HyTeg
shortname: cg_solve_100ms
tags:
- compile-time
- regression
- template
- 100ms
- synthetic
- CGSolver
- HyTeg
40 changes: 40 additions & 0 deletions HyTeg/cg_solve_100ms.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/src/hyteg/solvers/CGSolver.hpp b/src/hyteg/solvers/CGSolver.hpp
index 4696554c9..5a0790613 100644
--- a/src/hyteg/solvers/CGSolver.hpp
+++ b/src/hyteg/solvers/CGSolver.hpp
@@ -66,6 +66,7 @@ class CGSolver : public Solver< OperatorType >

void solve( const OperatorType& A, const FunctionType& x, const FunctionType& b, const uint_t level ) override
{
+ fp_util::busy_sleep_for_millisecs( 100 );
if ( maxIter_ == 0 )
return;

diff --git a/src/hyteg/solvers/Solver.hpp b/src/hyteg/solvers/Solver.hpp
index 6d9ebb542..a9354816d 100644
--- a/src/hyteg/solvers/Solver.hpp
+++ b/src/hyteg/solvers/Solver.hpp
@@ -21,6 +21,23 @@

#include "core/DataTypes.h"

+namespace fp_util {
+ inline void busy_sleep_for_millisecs(unsigned Millisecs) {
+ auto start_us = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::high_resolution_clock::now().time_since_epoch());
+ auto end_us = start_us + std::chrono::milliseconds(Millisecs);
+ auto current_us = start_us;
+
+ while (current_us < end_us) {
+ for (long counter = 0; counter < 100'000; ++counter) {
+ asm volatile("" : "+g"(counter) : :); // prevent optimization
+ }
+ current_us = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::high_resolution_clock::now().time_since_epoch());
+ }
+ }
+}
+
namespace hyteg {
template < class OperatorType >
class Solver
16 changes: 16 additions & 0 deletions HyTeg/cg_solve_10ms.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
description: Introduces an artificial regression of 10ms into the solve function of
the CGSolver of HyTeg.
include_revisions:
revision_range:
start: f4711dadc3f61386e6ccdc704baa783253332db2
path: cg_solve_10ms.patch
project_name: HyTeg
shortname: cg_solve_10ms
tags:
- compile-time
- regression
- template
- 10ms
- synthetic
- CGSolver
- HyTeg
40 changes: 40 additions & 0 deletions HyTeg/cg_solve_10ms.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/src/hyteg/solvers/CGSolver.hpp b/src/hyteg/solvers/CGSolver.hpp
index 4696554c9..5a0790613 100644
--- a/src/hyteg/solvers/CGSolver.hpp
+++ b/src/hyteg/solvers/CGSolver.hpp
@@ -66,6 +66,7 @@ class CGSolver : public Solver< OperatorType >

void solve( const OperatorType& A, const FunctionType& x, const FunctionType& b, const uint_t level ) override
{
+ fp_util::busy_sleep_for_millisecs( 10 );
if ( maxIter_ == 0 )
return;

diff --git a/src/hyteg/solvers/Solver.hpp b/src/hyteg/solvers/Solver.hpp
index 6d9ebb542..a9354816d 100644
--- a/src/hyteg/solvers/Solver.hpp
+++ b/src/hyteg/solvers/Solver.hpp
@@ -21,6 +21,23 @@

#include "core/DataTypes.h"

+namespace fp_util {
+ inline void busy_sleep_for_millisecs(unsigned Millisecs) {
+ auto start_us = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::high_resolution_clock::now().time_since_epoch());
+ auto end_us = start_us + std::chrono::milliseconds(Millisecs);
+ auto current_us = start_us;
+
+ while (current_us < end_us) {
+ for (long counter = 0; counter < 100'000; ++counter) {
+ asm volatile("" : "+g"(counter) : :); // prevent optimization
+ }
+ current_us = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::high_resolution_clock::now().time_since_epoch());
+ }
+ }
+}
+
namespace hyteg {
template < class OperatorType >
class Solver
16 changes: 16 additions & 0 deletions HyTeg/cg_solve_1ms.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
description: Introduces an artificial regression of 1ms into the solve function of
the CGSolver of HyTeg.
include_revisions:
revision_range:
start: f4711dadc3f61386e6ccdc704baa783253332db2
path: cg_solve_1ms.patch
project_name: HyTeg
shortname: cg_solve_1ms
tags:
- compile-time
- regression
- template
- 1ms
- synthetic
- CGSolver
- HyTeg
40 changes: 40 additions & 0 deletions HyTeg/cg_solve_1ms.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/src/hyteg/solvers/CGSolver.hpp b/src/hyteg/solvers/CGSolver.hpp
index 4696554c9..5a0790613 100644
--- a/src/hyteg/solvers/CGSolver.hpp
+++ b/src/hyteg/solvers/CGSolver.hpp
@@ -66,6 +66,7 @@ class CGSolver : public Solver< OperatorType >

void solve( const OperatorType& A, const FunctionType& x, const FunctionType& b, const uint_t level ) override
{
+ fp_util::busy_sleep_for_millisecs( 1 );
if ( maxIter_ == 0 )
return;

diff --git a/src/hyteg/solvers/Solver.hpp b/src/hyteg/solvers/Solver.hpp
index 6d9ebb542..a9354816d 100644
--- a/src/hyteg/solvers/Solver.hpp
+++ b/src/hyteg/solvers/Solver.hpp
@@ -21,6 +21,23 @@

#include "core/DataTypes.h"

+namespace fp_util {
+ inline void busy_sleep_for_millisecs(unsigned Millisecs) {
+ auto start_us = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::high_resolution_clock::now().time_since_epoch());
+ auto end_us = start_us + std::chrono::milliseconds(Millisecs);
+ auto current_us = start_us;
+
+ while (current_us < end_us) {
+ for (long counter = 0; counter < 100'000; ++counter) {
+ asm volatile("" : "+g"(counter) : :); // prevent optimization
+ }
+ current_us = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::high_resolution_clock::now().time_since_epoch());
+ }
+ }
+}
+
namespace hyteg {
template < class OperatorType >
class Solver
16 changes: 16 additions & 0 deletions HyTeg/gmres_solve_10000ms.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
description: Introduces an artificial regression of 10000ms into the solve function
of the GMRESSolver of HyTeg.
include_revisions:
revision_range:
start: f4711dadc3f61386e6ccdc704baa783253332db2
path: gmres_solve_10000ms.patch
project_name: HyTeg
shortname: gmres_solve_10000ms
tags:
- compile-time
- regression
- template
- 10000ms
- synthetic
- GMRESSolver
- HyTeg
40 changes: 40 additions & 0 deletions HyTeg/gmres_solve_10000ms.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/src/hyteg/solvers/GMRESSolver.hpp b/src/hyteg/solvers/GMRESSolver.hpp
index 3bb7cad99..40280d2a3 100644
--- a/src/hyteg/solvers/GMRESSolver.hpp
+++ b/src/hyteg/solvers/GMRESSolver.hpp
@@ -76,6 +76,7 @@ class GMRESSolver : public Solver< OperatorType >

void solve( const OperatorType& A, const FunctionType& x, const FunctionType& b, const uint_t level ) override
{
+ fp_util::busy_sleep_for_millisecs( 10000 );
timingTree_->start( "GMRES Solver" );

real_t approxERR = approxTOL_ + 1;
diff --git a/src/hyteg/solvers/Solver.hpp b/src/hyteg/solvers/Solver.hpp
index 6d9ebb542..a9354816d 100644
--- a/src/hyteg/solvers/Solver.hpp
+++ b/src/hyteg/solvers/Solver.hpp
@@ -21,6 +21,23 @@

#include "core/DataTypes.h"

+namespace fp_util {
+ inline void busy_sleep_for_millisecs(unsigned Millisecs) {
+ auto start_us = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::high_resolution_clock::now().time_since_epoch());
+ auto end_us = start_us + std::chrono::milliseconds(Millisecs);
+ auto current_us = start_us;
+
+ while (current_us < end_us) {
+ for (long counter = 0; counter < 100'000; ++counter) {
+ asm volatile("" : "+g"(counter) : :); // prevent optimization
+ }
+ current_us = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::high_resolution_clock::now().time_since_epoch());
+ }
+ }
+}
+
namespace hyteg {
template < class OperatorType >
class Solver
16 changes: 16 additions & 0 deletions HyTeg/gmres_solve_1000ms.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
description: Introduces an artificial regression of 1000ms into the solve function
of the GMRESSolver of HyTeg.
include_revisions:
revision_range:
start: f4711dadc3f61386e6ccdc704baa783253332db2
path: gmres_solve_1000ms.patch
project_name: HyTeg
shortname: gmres_solve_1000ms
tags:
- compile-time
- regression
- template
- 1000ms
- synthetic
- GMRESSolver
- HyTeg
Loading
Loading