cuspatial icon indicating copy to clipboard operation
cuspatial copied to clipboard

[BUG] cuspatial.interpolate.CubicSpline produces an erroneous interpolation

Open dioph opened this issue 4 years ago • 11 comments

Describe the bug cuspatial.interpolate.CubicSpline produces a (very) different result from scipy.interpolate.CubicSpline

Steps/Code to reproduce bug

import cudf
import cupy as cp
import cuspatial
import numpy as np
from scipy import interpolate

t = cudf.Series(cp.array([0, 1, 2, 3, 4])).astype("float32")
x = cudf.Series(cp.array([3, 2, 3, 4, 3])).astype("float32")
g = cuspatial.interpolate.CubicSpline(t, x)
h = interpolate.CubicSpline(t.to_pandas().values, x.to_pandas().values)

t0_gpu = cudf.Series(cp.array([0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4])).astype("float32")
t0_cpu = np.array([0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4])

# alternatively to printing, it's also possible to compare both curves by plotting them
print(g(t0_gpu))
print(h(t0_cpu))

Expected behavior cuspatial interpolation should give the same result. In particular, it should give the same input values at the control points, which it doesn't.

Environment details: conda install, rapids v0.19, cupy v8.6

Additional context Sometimes the above code can also raise cudaErrorIllegalAddress (similar to #319), especially if I initialize the cudf.Series objects with numpy arrays instead of cupy

dioph avatar Jun 18 '21 14:06 dioph

Thanks @dioph ! I have also discovered this and have been at work on it the last couple of days. A new PR is coming up shortly to correct some surprising bugs I found.

thomcom avatar Jun 18 '21 20:06 thomcom

Thanks for the heads-up! I'll be sure to keep an eye out for future updates. On a side note, I realized that I was using a slightly outdated version, so I gave the latest nightly release a go, but the issue still persists. The cudaErrorIllegalAddress is also more prevalent, and I can hardly run the same snippet without raising a RuntimeError.

dioph avatar Jul 05 '21 11:07 dioph

Hey it has been a bit. Just letting you know I'm investigating a bug in another component of the system that appears to be causing this one.

thomcom avatar Jul 23 '21 15:07 thomcom

Hi, just as an update in case anyone else with the same problem follows this thread, I recently tried updating rapids to 21.10, with the same results.

dioph avatar Oct 02 '21 14:10 dioph

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

github-actions[bot] avatar Nov 23 '21 20:11 github-actions[bot]

This issue has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.

github-actions[bot] avatar Feb 21 '22 21:02 github-actions[bot]

@thomcom did you make any progress on this issue last year? Can you update with your findings so they do not get forgotten?

harrism avatar Feb 22 '22 03:02 harrism

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

github-actions[bot] avatar Mar 24 '22 03:03 github-actions[bot]

Thanks for asking Mark. There is a bug in cuSparse that is filed, I think they're planning on addressing it in the next version.

thomcom avatar Mar 29 '22 18:03 thomcom

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

github-actions[bot] avatar Apr 28 '22 18:04 github-actions[bot]

This issue has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.

github-actions[bot] avatar Jul 27 '22 19:07 github-actions[bot]

We dropped cubic spline interpolation from cuspatial in #959. It was buggy and unused. If you feel it is still important to support, we can investigate re-adding support. Closing this.

harrism avatar Feb 28 '23 21:02 harrism