Problems when using cupy

135 Views Asked by At

The following problem occurs when I try to use cupy.Below is my program and the error.Please tell me what happened,Thanks.

My cupy is install cupy-cuda12x. My cuda verson is 12.1

And i have also used cuda10.2(cupy-cuda102) and cuda11.8(cupy-cuda11x), but it has same error.

import cupy as cp
import time

s = time.time()
x_gpu = cp.ones((10,10,10))
e = time.time()
print(e - s)
PS C:\Users\王昱婷\Desktop\data game> & C:/Python311/python.exe "c:/Users/王昱婷/Desktop/data game/try2.py"
Traceback (most recent call last):
  File "C:\Python311\Lib\site-packages\cupy\cuda\compiler.py", line 689, in compile
    nvrtc.compileProgram(self.ptr, options)
  File "cupy_backends\cuda\libs\nvrtc.pyx", line 159, in cupy_backends.cuda.libs.nvrtc.compileProgram
  File "cupy_backends\cuda\libs\nvrtc.pyx", line 171, in cupy_backends.cuda.libs.nvrtc.compileProgram
  File "cupy_backends\cuda\libs\nvrtc.pyx", line 89, in cupy_backends.cuda.libs.nvrtc.check_status   
cupy_backends.cuda.libs.nvrtc.NVRTCError: NVRTC_ERROR_COMPILATION (6)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\王昱婷\Desktop\data game\try2.py", line 13, in <module>
    x_gpu = cp.ones((10,10,10))
            ^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\cupy\_creation\basic.py", line 156, in ones
    a.fill(1)
  File "cupy\_core\core.pyx", line 713, in cupy._core.core._ndarray_base.fill
  File "cupy\_core\core.pyx", line 739, in cupy._core.core._ndarray_base.fill
  File "cupy\_core\_kernel.pyx", line 920, in cupy._core._kernel.ElementwiseKernel.__call__
  File "cupy\_core\_kernel.pyx", line 945, in cupy._core._kernel.ElementwiseKernel._get_elementwise_kernel
  File "cupy\_util.pyx", line 64, in cupy._util.memoize.decorator.ret
  File "cupy\_core\_kernel.pyx", line 728, in cupy._core._kernel._get_elementwise_kernel
  File "cupy\_core\_kernel.pyx", line 82, in cupy._core._kernel._get_simple_elementwise_kernel_from_code
  File "cupy\_core\core.pyx", line 2251, in cupy._core.core.compile_with_cache
  File "C:\Python311\Lib\site-packages\cupy\cuda\compiler.py", line 496, in _compile_module_with_cache
    return _compile_with_cache_cuda(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\cupy\cuda\compiler.py", line 574, in _compile_with_cache_cuda
    ptx, mapping = compile_using_nvrtc(
                   ^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\cupy\cuda\compiler.py", line 322, in compile_using_nvrtc
    return _compile(source, options, cu_path,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\cupy\cuda\compiler.py", line 306, in _compile
    compiled_obj, mapping = prog.compile(options, log_stream)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\cupy\cuda\compiler.py", line 707, in compile
    log = nvrtc.getProgramLog(self.ptr)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "cupy_backends\cuda\libs\nvrtc.pyx", line 243, in cupy_backends.cuda.libs.nvrtc.getProgramLog
  File "cupy_backends\cuda\libs\nvrtc.pyx", line 259, in cupy_backends.cuda.libs.nvrtc.getProgramLog
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 231: invalid start byte
0

There are 0 best solutions below