Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coyote
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nils
coyote
Merge requests
!51
[hiopy] Subtasks
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
[hiopy] Subtasks
subtasks
into
main
Overview
0
Commits
4
Pipelines
5
Changes
1
Open
Nils-Arne Dreier
requested to merge
subtasks
into
main
3 weeks ago
Overview
0
Commits
4
Pipelines
5
Changes
1
Expand
Creating subtasks for the flush operation in hiopy.
Edited
4 days ago
by
Nils-Arne Dreier
0
0
Merge request reports
Viewing commit
40e8c240
Show latest version
1 file
+
17
−
14
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
40e8c240
fix: capture t explicitly in flush task
· 40e8c240
Nils-Arne Dreier
authored
1 month ago
apps/hiopy/_data_handler.py
+
17
−
14
Options
@@ -30,30 +30,33 @@ class DataHandler:
self
.
buf
=
np
.
empty
([
self
.
time_chunk_size
,
*
var
.
shape
[
1
:
-
1
],
ma
-
mi
],
dtype
=
var
.
dtype
)
def
_create_flush_task
(
self
):
old_buffer
=
self
.
buf
.
copy
()
fro
=
self
.
t_flushed
%
self
.
time_chunk_size
to
=
fro
+
(
self
.
t
-
self
.
t_flushed
)
buf
=
self
.
buf
[
fro
:
to
,
...].
copy
()
t_flushed
=
int
(
self
.
t_flushed
)
t
=
int
(
self
.
t
)
def
_flush
():
nonlocal
t
,
t_flushed
,
buf
,
self
if
self
.
prune_offset
is
not
None
:
fro
=
max
(
0
,
self
.
t_flushed
-
self
.
prune_offset
)
to
=
max
(
0
,
self
.
t
-
self
.
prune_offset
)
with
Timer
()
as
t
:
self
.
var
[
fro
:
to
,
...,
self
.
cell_slice
]
=
self
.
var
.
fill_value
prune_
fro
m
=
max
(
0
,
t_flushed
-
self
.
prune_offset
)
prune_
to
=
max
(
0
,
t
-
self
.
prune_offset
)
with
Timer
()
as
t
imer
:
self
.
var
[
prune_from
:
prune_
to
,
...,
self
.
cell_slice
]
=
self
.
var
.
fill_value
logging
.
info
(
f
"
pruned
{
self
.
var
.
name
}
for timesteps
{
fro
}
:
{
to
}
. Took
{
t
.
elapsed_time
}
s
"
f
"
pruned
{
self
.
var
.
name
}
for timesteps
{
fro
}
:
{
to
}
. Took
{
t
imer
.
elapsed_time
}
s
"
)
fro
=
self
.
t_flushed
%
self
.
time_chunk_size
to
=
fro
+
(
self
.
t
-
self
.
t_flushed
)
with
Timer
()
as
t
:
self
.
var
[
self
.
t_flushed
:
self
.
t
,
...,
self
.
cell_slice
]
=
old_buffer
[
fro
:
to
,
...]
with
Timer
()
as
timer
:
self
.
var
[
t_flushed
:
t
,
...,
self
.
cell_slice
]
=
buf
logging
.
info
(
f
"
wrote
{
self
.
var
.
name
}
for timesteps
{
self
.
t_flushed
}
:
{
self
.
t
}
.
"
f
"
Took
{
t
.
elapsed_time
}
s
"
f
"
wrote
{
self
.
var
.
name
}
for timesteps
{
t_flushed
}
:
{
t
}
.
"
f
"
Took
{
t
imer
.
elapsed_time
}
s
"
)
self
.
t_flushed
=
self
.
t
if
self
.
loco_server
is
not
None
:
self
.
loco_server
.
set_timestep
(
self
.
var
.
name
,
self
.
t
-
1
)
self
.
loco_server
.
set_timestep
(
self
.
var
.
name
,
t
-
1
)
self
.
t_flushed
=
self
.
t
return
_flush
def
flush
(
self
):
Loading