cuspatial
cuspatial copied to clipboard
[BUG] cuspatial.interpolate.CubicSpline produces an erroneous interpolation
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
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.
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.
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.
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.
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.
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.
@thomcom did you make any progress on this issue last year? Can you update with your findings so they do not get forgotten?
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.
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.
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.
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.
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.