inducer / inducer/pycuda

DeviceMemoryPool causes crash at shutdown

Open
#74 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.1k
Forks
298
Avg merge
4m
Merged PRs (30d)
1

Description

Consider the following piece of code:

```
import numpy as np
import pycuda.autoinit
import pycuda.gpuarray as gpu
from pycuda.tools import DeviceMemoryPool

cuda_memory_pool = DeviceMemoryPool()
X = np.array([1, 2, 3.0])
X = gpu.to_gpu(X, allocator=cuda_memory_pool.allocate)
```

On my machine, this gives:

```
python2.7 test.py
terminate called after throwing an instance of 'pycuda::error'
what(): explicit_context_dependent failed: invalid context - no currently active context?
Aborted
```

This crash happens AFTER all cleanup operations, somewhere in the guts of pycuda. (At this stage, the `_finish_up()` routine from pycuda.autoinit has already been run). While the main script runs through, this makes it impossible to profile scripts through the Nvidia Visual Profiler, which is rather annoying.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.