Google Colab 中不存在 CUDA

问题描述 投票:0回答:1

在Google Colab中选择T4 GPU运行时后,我尝试运行以下代码:

from numba import cuda
import numpy as np
B = np.random.randint(0, 5, size=(10, 10))
B_device = cuda.to_device(B)

但是

B_device = cuda.to_device(B)
行似乎触发了以下错误:

ERROR:numba.cuda.cudadrv.driver:Call to cuMemAlloc results in UNKNOWN_CUDA_ERROR
---------------------------------------------------------------------------
CudaAPIError                              Traceback (most recent call last)
<ipython-input-75-c23b10abb298> in <cell line: 2>()
      1 B = np.random.randint(0, 5, size=(10, 10))
----> 2 B_device = cuda.to_device(B)

10 frames
/usr/local/lib/python3.10/dist-packages/numba/cuda/cudadrv/driver.py in _check_ctypes_error(self, fname, retcode)
    393             if retcode == enums.CUDA_ERROR_NOT_INITIALIZED:
    394                 self._detect_fork()
--> 395             raise CudaAPIError(retcode, msg)
    396 
    397     def _check_cuda_python_error(self, fname, returned):

CudaAPIError: [700] Call to cuMemAlloc results in UNKNOWN_CUDA_ERROR

这对我来说很奇怪,因为我希望像这样的简单操作不会出现错误。有线索吗?

python cuda google-colaboratory numba
1个回答
0
投票

结果我必须单击“重新启动运行时”,然后单击“重新启动并运行全部”。

© www.soinside.com 2019 - 2024. All rights reserved.