3

我是一个新手来处理管理conda环境和pip等。当我尝试做两个cupy数组矩阵(matrix_V和vector_u)点积时,我遇到了以下错误消息:

    vector_predict = matrix_V.dot(vector_u)
  File "cupy/core/core.pyx", line 1791, in cupy.core.core.ndarray.dot
  File "cupy/core/core.pyx", line 3809, in cupy.core.core.dot
  File "cupy/core/core.pyx", line 4193, in cupy.core.core.tensordot_core
  File "cupy/cuda/device.pyx", line 29, in cupy.cuda.device.get_cublas_handle
  File "cupy/cuda/device.pyx", line 34, in cupy.cuda.device.get_cublas_handle
  File "cupy/cuda/device.pyx", line 159, in cupy.cuda.device.Device.cublas_handle.__get__
  File "cupy/cuda/device.pyx", line 160, in cupy.cuda.device.Device.cublas_handle.__get__
  File "cupy/cuda/cublas.pyx", line 297, in cupy.cuda.cublas.create
  File "cupy/cuda/cublas.pyx", line 286, in cupy.cuda.cublas.check_status
cupy.cuda.cublas.CUBLASError: CUBLAS_STATUS_NOT_INITIALIZED

我认为这可能是由于某些包版本冲突引起的。但我不知道如何解决这个问题。我正在使用 Cuda 10.0.130 和 CuDNN 7.3.1。我已经验证它们都有效。我正在使用通过 pip 安装的 cupy-cuda100,我可以在我的虚拟环境中成功导入它。我不使用 conda 的原因是因为 conda (5.1.0) 中的 cupy 版本可能太低,我的程序抱怨它。我希望这些信息会有所帮助。如果没有,请告诉我哪些信息有帮助。

提前致谢。

我试图按照 Kenichi 的建议调用 cupy.cuda.get_cublas_handle() 。我收到以下错误消息:

    cupy.cuda.get_cublas_handle()
  File "cupy/cuda/device.pyx", line 29, in cupy.cuda.device.get_cublas_handle
  File "cupy/cuda/device.pyx", line 34, in cupy.cuda.device.get_cublas_handle
  File "cupy/cuda/device.pyx", line 159, in cupy.cuda.device.Device.cublas_handle.__get__
  File "cupy/cuda/device.pyx", line 160, in cupy.cuda.device.Device.cublas_handle.__get__
  File "cupy/cuda/cublas.pyx", line 297, in cupy.cuda.cublas.create
  File "cupy/cuda/cublas.pyx", line 286, in cupy.cuda.cublas.check_status
cupy.cuda.cublas.CUBLASError: CUBLAS_STATUS_NOT_INITIALIZED

我还注意到 pip install cupy 也安装了一个 numpy,而我的虚拟环境中已经安装了一个 numpy 安装了 tensorflow。即使两个 numpy 都有相同的版本,我想知道这是否是问题所在。

这是运行 batchCUBLAS 示例的输出:

batchCUBLAS Starting...

GPU Device 0: "GeForce RTX 2080" with compute capability 7.5


 ==== Running single kernels ==== 

Testing sgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0xbf800000, -1) 
beta= (0x40000000, 2)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00004601 sec  GFLOPS=91.1512
@@@@ sgemm test OK
Testing dgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0x0000000000000000, 0) beta= (0x0000000000000000, 0)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00005293 sec  GFLOPS=79.2441
@@@@ dgemm test OK

 ==== Running N=10 without streams ==== 

Testing sgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0xbf800000, -1) beta= (0x00000000, 0)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00008917 sec  GFLOPS=470.379
@@@@ sgemm test OK
Testing dgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0xbff0000000000000, -1) beta= (0x0000000000000000, 0)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00029612 sec  GFLOPS=141.644
@@@@ dgemm test OK

 ==== Running N=10 with streams ==== 

Testing sgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0x40000000, 2) beta= (0x40000000, 2)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00004601 sec  GFLOPS=911.512
@@@@ sgemm test OK
Testing dgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0xbff0000000000000, -1) beta= (0x0000000000000000, 0)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00018787 sec  GFLOPS=223.251
@@@@ dgemm test OK

 ==== Running N=10 batched ==== 

Testing sgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0x3f800000, 1) beta= (0xbf800000, -1)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00003600 sec  GFLOPS=1165.05
@@@@ sgemm test OK
Testing dgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0xbff0000000000000, -1) beta= (0x4000000000000000, 2)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00030279 sec  GFLOPS=138.521
@@@@ dgemm test OK

Test Summary
0 error(s)

cupy.show_config()输出:

CuPy Version          : 5.2.0
CUDA Root             : /usr/local/cuda-10.0
CUDA Build Version    : 10000
CUDA Driver Version   : 10000
CUDA Runtime Version  : 10000
cuDNN Build Version   : 7301
cuDNN Version         : 7401
NCCL Build Version    : 2307

pip freeze | grep cupy输出:

cupy-cuda100==5.2.0
4

0 回答 0