Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
amdis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
iwr
amdis
Commits
960408e0
Commit
960408e0
authored
14 years ago
by
Backofen, Rainer
Browse files
Options
Downloads
Patches
Plain Diff
fixed bug in runtime calculation, initialTimestamp was not set correctly
parent
8daad3cb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
AMDiS/src/AdaptInstationary.cc
+20
-18
20 additions, 18 deletions
AMDiS/src/AdaptInstationary.cc
AMDiS/src/AdaptInstationary.h
+3
-5
3 additions, 5 deletions
AMDiS/src/AdaptInstationary.h
with
23 additions
and
23 deletions
AMDiS/src/AdaptInstationary.cc
+
20
−
18
View file @
960408e0
...
...
@@ -13,7 +13,7 @@ namespace AMDiS {
AdaptInfo
*
info
,
ProblemTimeInterface
*
problemInstat
,
AdaptInfo
*
initialInfo
,
time_t
initialTimestamp
)
time_t
initialTimestamp
Set
)
:
AdaptBase
(
name
,
problemStat
,
info
,
problemInstat
,
initialInfo
),
breakWhenStable
(
0
),
dbgMode
(
false
)
...
...
@@ -23,8 +23,9 @@ namespace AMDiS {
// MSG("You make use of the obsolete constructor AdaptInstationary::AdaptInstationary(...)!\n");
// MSG("Please use the constructor that uses references instead of pointers!\n");
initConstructor
(
problemStat
,
info
,
initialInfo
,
initialTimestamp
);
}
initConstructor
(
problemStat
,
info
,
initialInfo
,
initialTimestampSet
);
}
AdaptInstationary
::
AdaptInstationary
(
std
::
string
name
,
...
...
@@ -32,31 +33,32 @@ namespace AMDiS {
AdaptInfo
&
info
,
ProblemTimeInterface
&
problemInstat
,
AdaptInfo
&
initialInfo
,
time_t
initialTimestamp
)
time_t
initialTimestamp
Set
)
:
AdaptBase
(
name
,
&
problemStat
,
&
info
,
&
problemInstat
,
&
initialInfo
),
breakWhenStable
(
0
),
dbgMode
(
false
)
{
FUNCNAME
(
"AdaptInstationary::AdaptInstationary()"
);
initConstructor
(
&
problemStat
,
&
info
,
&
initialInfo
,
initialTimestamp
);
initConstructor
(
&
problemStat
,
&
info
,
&
initialInfo
,
initialTimestampSet
);
}
void
AdaptInstationary
::
initConstructor
(
ProblemIterationInterface
*
problemStat
,
AdaptInfo
*
info
,
AdaptInfo
*
initialInfo
,
time_t
initialTimestamp
)
time_t
initialTimestamp
Set
)
{
initialize
(
name
);
fixedTimestep
=
(
info
->
getMinTimestep
()
==
info
->
getMaxTimestep
());
if
(
initialTimestamp
==
0
)
if
(
initialTimestamp
Set
==
0
)
initialTimestamp
=
time
(
NULL
);
else
initialTimestamp
=
initialTimestamp
;
initialTimestamp
=
initialTimestamp
Set
;
// Check if the problem should be deserialized because of the -rs parameter.
std
::
string
serializationFilename
=
""
;
GET_PARAMETER
(
0
,
"argv->rs"
,
&
serializationFilename
);
...
...
@@ -279,7 +281,6 @@ namespace AMDiS {
int
AdaptInstationary
::
adapt
()
{
FUNCNAME
(
"AdaptInstationary::adapt()"
);
int
errorCode
=
0
;
TEST_EXIT
(
adaptInfo
->
getTimestep
()
>=
adaptInfo
->
getMinTimestep
())
...
...
@@ -308,10 +309,12 @@ namespace AMDiS {
oneTimestep
();
problemTime
->
closeTimestep
(
adaptInfo
);
if
(
breakWhenStable
&&
(
adaptInfo
->
getSolverIterations
()
==
0
))
{
if
(
breakWhenStable
&&
(
adaptInfo
->
getSolverIterations
()
==
0
))
break
;
}
/*
if (adaptInfo->forceBreak)
break;
*/
// Check if there is a runtime limitation. If there is a runtime limitation
// and there is no more time for a next adaption loop, than return the error
// code for rescheduling the problem and break the adaption loop.
...
...
@@ -374,7 +377,6 @@ namespace AMDiS {
if
(
queueRuntime
==
-
1
)
{
return
false
;
}
// Get the current time.
time_t
currentTimestamp
=
time
(
NULL
);
...
...
@@ -388,11 +390,11 @@ namespace AMDiS {
std
::
queue
<
int
>
tmpQueue
=
lastIterationsDuration
;
int
avrgLastIterations
=
0
;
while
(
!
tmpQueue
.
empty
())
{
avrgLastIterations
+=
tmpQueue
.
front
();
tmpQueue
.
pop
();
avrgLastIterations
+=
tmpQueue
.
front
();
tmpQueue
.
pop
();
}
avrgLastIterations
/=
lastIterationsDuration
.
size
();
// Check if there is enough time for a further iteration.
if
(
initialTimestamp
+
queueRuntime
-
currentTimestamp
<
avrgLastIterations
*
2
)
{
std
::
ofstream
out
(
queueSerializationFilename
.
c_str
());
...
...
This diff is collapsed.
Click to expand it.
AMDiS/src/AdaptInstationary.h
+
3
−
5
View file @
960408e0
...
...
@@ -50,7 +50,7 @@ namespace AMDiS {
AdaptInfo
*
info
,
ProblemTimeInterface
*
problemInstat
,
AdaptInfo
*
initialInfo
,
time_t
initialTimestamp
=
0
);
time_t
initialTimestamp
Set
=
0
);
/** \brief
* Creates a AdaptInstationary object with the given name for the time
...
...
@@ -61,7 +61,7 @@ namespace AMDiS {
AdaptInfo
&
info
,
ProblemTimeInterface
&
problemInstat
,
AdaptInfo
&
initialInfo
,
time_t
initialTimestamp
=
0
);
time_t
initialTimestamp
Set
=
0
);
/** \brief
* This funciton is used only to avoid double code in both constructors. If the
...
...
@@ -72,7 +72,7 @@ namespace AMDiS {
void
initConstructor
(
ProblemIterationInterface
*
problemStat
,
AdaptInfo
*
info
,
AdaptInfo
*
initialInfo
,
time_t
initialTimestamp
);
time_t
initialTimestamp
Set
);
/// Destructor
virtual
~
AdaptInstationary
();
...
...
@@ -88,7 +88,6 @@ namespace AMDiS {
{
return
strategy
;
}
/// Implementation of AdaptBase::adapt()
virtual
int
adapt
();
...
...
@@ -152,7 +151,6 @@ namespace AMDiS {
* of solver iterations to solve the problem is zero, the adaption loop will stop.
*/
int
breakWhenStable
;
///
bool
fixedTimestep
;
...
...
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