Compilation issue with cupy gaussian_filter

246 views
Skip to first unread message

Robert Haase

unread,
Mar 23, 2021, 5:04:40 AM3/23/21
to CuPy User Group
Hi all,

a beginners question: I'm trying to run a cupy gaussian_filter on a 3D image and get an error message "..._2.cubin.cu(9): catastrophic error: cannot open source file "math_constants.h"".

I found related issues and PRs

But I don't know how to fix the issue on my system. Any hint is appreciated!

I run on Window 10 x64, CUDA 11.2 and cupy 8.3.0 (installed via conda).

Thanks!
Best,
Robert

That's my code
```
import cupy
import numpy as np
from cupyx.scipy.ndimage import gaussian_filter as cupy_gaussian_filter

image = np.random.random((100,100,100))

cuda_image = cupy.asarray(image)
cuda_result = cupy_gaussian_filter(cuda_image, sigma=10)
result = cupy.asnumpy(cuda_result)
```

Kenichi Maehashi

unread,
Mar 23, 2021, 8:51:33 AM3/23/21
to CuPy User Group
Hi Robert,

Could you try updating CuPy to v8.5.0?
As conda does not provide v8.4.0+ releases for Windows yet, please use a wheel release: https://pypi.org/project/cupy-cuda112/8.5.0/

$ conda uninstall cupy
$ pip install cupy-cuda112

Previously (v8.4.0 or earlier) ndimage filters were depending on `math_constants.h` header file, which is included in the CUDA Toolkit installation.
In CuPy v8.5.0+ the header file is bundled as a part of CuPy so that filters can run even if the header file is unavailable in your system.

In most cases, the header location is automatically detected by CuPy via CUDA_PATH environment variable but it seems something is wrong.
(On Windows you may need to reboot after (re)installing CUDA to environment variable to take effect)

Thanks,
Kenichi

2021年3月23日火曜日 18:04:40 UTC+9 robert...@tu-dresden.de:

Robert Haase

unread,
Mar 23, 2021, 9:35:04 AM3/23/21
to CuPy User Group
Hi Kenichi,

it works! I also downgraded to cuda 10.2 (because of a hint from elsewhere) and adapted the version in the command you suggested. Now everything works like charm. <3

Thank you so much :-)
Robert
Reply all
Reply to author
Forward
0 new messages