RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`

created at 08-20-2021 views: 56

I encountered a very speechless mistake today. I have been tossing for a long time...I can't use the feature network after using Bert...Checked the size problem and found that it is not. Later, I found that it was not placed on cuda...

error

RuntimeError: Caught RuntimeError in replica 0 on device 0.
RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)

solution

# Change from
ext_hashCodes.unsqueeze(1).repeat(1, B, 1)
# to
ext_hashCodes.unsqueeze(1).repeat(1, B, 1).cuda()

and then it will be OK.

created at:08-20-2021
edited at: 08-20-2021: