Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling cublasDgetrfBatched failed with pycuda #332

Open
doetools opened this issue May 2, 2023 · 0 comments
Open

Calling cublasDgetrfBatched failed with pycuda #332

doetools opened this issue May 2, 2023 · 0 comments

Comments

@doetools
Copy link

doetools commented May 2, 2023

Description

I know this could be me, but I had a hard time in understanding the form of input matrix, to which a LU decomposition is performed. I failed to call the low-level interface cublas.cublasDgetrfBatched in my little example.

import numpy as np
import pycuda.autoinit
import skcuda.cublas as cublas
import pycuda.gpuarray as gpuarray

N = 10
N_BATCH = 1  # only 1 matrix to be decomposed
A_SHAPE = (N, N)

a = np.random.rand(*A_SHAPE).astype(np.float64)
a_batch = np.expand_dims(a, axis=0)

a_gpu = gpuarray.to_gpu(a_batch.T.copy())  # transpose a to follow "F" order
p_gpu = gpuarray.zeros(N * N_BATCH, np.int32)
info_gpu = gpuarray.zeros(N_BATCH, np.int32)

cublas_handle = cublas.cublasCreate()
cublas.cublasDgetrfBatched(
    cublas_handle,
    N,
    a_gpu.gpudata,
    N,
    p_gpu.gpudata,
    info_gpu.gpudata,
    N_BATCH,
)

cublas.cublasDestroy(cublas_handle)
print(a_gpu)

Problem

PyCUDA WARNING: a clean-up operation failed (dead context maybe?)
cuMemFree failed: an illegal memory access was encountered

Environment

  • OS platform: Ubuntu 18.04
  • Python version: 3.7.6
  • CUDA version: 11.2
  • PyCUDA version: 2018.1.1
  • scikit-cuda version: 0.5.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant