ThrustRTC
ThrustRTC copied to clipboard
"SystemError: An internal error happend" When using Exclusive_Scan
Hi,
I'm getting an error when using Exclusive_Scan with python
My code:
def process_query_vector_degree_array(E):
"""
Processes the query vector degree array into a form that can be used to create the cluster graph
Creates a new vector V which stores the cumulative sum of the degree array E. This is used to find the starting index of the neighbourhood vectors for each query vector when creating the cluster graph.
Inspired by step 2 of the G-DBSCAN algorthm.
Uses the ThrustRTC library to perform an exclusive scan
Args:
E: A CuPy Array. The degree array of the query vectors. Has shape (len(X), 1)
Returns:
The processed E array. As a cupy array
"""
E_d = trtc.DVCupyVector(E)
V_d = trtc.DVCupyVector(cp.zeros(len(E), dtype=cp.int32))
trtc.Exclusive_Scan(E_d, V_d)
return cp.array(V_d.to_host())
# In my test file:
E = cp.array([3, 4, 1, 1], dtype=cp.int32)
V_trtc = gsd.process_query_vector_degree_array(E)
```
The error:
```
# My own files above (I've removed my own directories)
File "~/Documents/Thesis/./src/gs_dbscan.py", line 270, in process_query_vector_degree_array
trtc.Exclusive_Scan(E_d, V_d)
File "~/Documents/Thesis/gs_venv/lib/python3.8/site-packages/ThrustRTC/PrefixSums.py", line 16, in Exclusive_Scan
check_i(native.n_exclusive_scan(vec_in.m_cptr, vec_out.m_cptr, cptr_init, cptr_binary_op))
File "~/Documents/Thesis/gs_venv/lib/python3.8/site-packages/ThrustRTC/Native.py", line 16, in check_i
raise SystemError("An internal error happend")
SystemError: An internal error happend
```
FYI My CUDA version is 11.3
Sorry for late reply. The only problem I see is: "class DVCupyVector" doesn't have "to_host()". Here you can do this:
V = cp.zeros(len(E), dtype=cp.int32)
V_d = trtc.DVCupyVector(V)
trtc.Exclusive_Scan(E_d, V_d)
return V
And it acutally works for me. So far, I'm not able to reproduce the actual error you see.
If you are still seeing "An internal error happend", then it looks more like a configuration issue.
For me, Miniconda works stably. I used:
conda install -c conda-forge cupy cuda-version=11.3
to install cupy.
At the beginning of the script, I set the nvrtc path like
trtc.set_libnvrtc_path('/home/fei/miniconda3/lib/libnvrtc.so')
Also be careful if your GPU driver is new enough for your cuda version.