Skip to content

Instantly share code, notes, and snippets.

@wphicks
Created February 9, 2021 19:01
Show Gist options
  • Save wphicks/774701358b3aa4be33277aa4cc7cd7d2 to your computer and use it in GitHub Desktop.
Save wphicks/774701358b3aa4be33277aa4cc7cd7d2 to your computer and use it in GitHub Desktop.
Quick benchmark for cupy.percentile
import cupy
from cupyx.time import repeat
cupy.random.seed(0)
for size in (5, 50, 500, 5000, 50000, int(5e6)):
a = cupy.random.rand(size)
q = cupy.linspace(0, 100, 3)
def f():
cupy.percentile(a, q, interpolation='linear')
print(f"For array of length {size}")
print(repeat(f))
print()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment