Skip to content

Cuda/cublas context creation

Pierre Paleo requested to merge cublas_context into master

This PR attempts at removing any cuda context creation at import.

The recommended way to create a cuda context is nabu.cuda.utils.get_cuda_context() which allows a certain control over it. It creates a Cuda context only when asked (ex in CudaFullFieldPipeline).

However, importing silx.math.fft.cufft.CUFFT creates a context which is not cleaned up when the nvidia-persistenced daemon is running (UserWarning: creating CUBLAS context to get version number).

The mitigations are the following:

  1. import skcuda to test if we can use CUFFT, instead of silx.math.fft.cufft
  2. import CUFFT as late as possible (so at class instantiation)

Point (1) is is far from ideal, as being able to import skcuda likely does not imply that CUFFT works. Point (2) is not very elegant.

But this is the best and simplest we can do for now.

As a side note, the issue of scikit-cuda creating a cublas context can be avoided: it all boils down to finding a file name in the form libcublas.so.X.Y.Z.

Close #132 (closed).

Edited by Pierre Paleo

Merge request reports