-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'topic/default/add-sample-wake_legi' into 'branch/default'
Performance optimizations for PIV See merge request fluiddyn/fluidimage!94
- Loading branch information
Showing
14 changed files
with
646 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
"""Profile PIV work with pyinstrument | ||
Result with fluidimage 0.4.4: | ||
total: ~4.7 s | ||
- ~25% _compute_indices_max, fluidimage/calcul/correl.py:78 | ||
- ~25% CorrelFFTW.__call__, fluidimage/calcul/correl.py:690 (10.4% fftshift, ~1% fft) | ||
- ~10% WorkPIVFromDisplacement._crop_im0 (and 1) fluidimage/works/piv/singlepass.py:403 | ||
- ~17% smooth_clean fluidimage/calcul/smooth_clean.py:25 (9% griddata) | ||
""" | ||
|
||
import os | ||
|
||
from pyinstrument import Profiler | ||
from pyinstrument.renderers import ConsoleRenderer | ||
|
||
from fluidimage.piv import Work | ||
|
||
os.environ["OMP_NUM_THREADS"] = "1" | ||
|
||
params = Work.create_default_params() | ||
|
||
params.series.path = "../../image_samples/wake_legi/images/B*.png" | ||
|
||
params.piv0.shape_crop_im0 = 40 | ||
params.piv0.displacement_max = 14 | ||
|
||
params.piv0.nb_peaks_to_search = 2 | ||
params.piv0.particle_radius = 3 | ||
|
||
params.mask.strcrop = ":, :1500" | ||
|
||
params.multipass.number = 2 | ||
|
||
params.multipass.use_tps = "last" | ||
# params.multipass.use_tps = False | ||
params.multipass.subdom_size = 200 | ||
params.multipass.smoothing_coef = 10.0 | ||
params.multipass.threshold_tps = 0.5 | ||
|
||
params.fix.correl_min = 0.15 | ||
params.fix.threshold_diff_neighbour = 3 | ||
|
||
work = Work(params=params) | ||
|
||
profiler = Profiler() | ||
profiler.start() | ||
piv = work.process_1_serie() | ||
profiler.stop() | ||
|
||
print( | ||
profiler.output( | ||
renderer=ConsoleRenderer( | ||
unicode=True, | ||
color=True, | ||
show_all=False, | ||
# time="percent_of_total", | ||
# flat=True, # buggy with pyinstrument 4.6.2! | ||
) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ build-backend = 'mesonpy' | |
|
||
[project] | ||
name = "fluidimage" | ||
version = "0.4.4" | ||
version = "0.4.5" | ||
description = "Fluid image processing with Python." | ||
authors = [ | ||
{name = "Pierre Augier", email = "[email protected]"}, | ||
|
@@ -64,7 +64,7 @@ pims = ["pims"] | |
opencv = ["opencv-python"] | ||
graph = ["gprof2dot"] | ||
pytest = ["pytest", "pytest-asyncio"] | ||
all = ["fluidimage[pims, opencv-python, gprof2dot, pytest]"] | ||
all = ["fluidimage[pims, opencv, graph, pytest]"] | ||
# qt = ["PySide6"] | ||
|
||
[project.entry-points."fluidimage.executors"] | ||
|
@@ -124,6 +124,7 @@ dev = [ | |
"isort", | ||
"ipdb>=0.13.13", | ||
"textual-dev", | ||
"pyinstrument", | ||
] | ||
|
||
[tool.pdm.scripts] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.