Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

[BUG] Correlate2d takes a lot of time when small filter is input first #539

Open
OfekCohen1 opened this issue Jan 24, 2023 · 0 comments
Open
Assignees
Labels
1 - On Deck To be worked on next improvement Improvement / enhancement to an existing function

Comments

@OfekCohen1
Copy link

Describe the bug
Correlate2d receives two array arguments: (a,b). When b is the larger array, it takes a lot more time to compute than when a is the larger array. One would not expect this to happen, since correlate should be invariant to swapping when mode is full.

Steps/Code to reproduce bug
Code:

import cusignal
import cupy as cp
from cupyx.profiler import benchmark

large_array = cp.zeros((1000, 1000))
small_array = cp.zeros((1, 10))

# Expected order of arguments - fast runtime
print(benchmark(cusignal.correlate2d, (large_array, small_array, 'full'), n_repeat=5))

# Swapped order of arguments - slower runtime
print(benchmark(cusignal.correlate2d, (small_array, large_array, 'full'), n_repeat=5))

Expected behavior
Expect them to run at the same time. An easy fix - check which filter is larger and swap them in the implementation.

Environment details (please complete the following information):
Nothing special here

@OfekCohen1 OfekCohen1 added ? - Needs Triage Need team to review and classify bug Something isn't working labels Jan 24, 2023
@awthomp awthomp self-assigned this Jan 26, 2023
@awthomp awthomp added 1 - On Deck To be worked on next improvement Improvement / enhancement to an existing function and removed ? - Needs Triage Need team to review and classify bug Something isn't working labels Jan 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 - On Deck To be worked on next improvement Improvement / enhancement to an existing function
Projects
None yet
Development

No branches or pull requests

2 participants