Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
finam
Manage
Activity
Members
Labels
Plan
Issues
32
Issue boards
Milestones
Code
Merge requests
4
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FINAM
finam
Commits
6985efe0
Commit
6985efe0
authored
2 years ago
by
Martin Lange
Browse files
Options
Downloads
Patches
Plain Diff
use cProfile as a module to avoid showing the Py baseline overhead
parent
eec0a63a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!234
No startup overhead in profiling
Pipeline
#134132
passed with stages
in 6 minutes and 42 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
benchmarks/profiling/simple_numpy.py
+18
-2
18 additions, 2 deletions
benchmarks/profiling/simple_numpy.py
benchmarks/profiling/simple_xarray.py
+18
-2
18 additions, 2 deletions
benchmarks/profiling/simple_xarray.py
benchmarks/run_profiling.sh
+1
-1
1 addition, 1 deletion
benchmarks/run_profiling.sh
with
37 additions
and
5 deletions
benchmarks/profiling/simple_numpy.py
+
18
−
2
View file @
6985efe0
...
...
@@ -5,7 +5,11 @@ Two components, coupled via a single link.
Simulation runs for 1 year with a daily step in both components.
Components exchange a 128x64 uniform grid.
"""
import
cProfile
import
datetime
as
dt
import
io
import
pstats
import
sys
import
finam
as
fm
...
...
@@ -52,6 +56,18 @@ def run_model():
composition
.
run
(
end_time
=
end_time
)
if
__name__
==
"
__main__
"
:
for
i
in
range
(
10
):
def
run_model_multi
(
n
)
:
for
_
in
range
(
n
):
run_model
()
if
__name__
==
"
__main__
"
:
pr
=
cProfile
.
Profile
()
pr
.
enable
()
run_model_multi
(
10
)
pr
.
disable
()
s
=
io
.
StringIO
()
ps
=
pstats
.
Stats
(
pr
,
stream
=
s
).
sort_stats
(
pstats
.
SortKey
.
CUMULATIVE
)
ps
.
dump_stats
(
sys
.
argv
[
1
])
This diff is collapsed.
Click to expand it.
benchmarks/profiling/simple_xarray.py
+
18
−
2
View file @
6985efe0
...
...
@@ -5,7 +5,11 @@ Two components, coupled via a single link.
Simulation runs for 1 year with a daily step in both components.
Components exchange a 128x64 uniform grid.
"""
import
cProfile
import
datetime
as
dt
import
io
import
pstats
import
sys
import
finam
as
fm
...
...
@@ -52,6 +56,18 @@ def run_model():
composition
.
run
(
end_time
=
end_time
)
if
__name__
==
"
__main__
"
:
for
i
in
range
(
10
):
def
run_model_multi
(
n
)
:
for
_
in
range
(
n
):
run_model
()
if
__name__
==
"
__main__
"
:
pr
=
cProfile
.
Profile
()
pr
.
enable
()
run_model_multi
(
10
)
pr
.
disable
()
s
=
io
.
StringIO
()
ps
=
pstats
.
Stats
(
pr
,
stream
=
s
).
sort_stats
(
pstats
.
SortKey
.
CUMULATIVE
)
ps
.
dump_stats
(
sys
.
argv
[
1
])
This diff is collapsed.
Click to expand it.
benchmarks/run_profiling.sh
+
1
−
1
View file @
6985efe0
...
...
@@ -7,7 +7,7 @@ for filename in benchmarks/profiling/*.py; do
fn
=
$(
basename
--
"
$filename
"
)
fn
=
"
${
fn
%.*
}
"
echo
"
$fn
"
python
-m
cProfile
-o
prof/
"
$fn
"
.pstats
benchmarks/profiling/
"
$fn
"
.py
python benchmarks/profiling/
"
$fn
"
.py
prof/
"
$fn
"
.pstats
gprof2dot
--colour-nodes-by-selftime
-f
pstats prof/
"
$fn
"
.pstats
>
prof/
"
$fn
"
.dot
dot
-Tsvg
-o
prof/
"
$fn
"
.svg prof/
"
$fn
"
.dot
dot
-Tpng
-o
prof/
"
$fn
"
.png prof/
"
$fn
"
.dot
...
...
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