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
Merged
[hiopy] Subtasks
subtasks
into
main
Overview
0
Commits
4
Pipelines
5
Changes
10
Merged
Nils-Arne Dreier
requested to merge
subtasks
into
main
1 month ago
Overview
0
Commits
4
Pipelines
5
Changes
10
Expand
Creating subtasks for the flush operation in hiopy.
Edited
3 weeks ago
by
Nils-Arne Dreier
0
0
Merge request reports
Compare
main
version 4
deb4e400
3 weeks ago
version 3
5353420f
1 month ago
version 2
40e8c240
1 month ago
version 1
0fe729df
1 month ago
main (base)
and
version 4
latest version
45ff6dcc
4 commits,
3 weeks ago
version 4
deb4e400
4 commits,
3 weeks ago
version 3
5353420f
4 commits,
1 month ago
version 2
40e8c240
4 commits,
1 month ago
version 1
0fe729df
4 commits,
1 month ago
10 files
+
145
−
32
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
10
Search (e.g. *.vue) (Ctrl+P)
apps/hiopy/_data_handler.py
+
31
−
17
Options
@@ -2,6 +2,7 @@ import logging
from
time
import
perf_counter
import
numpy
as
np
from
coyote
import
add_task
class
Timer
:
@@ -28,25 +29,38 @@ class DataHandler:
if
self
.
use_buffer
:
self
.
buf
=
np
.
empty
([
self
.
time_chunk_size
,
*
var
.
shape
[
1
:
-
1
],
ma
-
mi
],
dtype
=
var
.
dtype
)
def
flush
(
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
logging
.
info
(
f
"
pruned
{
self
.
var
.
name
}
for timesteps
{
fro
}
:
{
to
}
. Took
{
t
.
elapsed_time
}
s
"
)
def
_create_flush_task
(
self
):
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
]
=
self
.
buf
[
fro
:
to
,
...]
logging
.
info
(
f
"
wrote
{
self
.
var
.
name
}
for timesteps
{
self
.
t_flushed
}
:
{
self
.
t
}
.
"
f
"
Took
{
t
.
elapsed_time
}
s
"
)
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
:
prune_from
=
max
(
0
,
t_flushed
-
self
.
prune_offset
)
prune_to
=
max
(
0
,
t
-
self
.
prune_offset
)
with
Timer
()
as
timer
:
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
{
timer
.
elapsed_time
}
s
"
)
with
Timer
()
as
timer
:
self
.
var
[
t_flushed
:
t
,
...,
self
.
cell_slice
]
=
buf
logging
.
info
(
f
"
wrote
{
self
.
var
.
name
}
for timesteps
{
t_flushed
}
:
{
t
}
.
"
f
"
Took
{
timer
.
elapsed_time
}
s
"
)
if
self
.
loco_server
is
not
None
:
self
.
loco_server
.
set_timestep
(
self
.
var
.
name
,
t
-
1
)
self
.
t_flushed
=
self
.
t
if
self
.
loco_server
is
not
None
:
self
.
loco_server
.
set_timestep
(
self
.
var
.
name
,
self
.
t
-
1
)
return
_flush
def
flush
(
self
):
self
.
_create_flush_task
()()
def
__call__
(
self
,
event
):
logging
.
info
(
@@ -59,7 +73,7 @@ class DataHandler:
self
.
buf
=
np
.
squeeze
(
np
.
transpose
(
event
.
data
))[
None
,
...]
self
.
t
+=
1
if
self
.
t
%
self
.
time_chunk_size
==
0
or
not
self
.
use_buffer
:
# chunk complete
self
.
flush
()
add_task
(
self
.
_create_flush_task
()
)
def
set_loco_server
(
self
,
loco_server
):
self
.
loco_server
=
loco_server
Loading