Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cdo
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor 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
mpim-sw
cdo
Commits
693a3e89
Commit
693a3e89
authored
1 year ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
Timstat: changed to Task::doAsync()
parent
239790e4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!222
M214003/develop
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Timstat.cc
+9
-45
9 additions, 45 deletions
src/Timstat.cc
with
9 additions
and
45 deletions
src/Timstat.cc
+
9
−
45
View file @
693a3e89
...
...
@@ -409,36 +409,6 @@ public:
}
}
struct
FuncArgs
{
FieldVector3D
&
fields3D
;
std
::
vector
<
RecordInfo
>
&
recordList
;
VarList
&
varList1
;
cdo
::
StepStat2D
&
stepStat
;
int
t
{
0
};
int
numSets
{
0
};
FuncArgs
(
FieldVector3D
&
_fields3D
,
std
::
vector
<
RecordInfo
>
&
_recordList
,
VarList
&
_varList1
,
cdo
::
StepStat2D
&
_stepStat
)
:
fields3D
(
_fields3D
),
recordList
(
_recordList
),
varList1
(
_varList1
),
stepStat
(
_stepStat
)
{
}
void
set
(
int
_t
,
int
_numSets
)
{
t
=
_t
;
numSets
=
_numSets
;
}
};
static
void
*
records_add_fields2D_func
(
void
*
_args
)
{
FuncArgs
*
args
=
(
FuncArgs
*
)
_args
;
records_add_fields2D
(
args
->
fields3D
[
args
->
t
],
args
->
recordList
,
args
->
varList1
,
args
->
stepStat
,
args
->
numSets
);
return
nullptr
;
}
void
run_async
()
{
...
...
@@ -454,7 +424,6 @@ public:
auto
useTask
=
true
;
cdo
::
Task
task
;
FuncArgs
funcArgs
(
fields3D
,
recordList
,
varList1
,
stepStat
);
int
tsID
=
0
;
int
otsID
=
0
;
...
...
@@ -487,18 +456,13 @@ public:
cdo_read_record
(
streamID1
,
fields3D
[
numSets
%
2
][
varID
][
levelID
]);
}
if
(
useTask
)
{
if
(
numSets
>
0
)
task
.
wait
();
funcArgs
.
set
(
numSets
%
2
,
numSets
);
task
.
start
(
records_add_fields2D_func
,
&
funcArgs
);
}
else
{
funcArgs
.
set
(
numSets
%
2
,
numSets
);
records_add_fields2D_func
(
&
funcArgs
);
// records_add_fields2D(fields3D[numSets % 2], recordList, varList1, stepStat, numSets);
}
if
(
useTask
&&
numSets
>
0
)
task
.
wait
();
std
::
function
<
void
()
>
records_add_fields2D_func
=
std
::
bind
(
records_add_fields2D
,
std
::
cref
(
fields3D
[
numSets
%
2
]),
std
::
cref
(
recordList
),
std
::
cref
(
varList1
),
std
::
ref
(
stepStat
),
numSets
);
useTask
?
task
.
doAsync
(
records_add_fields2D_func
)
:
records_add_fields2D_func
();
vDateTimeN
=
vDateTime
;
numSets
++
;
...
...
@@ -538,8 +502,8 @@ public:
void
run
()
override
{
auto
doR
unAsync
=
(
Options
::
CDO_Parallel_Read
>
0
);
if
(
doR
unAsync
)
auto
r
unAsync
=
(
Options
::
CDO_Parallel_Read
>
0
);
if
(
r
unAsync
)
run_async
();
else
run_sync
();
...
...
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