Description
I am running the following code using CuPy which crashes with the message:
Traceback (most recent call last):
File "/content/test-cupy-func.py", line 21, in <module>
w = wofz_gpu(z)
^^^^^^^^^^^
File "/content/test-cupy-func.py", line 15, in wofz_gpu
return erfcx(-1j * z_gpu)
^^^^^^^^^^^^^^^^^^
File "cupy/_core/_kernel.pyx", line 1340, in cupy._core._kernel.ufunc.__call__
File "cupy/_core/_kernel.pyx", line 1660, in cupy._core._kernel._Ops.guess_routine
TypeError: Wrong type ((<class 'numpy.complex128'>,)) of arguments for cupyx_scipy_special_erfcx
To Reproduce
import cupy as cp
from cupyx.scipy.special import erfcx
def wofz_gpu(z) -> cp.ndarray:
"""Compute the complex Faddeeva function on GPU for complex128 inputs.
Args:
z: Array-like input (NumPy or CuPy). Converted to CuPy complex128.
Returns:
CuPy array (complex128) containing w(z).
"""
z_gpu = cp.asarray(z, dtype=cp.complex128)
return erfcx(-1j * z_gpu)
if __name__ == "__main__":
# Example: everything remains on GPU.
z = cp.array([1.0 + 2.0j, -0.5 + 0.25j, 3.0 - 1.0j], dtype=cp.complex128)
w = wofz_gpu(z)
print("Input dtype:", z.dtype)
print("Output dtype:", w.dtype)
print("Output (GPU array):", w)
from scipy.special import wofz
import numpy as np
z = cp.asnumpy(z) # Move to CPU for SciPy
w = wofz(z)
print("Input dtype:", z.dtype)
print("Output dtype:", w.dtype)
print("Output (CPU array):", w)
Installation
Wheel (pip install cupy-cuda13x)
Environment
cupy-cuda13x==14.0.1
numpy==2.0.2
Additional Information
No response
Description
I am running the following code using CuPy which crashes with the message:
To Reproduce
Installation
Wheel (
pip install cupy-cuda13x)Environment
Additional Information
No response