Skip to content

Add hillshade benchmarking for numpy, cupy and rtxpy #625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions benchmarks/benchmarks/hillshade.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from xrspatial import hillshade
from .common import get_xr_dataarray


class Hillshade:
# Note that rtxpy hillshade includes shadow calculations so timings are
# not comparable with numpy and cupy hillshade.
params = ([100, 300, 1000, 3000], ["numpy", "cupy", "rtxpy"])
param_names = ("nx", "type")

def setup(self, nx, type):
ny = nx // 2
self.xr = get_xr_dataarray(
(ny, nx), type, different_each_call=(type == "rtxpy"))

def time_hillshade(self, nx, type):
shadows = (type == "rtxpy")
hillshade(self.xr, shadows=shadows)