3

I am a newbie comes to deal with managing conda environment and pip, etc. When I tried to do two cupy array matrix (matrix_V and vector_u) dot product, I encountered the following error message:

    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

I think this might be caused from some package version conflict. But I don't know how to resolve this. I am using Cuda 10.0.130 and CuDNN 7.3.1. I have verified that both of them work. I am using cupy-cuda100 that are installed via pip and I can successfully import it in my virtual environment. The reason why I am not using the one from conda is because the version of cupy in conda (5.1.0) might be too low and my program complains about it. I hope those information are helpful. If not, please let me know what information helps.

Thanks in advance.

I tried to call cupy.cuda.get_cublas_handle() as Kenichi suggested. I got the following error message:

    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

I also noticed that pip install cupy also installs a numpy while there is already a numpy installed in my virtual environment came with tensorflow installation. Even though both numpy have the same version, I was wondering if that is the problem.

This is the output by running batchCUBLAS sample:

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() output:

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 output:

cupy-cuda100==5.2.0
kail
  • 51
  • 6
  • Could you try calling `cupy.cuda.get_cublas_handle()` before starting actual computation? – kmaehashi Feb 13 '19 at 06:38
  • Hi @KenichiMaehashi! Thank you for your reply. I have added the error message after call cupy.cuda.get_cublas_handle(). – kail Feb 13 '19 at 17:55
  • Thanks, I guess this issue is due to your CUDA installation rather than CuPy. Could you try running cuBLAS sample application (`/usr/local/cuda/samples/7_CUDALibraries/batchCUBLAS`) to isolate the issue? – kmaehashi Feb 14 '19 at 11:37
  • Could you please tell me how can I run the sample application? I have verified `./deviceQuery` and `./bandwidthTest` worked. And I also reinstalled CUDA. But reinstallation did not solve the problem. Thank you! – kail Feb 14 '19 at 21:42
  • `cd batchCUBLAS; make; ./batchCUBLAS` to run it. – kmaehashi Feb 15 '19 at 04:11
  • I have updated the output in my posting. Looks like there are no errors. – kail Feb 15 '19 at 16:08
  • Thanks, hmm it seems cuBLAS itself is OK. Could you share `cupy.show_config()` and `pip freeze | grep cupy` result? – kmaehashi Feb 18 '19 at 05:06
  • Hi! I have updated both results. Thanks for helping me. – kail Feb 18 '19 at 16:35

0 Answers0