Hi all,

I’m trying to do some operations on pyCuda and Cupy. Separately, both are working fine, but when I try to use pyCuda after Cupy, I got the following error:

pycuda._driver.LogicError: cuFuncSetBlockShape failed: invalid resource handle

Do you know how I could fix it? Here is a simplified code to reproduce the error:

```
import numpy as np
import cupy as cp
from scipy.signal import butter
import cusignal
import pycuda.autoinit
import pycuda.gpuarray as gpu_array
from pycuda.compiler import SourceModule
mod = SourceModule("""
__global__ void test(float *data, int nb_points)
{
const int i = threadIdx.x + blockDim.x * blockIdx.x;
if (i < nb_points) {
data[i] *= 2;
}
}
""")
# --- Module
test = mod.get_function("test")
# --- Variables
nbe = 128
nbt = 3000
n_points = nbe * nbt
data = np.random.randn(nbe * nbt).reshape(nbe, nbt)
# --- GPU shapes
b_dim = (1024, 1, 1)
dx, mx = divmod(n_points, 1024)
g_dim = ((dx + (mx > 0)), 1)
# --- Filtering using Cupy
sos = butter(5, [0.1, 0.9], btype='band', output='sos')
cp_data = cp.asarray(data)
cp_sos = cp.asarray(sos)
cp_filtered = cusignal.sosfilt(cp_sos, cp_data)
filtered = cp.asnumpy(cp_filtered)
# --- Operation using pyCuda
gpu_data = gpu_array.to_gpu(filtered.ravel().astype(np.float32))
test(gpu_data, np.int32(n_points), block=b_dim, grid=g_dim)
```

Thanks!