Torch cuda extension with cuda libraries


I am trying to use the cublas and cusparse in my cuda code and wrap with torch CUDAExtension.
I am wondering if I put creating cublas or cusparse handle code in cuda code, does it mean it creates handle every time I use the extension I made?
Is there any way to create handle only one time and reuse it?

You might want to check if you can directly use or copy the approach in e.g., pytorch/CuSparseHandlePool.cpp at 9ae63bd87c21a59094b3f8344bac8910990d395b ยท pytorch/pytorch (