Skip to content

pycuda._driver.LogicError: cuMemAlloc failed: context is destroyed (caused by scikit-cuda or even CUDA itself?) #355

Description

@dimitsev

Running the following in a clean python context throws pycuda._driver.LogicError: cuMemAlloc failed: context is destroyed on the last line:

import pycuda.autoinit

import numpy as np
import pycuda
import skcuda
import skcuda.fft as cufft

plan = cufft.Plan((2,2), np.complex64, np.complex64)

del plan # equivalent to `skcuda.cufft.cufftDestroy(plan.handle)`
#skcuda.cufft.cufftDestroy(plan.handle) # equivalent to `del plan`

pycuda.gpuarray.empty((2,2), np.float32)

Deleting the FFT plan in scikit-cuda destroys the pycuda context. This happens no matter if you use del plan or skcuda.cufft.cufftDestroy(plan.handle). So maybe CUDA itself is messing up here?

As long as skcuda.cufft.cufftDestroy() is not called, everything is ok. But I want to be able to destroy FFT plans...

(See also my stackoverflow question: https://stackoverflow.com/questions/72218532/deleting-an-fft-plan-in-scikit-cuda-destroys-the-pycuda-context.)

My system:

  • Debian GNU/Linux 11 (bullseye) (stable)
  • Python 3.9.2
  • CUDA installed following https://wiki.debian.org/NvidiaGraphicsDrivers
  • nvidia driver version 470.103.01
  • CUDA version 11.4
  • pyCUDA version: 2021.1
  • scikit-cuda version: 0.5.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions