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

Fix regression patches #19

Merged
merged 5 commits into from
Dec 4, 2023
Merged
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
27 changes: 27 additions & 0 deletions DunePerfRegression/add_busy_sleep.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
description: Adds a busy_sleep utility function to Dune (Required for all patches with "regression" tag)
include_revisions:
revision_range:
start: 559e763958113c8e6c31a3569127781cadb5a535
path: add_busy_sleep.patch
project_name: DunePerfRegression
shortname: alu_grid_adapt_1ms
tags:
- dune
- compile-time
- template
- ALUGrid
- UGGrid
- YaspGrid
- BiCGSTABSolver
- CGSolver
- GradientSolver
- LoopSolver
- MINRESSolver
- KuhnUnitCubeMaker
- TriangulatedUnitCubeMaker
- TriangulatedUnitSquareMaker
- UnitTetrahedronMaker
- UnitTriangleMaker
- Richardson
- SeqILU
- SeqSSOR
30 changes: 30 additions & 0 deletions DunePerfRegression/add_busy_sleep.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Submodule dune-common contains modified content
diff --git a/dune-common/dune/common/typetraits.hh b/dune-common/dune/common/typetraits.hh
index 2c77c3d12..a9da5d8b9 100644
--- a/dune-common/dune/common/typetraits.hh
+++ b/dune-common/dune/common/typetraits.hh
@@ -9,6 +9,24 @@
#include <type_traits>
#include <utility>
#include <vector>
+#include <chrono>
+
+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 Dune
{
24 changes: 1 addition & 23 deletions DunePerfRegression/alu_grid_adapt_10000ms.patch
Original file line number Diff line number Diff line change
@@ -3,33 +3,11 @@ diff --git a/dune-alugrid/dune/alugrid/3d/grid_inline.hh b/dune-alugrid/dune/alu
index f7e1b5d1..785c4bea 100644
--- a/dune-alugrid/dune/alugrid/3d/grid_inline.hh
+++ b/dune-alugrid/dune/alugrid/3d/grid_inline.hh
@@ -13,6 +13,21 @@

#define alu_inline_tmp inline

+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 Dune
{

@@ -515,6 +530,8 @@ namespace Dune
alu_inline_tmp
bool ALU3dGrid< dim, dimworld, elType, Comm >::adapt ()
{
+ busy_sleep_for_millisecs(10000);
+ fp_util::busy_sleep_for_millisecs(10000);
+
bool ref = false;

24 changes: 1 addition & 23 deletions DunePerfRegression/alu_grid_adapt_1000ms.patch
Original file line number Diff line number Diff line change
@@ -3,33 +3,11 @@ diff --git a/dune-alugrid/dune/alugrid/3d/grid_inline.hh b/dune-alugrid/dune/alu
index f7e1b5d1..0d776882 100644
--- a/dune-alugrid/dune/alugrid/3d/grid_inline.hh
+++ b/dune-alugrid/dune/alugrid/3d/grid_inline.hh
@@ -13,6 +13,21 @@

#define alu_inline_tmp inline

+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 Dune
{

@@ -515,6 +530,8 @@ namespace Dune
alu_inline_tmp
bool ALU3dGrid< dim, dimworld, elType, Comm >::adapt ()
{
+ busy_sleep_for_millisecs(1000);
+ fp_util::busy_sleep_for_millisecs(1000);
+
bool ref = false;

24 changes: 1 addition & 23 deletions DunePerfRegression/alu_grid_adapt_100ms.patch
Original file line number Diff line number Diff line change
@@ -3,33 +3,11 @@ diff --git a/dune-alugrid/dune/alugrid/3d/grid_inline.hh b/dune-alugrid/dune/alu
index f7e1b5d1..f890b952 100644
--- a/dune-alugrid/dune/alugrid/3d/grid_inline.hh
+++ b/dune-alugrid/dune/alugrid/3d/grid_inline.hh
@@ -13,6 +13,21 @@

#define alu_inline_tmp inline

+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 Dune
{

@@ -515,6 +530,8 @@ namespace Dune
alu_inline_tmp
bool ALU3dGrid< dim, dimworld, elType, Comm >::adapt ()
{
+ busy_sleep_for_millisecs(100);
+ fp_util::busy_sleep_for_millisecs(100);
+
bool ref = false;

24 changes: 1 addition & 23 deletions DunePerfRegression/alu_grid_adapt_10ms.patch
Original file line number Diff line number Diff line change
@@ -3,33 +3,11 @@ diff --git a/dune-alugrid/dune/alugrid/3d/grid_inline.hh b/dune-alugrid/dune/alu
index f7e1b5d1..55955dc0 100644
--- a/dune-alugrid/dune/alugrid/3d/grid_inline.hh
+++ b/dune-alugrid/dune/alugrid/3d/grid_inline.hh
@@ -13,6 +13,21 @@

#define alu_inline_tmp inline

+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 Dune
{

@@ -515,6 +530,8 @@ namespace Dune
alu_inline_tmp
bool ALU3dGrid< dim, dimworld, elType, Comm >::adapt ()
{
+ busy_sleep_for_millisecs(10);
+ fp_util::busy_sleep_for_millisecs(10);
+
bool ref = false;

24 changes: 1 addition & 23 deletions DunePerfRegression/alu_grid_adapt_1ms.patch
Original file line number Diff line number Diff line change
@@ -3,33 +3,11 @@ diff --git a/dune-alugrid/dune/alugrid/3d/grid_inline.hh b/dune-alugrid/dune/alu
index f7e1b5d1..124dd058 100644
--- a/dune-alugrid/dune/alugrid/3d/grid_inline.hh
+++ b/dune-alugrid/dune/alugrid/3d/grid_inline.hh
@@ -13,6 +13,21 @@

#define alu_inline_tmp inline

+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 Dune
{

@@ -515,6 +530,8 @@ namespace Dune
alu_inline_tmp
bool ALU3dGrid< dim, dimworld, elType, Comm >::adapt ()
{
+ busy_sleep_for_millisecs(1);
+ fp_util::busy_sleep_for_millisecs(1);
+
bool ref = false;

28 changes: 1 addition & 27 deletions DunePerfRegression/bicgstab_solver_apply_10000ms.patch
Original file line number Diff line number Diff line change
@@ -1,30 +1,4 @@
Submodule dune-istl contains modified content
diff --git a/dune-istl/dune/istl/solver.hh b/dune-istl/dune/istl/solver.hh
index e25e9e08..857234d5 100644
--- a/dune-istl/dune/istl/solver.hh
+++ b/dune-istl/dune/istl/solver.hh
@@ -23,6 +23,21 @@
#include "operators.hh"
#include "scalarproducts.hh"

+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 Dune
{
/**
diff --git a/dune-istl/dune/istl/solvers.hh b/dune-istl/dune/istl/solvers.hh
index 5a7e901e..a8a37b31 100644
--- a/dune-istl/dune/istl/solvers.hh
@@ -33,7 +7,7 @@ index 5a7e901e..a8a37b31 100644
*/
virtual void apply (X& x, X& b, InverseOperatorResult& res)
{
+ busy_sleep_for_millisecs(10000);
+ fp_util::busy_sleep_for_millisecs(10000);
+
using std::abs;
const Simd::Scalar<real_type> EPSILON=1e-80;
28 changes: 1 addition & 27 deletions DunePerfRegression/bicgstab_solver_apply_1000ms.patch
Original file line number Diff line number Diff line change
@@ -1,30 +1,4 @@
Submodule dune-istl contains modified content
diff --git a/dune-istl/dune/istl/solver.hh b/dune-istl/dune/istl/solver.hh
index e25e9e08..857234d5 100644
--- a/dune-istl/dune/istl/solver.hh
+++ b/dune-istl/dune/istl/solver.hh
@@ -23,6 +23,21 @@
#include "operators.hh"
#include "scalarproducts.hh"

+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 Dune
{
/**
diff --git a/dune-istl/dune/istl/solvers.hh b/dune-istl/dune/istl/solvers.hh
index 5a7e901e..a8a37b31 100644
--- a/dune-istl/dune/istl/solvers.hh
@@ -33,7 +7,7 @@ index 5a7e901e..a8a37b31 100644
*/
virtual void apply (X& x, X& b, InverseOperatorResult& res)
{
+ busy_sleep_for_millisecs(1000);
+ fp_util::busy_sleep_for_millisecs(1000);
+
using std::abs;
const Simd::Scalar<real_type> EPSILON=1e-80;
28 changes: 1 addition & 27 deletions DunePerfRegression/bicgstab_solver_apply_100ms.patch
Original file line number Diff line number Diff line change
@@ -1,30 +1,4 @@
Submodule dune-istl contains modified content
diff --git a/dune-istl/dune/istl/solver.hh b/dune-istl/dune/istl/solver.hh
index e25e9e08..857234d5 100644
--- a/dune-istl/dune/istl/solver.hh
+++ b/dune-istl/dune/istl/solver.hh
@@ -23,6 +23,21 @@
#include "operators.hh"
#include "scalarproducts.hh"

+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 Dune
{
/**
diff --git a/dune-istl/dune/istl/solvers.hh b/dune-istl/dune/istl/solvers.hh
index 5a7e901e..a8a37b31 100644
--- a/dune-istl/dune/istl/solvers.hh
@@ -33,7 +7,7 @@ index 5a7e901e..a8a37b31 100644
*/
virtual void apply (X& x, X& b, InverseOperatorResult& res)
{
+ busy_sleep_for_millisecs(100);
+ fp_util::busy_sleep_for_millisecs(100);
+
using std::abs;
const Simd::Scalar<real_type> EPSILON=1e-80;
28 changes: 1 addition & 27 deletions DunePerfRegression/bicgstab_solver_apply_10ms.patch
Original file line number Diff line number Diff line change
@@ -1,30 +1,4 @@
Submodule dune-istl contains modified content
diff --git a/dune-istl/dune/istl/solver.hh b/dune-istl/dune/istl/solver.hh
index e25e9e08..857234d5 100644
--- a/dune-istl/dune/istl/solver.hh
+++ b/dune-istl/dune/istl/solver.hh
@@ -23,6 +23,21 @@
#include "operators.hh"
#include "scalarproducts.hh"

+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 Dune
{
/**
diff --git a/dune-istl/dune/istl/solvers.hh b/dune-istl/dune/istl/solvers.hh
index 5a7e901e..a8a37b31 100644
--- a/dune-istl/dune/istl/solvers.hh
@@ -33,7 +7,7 @@ index 5a7e901e..a8a37b31 100644
*/
virtual void apply (X& x, X& b, InverseOperatorResult& res)
{
+ busy_sleep_for_millisecs(10);
+ fp_util::busy_sleep_for_millisecs(10);
+
using std::abs;
const Simd::Scalar<real_type> EPSILON=1e-80;
Loading