Cuspatial demo running error

Hi team,

I was trying to use cuspatial hausdorff function for trajectory clustering. I am following a github page :wkelongws/trajectory_clustering_with_cuspatial

But there they are converting the trajectory dataset to image points before doing hausdorff distance calculation.
I wanted to do the hausdorff distance calculation on the original trajectory values (either lat/ long if permissible or on corresponding utm values) and then cluster it using DB scan as shown in example.
But when I tried with utm converted values am getting following error

(rapids) [root@nithin-rapids cuspatial]# python ./python/cuspatial/demos/hausdorff_clustering_test_toy.py
Traceback (most recent call last):
File “/share/adas_coe_159/nithin/cuspatial/./python/cuspatial/demos/hausdorff_clustering_test_toy.py”, line 39, in
distance = cuspatial.directed_hausdorff_distance(pnt_x, pnt_y, cnt)
File “/opt/conda/envs/rapids/lib/python3.10/site-packages/cuspatial/core/spatial/distance.py”, line 97, in directed_hausdorff_distance
return DataFrame(result)
File “/opt/conda/envs/rapids/lib/python3.10/contextlib.py”, line 79, in inner
return func(*args, **kwds)
File “/opt/conda/envs/rapids/lib/python3.10/site-packages/cudf/core/dataframe.py”, line 679, in init
new_df = self._from_arrays(data, index=index, columns=columns)
File “/opt/conda/envs/rapids/lib/python3.10/contextlib.py”, line 79, in inner
return func(*args, **kwds)
File “/opt/conda/envs/rapids/lib/python3.10/site-packages/cudf/core/dataframe.py”, line 5404, in _from_arrays
df._data[k] = column.as_column(
File “/opt/conda/envs/rapids/lib/python3.10/site-packages/cudf/core/column/column.py”, line 1887, in as_column
arbitrary = cupy.ascontiguousarray(arbitrary)
File “/opt/conda/envs/rapids/lib/python3.10/site-packages/cupy/_creation/from_data.py”, line 107, in ascontiguousarray
return _core.ascontiguousarray(a, dtype)
File “cupy/_core/core.pyx”, line 2673, in cupy._core.core.ascontiguousarray
File “cupy/_core/core.pyx”, line 2689, in cupy._core.core.ascontiguousarray
File “cupy/_core/core.pyx”, line 136, in cupy._core.core.ndarray.new
File “cupy/_core/core.pyx”, line 224, in cupy._core.core._ndarray_base._init
File “cupy/cuda/memory.pyx”, line 742, in cupy.cuda.memory.alloc
File “/opt/conda/envs/rapids/lib/python3.10/site-packages/rmm/rmm.py”, line 230, in rmm_cupy_allocator
buf = librmm.device_buffer.DeviceBuffer(size=nbytes, stream=stream)
File “device_buffer.pyx”, line 85, in rmm._lib.device_buffer.DeviceBuffer.cinit
MemoryError: std::bad_alloc: CUDA error at: /opt/conda/envs/rapids/include/rmm/mr/device/cuda_memory_resource.hpp
(rapids) [root@nithin-rapids cuspatial]# python ./python/cuspatial/demos/hausdorff_clustering_test_toy.py

Could you please let me know what could be the source of error?

Thank you,
Nithin

One thing observed is,
The function ‘cuspatial.directed_hausdorff_distance’ is working for a smaller dataset of size 25 trajectories. when I gave 50 trajectories I was getting above error

Sorry for the delay, was on leave. The example that you pointed to is 4 years old and most likely works with a 2.5 - 3 year old version of cuspatial, which is about the last time I ran it. CuSpatial has been updated quite a few times since then. It’s also on a private repo instead of the official repo. Please look at cuspatial/notebooks at branch-23.04 · rapidsai/cuspatial · GitHub for the current latest notebooks as of March 2023. You just have to keep edit that link to the latest branch (or go to GitHub - rapidsai/cuspatial: CUDA-accelerated GIS and spatiotemporal algorithms and click the notebooks folder)