cupy: Get segmentation fault with FFT callback function
pr.py
import numpy as np
import cupy as cp
code = r'''
__device__ cufftComplex CB_ConvertInput(
void *dataIn,
size_t offset,
void *callerInfo,
void *sharedPtr) {
return make_float2(0.0, 0.1);
}
__device__ cufftCallbackLoadC d_loadCallbackPtr = CB_ConvertInput;
'''
in_arr = cp.random.rand(12, dtype=np.float32)
with cp.fft.config.set_cufft_callbacks(cb_load=code):
out_arr = cp.fft.fft(in_arr)
print(out_arr)
Run with
CUDA_VISIBLE_DEVICES=0 python pr.py
Then I got
[1] 410392 segmentation fault (core dumped) CUDA_VISIBLE_DEVICES=0 python pr.py
My system information:
OS : Linux-5.12.8-arch1-1-x86_64-with-glibc2.33
Python Version : 3.9.5
CuPy Version : 9.1.0
CuPy Platform : NVIDIA CUDA
NumPy Version : 1.20.0
SciPy Version : 1.6.3
Cython Build Version : 0.29.23
Cython Runtime Version : 0.29.23
CUDA Root : /opt/cuda
nvcc PATH : /opt/cuda/bin/nvcc
CUDA Build Version : 11030
CUDA Driver Version : 11030
CUDA Runtime Version : 11030
cuBLAS Version : 11402
cuFFT Version : 10402
cuRAND Version : 10204
cuSOLVER Version : (11, 1, 1)
cuSPARSE Version : 11500
NVRTC Version : (11, 3)
Thrust Version : 101100
CUB Build Version : 101100
Jitify Build Version : 60e9e72
cuDNN Build Version : 8200
cuDNN Version : 8200
NCCL Build Version : 20906
NCCL Runtime Version : 20906
cuTENSOR Version : None
cuSPARSELt Build Version : None
Device 0 Name : NVIDIA GeForce GTX 1080
Device 0 Compute Capability : 61
Device 0 PCI Bus ID : 0000:17:00.0
Device 1 Name : NVIDIA Quadro K600
Device 1 Compute Capability : 30
Device 1 PCI Bus ID : 0000:65:00.0
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 23 (12 by maintainers)
@leofang My system is archlinux. The cupy is installed from archlinuxcn/python-cupy. After deleting
.cupyfolder, I got a warning before the segmentation fault.@leofang Thanks, everything works now on the 980 workstation.
@leofang I tested both my 1080 machines. And the new patch (cf78fbf86eec6a8a4baef2d5628bb96130c4879) works on both. Cheers. But I cannot compile cupy from source on my 980 machine. It complains that cudnn.h is missing. The dependency on cudnn is optional, isn’t it?
Sure. This is my output.
Let me clarify. This is an another NVIDIA 1080 card. I installed cupy with
pip install cupy. The version of cupy is 9.1.0, without your patch. This is my test code.This is the output.
I do not think I get the correct answer. From my understand, the answer should be the last line. I am new to this callback function. Please correct me if I am wrong.
@leofang I have access to another NVIDIA 1080 machine. I get the same warning (cupy 9.10), but not segfault.
Thanks, @szsdk. I will send a patch to fix this.
On CUDA 11.3:
Output: