-
Notifications
You must be signed in to change notification settings - Fork 60
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
Slowness seen using PiecewiseAffineTransform compared to scikit-image version #698
Comments
Hi @JHancox, thanks for reporting this. Can you specify the shape and dtype of Unfortunately
In general, for I don't doubt that the GPU is slower here, but wanted to mention that using
To handle the above issues automatically, CuPy provides a from cupyx.profiler import benchmark
perf_cpu = benchmark(
warp,
args=(imgrid, tform),
kwargs=dict(output_shape=255, 255),
n_warmup=10,
n_repeat=10000,
max_duration=5) # cap at 5 seconds duration
print(f"warp: avg CPU time = {perf_cpu.cpu_times.mean()}")
cu_imgrid = cp.array(imgrid)
perf_gpu = benchmark(
cu_warp,
args=(cu_imgrid, cu_tform),
kwargs=dict(output_shape=255, 255),
n_warmup=10,
n_repeat=10000,
max_duration=5) # cap at 5 seconds duration
print(f"warp: avg GPU time = {perf_gpu.gpu_times.mean()}") |
Thanks for the details @grlee77. In this case the image was 256 x 256 but I will try larger images and see what happens. Thanks for the tip on the timeit - you are quite right. Often there is some implicit mem synch operation involved anyhow, but I should be explicit about it. |
Describe the bug
The cucim.skimage.transform.PiecewiseAffineTransform seems to be several times slower than the scikit-image equivalent
Steps/Code to reproduce bug
When running the code below, I observe a 8x slowdown for the estimate and 2x slowdown for the warp operations using the PyTorch 24.01 container with cucim 23.12
Expected behavior
The code should execute at least as fast as the cpu version
Environment details (please complete the following information):
Docker on Ubuntu 22.04
PyTorch 24.01 container with scikit-image and cucim 23.12 pip installed
Additional context
The text was updated successfully, but these errors were encountered: