GPU-Accelerated Spatial and Trajectory Data Management and Analytics Library
NOTE: cuSpatial depends on cudf and rmm under RAPDIS framework
See here
for a brief summary/discussion on C++ backend performance (as standalone components and with comparions to serial/mutli-core implementations on CPUs and/or legacy code)
See the deisgn documentation for a breif description on how spatial and trajectory data are represented in cuSpatial and the graph of operations on them.
1) [spatial window query](cpp/src/stq)
2) [point-in-polygon test](cpp/src/spatial)
3) [deriving trajectories from point location data](cpp/src/traj)
4) [computing distance/speed of trajectories](cpp/src/traj)
5) [computing spatial bounding boxes of trajectories](cpp/src/traj)
Another subset of operations will be added shortly:
1) temporal window query (cpp/src/stq)
2) temporal point query (year+month+day+hour+minute+second+millisecond)(cpp/src/stq)
3) quadtree-based indexing for large-scale point data (cpp/src/idx)
4) point-to-polyline nearest distance/neighbor (cpp/src/spatial)
More operations are being planned/developed. To compile and run cuSpatial, use the following steps
CUSPATIAL_HOME=$(pwd)/cuspatial
Step 1: clone a copy of cuSpatial (using your nvidia git-lab username/password)
git clone https://gitlab-master.nvidia.com/jiantingz/cuspatial ${CUSPATIAL_HOME}
Step 2: install cudf by following the instructions
The rest of steps assume CUDACXX=/usr/local/cuda/bin/nvcc, CUDF_HOME=$(pwd)/cudf are set and conda environment cudf_dev is activated after Step 2.
Step 3: copy cub and dlpack from cudf to cuSpatial
mkdir $CUSPATIAL_HOME/cpp/thirdparty/
cp -r $CUDF_HOME/cpp/thirdparty/cub $CUSPATIAL_HOME/cpp/thirdparty/
cp -r $CUDF_HOME/cpp/thirdparty/dlpack $CUSPATIAL_HOME/cpp/thirdparty/
Step 4: comile and install C++ backend
cd $CUSPATIAL_HOME/cpp
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
make
make install
cuSpatial should be installed at $CONDA_PREFIX, e.g., /home/jianting/anaconda3/envs/cudf_dev
For cuspatial, the include path is $CONDA_PREFIX/include/cuspatial/ and the library path $CONDA_PREFIX/lib/libcuspatial.so, respetively.
Step 6: build and install python wrapper
First, make a copy of cudf header files and put it under cuSpatial include directory to make setup easier
cp -r $CUDF_HOME/cpp/include/cudf $CUSPATIAL_HOME/cpp/include
Then, get started:
cd $CUSPATIAL_HOME/python/cuspatial
python setup.py build_ext --inplace
python setup.py install
Step 7: Run python test code
First,cuSpatial Python API path to PYTHONPATH (there are tools under tests subdir), i.e.,
export PYTHONPATH=$CUSPATIAL_HOME/python/cuspatial
Some test code using toy data can be run directly, e.g.,
python $CUSPATIAL_HOME/python/cuspatial/cuspatial/tests/pip2_test_soa_toy.py
However, many test code uses real data from an ITS (Intelligent Transportation System) application.
You will need to follow instructions at data/README.md to generate data for these test code.
Alternatively, you can download the preprocessed data("locust.", "its_4326_roi.", "itsroi.ply" and "its_camera_2.csv") from here,
extrat the files and put them directly under $CUSPATIAL_HOME/data for quick demos.
A brief discription of these data files and their semantic roles in the ITS application can be found here
After data are dowloaded and/or pre-processed, you can run the python test code, e.g.,
python $CUSPATIAL_HOME/python/cuspatial/cuspatial/tests/pip2_verify.py
python $CUSPATIAL_HOME/python/cuspatial/cuspatial/tests/traj2_test_soa3.py
python $CUSPATIAL_HOME/python/cuspatial/cuspatial/tests/stq_test_soa1.py
**NOTE:** Currently, cuSpatial supports reading point/polyine/polygon data using Structure of Array (SoA) format (more readers are being developed)
Alternatively, python users can read any point/polyine/polygon data using existing python packages, e.g., [Shapely](https://pypi.org/project/Shapely/), to generate numpy arrays and feed them to [cuSpatial python APIs](python/cudf/cudf/bindings).