Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Gaudi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gaudi
Gaudi
Commits
94da4c2d
Commit
94da4c2d
authored
7 years ago
by
Illya Shapoval
Browse files
Options
Downloads
Patches
Plain Diff
fix CPUCruncher run time smearing engine: dodge NaN values which result in run time explosion
parent
0d7cf453
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!323
Fix the cRUNch TIME smearing engine of CPUCruncher algorithms
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GaudiHive/src/CPUCruncher.cpp
+11
-5
11 additions, 5 deletions
GaudiHive/src/CPUCruncher.cpp
with
11 additions
and
5 deletions
GaudiHive/src/CPUCruncher.cpp
+
11
−
5
View file @
94da4c2d
...
...
@@ -210,8 +210,8 @@ StatusCode CPUCruncher::execute() // the execution of the algorithm
float
crunchtime
;
if
(
m_local_rndm_gen
)
{
/* This will disappear with a thread safe random number generator s
vc
* Use b
ox mue
ller to generate
g
aussian random
s
/* This will disappear with a thread safe random number generator s
ervice.
* Use b
asic Box-Mu
ller to generate
G
aussian random
numbers.
* The quality is not good for in depth study given that the generator is a
* linear congruent.
* Throw away basically a free number: we are in a cpu cruncher after all.
...
...
@@ -227,7 +227,7 @@ StatusCode CPUCruncher::execute() // the execution of the algorithm
unsigned
int
seed
=
std
::
clock
();
auto
getUnifRandom
=
[](
unsigned
int
&
seed
)
->
double
{
// from
n
umerical
r
ecip
i
es
// from
"N
umerical
R
ecipes
"
constexpr
unsigned
int
m
=
232
;
constexpr
unsigned
int
a
=
1664525
;
constexpr
unsigned
int
c
=
1013904223
;
...
...
@@ -236,11 +236,17 @@ StatusCode CPUCruncher::execute() // the execution of the algorithm
return
unif
;
};
const
double
unif1
=
getUnifRandom
(
seed
);
const
double
unif2
=
getUnifRandom
(
seed
);
double
unif1
,
unif2
;
do
{
unif1
=
getUnifRandom
(
seed
);
unif2
=
getUnifRandom
(
seed
);
}
while
(
unif1
==
0.
);
const
double
normal
=
sqrt
(
-
2.
*
log
(
unif1
)
)
*
cos
(
2
*
M_PI
*
unif2
);
return
normal
*
sigma
+
mean
;
};
crunchtime
=
fabs
(
getGausRandom
(
m_avg_runtime
*
(
1.
-
m_sleepFraction
),
m_var_runtime
)
);
// End Of temp block
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment