inducer / inducer/pycuda

Compiling and linking cublas_v2: cuModuleLoadDataEx can't find named symbol

Open
#138 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.1k
Forks
298
Avg merge
4m
Merged PRs (30d)
1

Description

Since kernels can now call other kernels, I wanted to try and call `cublas_v2` routines from inside my kernels. I can't figure out though how I get this to compile.

Using this `SourceModule` definition:

```python
kernel_mod = SourceModule("""
#include

__global__ void deviceReduceCublas(double *in, double *out, int N) {
cublasHandle_t cnpHandle;
cublasStatus_t status = cublasCreate(&cnpHandle);

status = cublasDasum(cnpHandle, N, in, 1, out);

cublasDestroy(cnpHandle);
}

""",
options=['-lcublas', '-lcublas_device', '-lcudadevrt'],
include_dirs=['/opt/cuda/include', '/opt/cuda/lib64'])
```

I get the error:

```bash
Traceback (most recent call last):
File "chaotic_neural.py", line 129, in
include_dirs=['/opt/cuda/include', '/opt/cuda/lib64'])
File "/usr/lib/python3.6/site-packages/pycuda/compiler.py", line 265, in __init__
arch, code, cache_dir, include_dirs)
File "/usr/lib/python3.6/site-packages/pycuda/compiler.py", line 255, in compile
return compile_plain(source, options, keep, nvcc, cache_dir, target)
File "/usr/lib/python3.6/site-packages/pycuda/compiler.py", line 137, in compile_plain
stderr=stderr.decode("utf-8", "replace"))
pycuda.driver.CompileError: nvcc compilation of /tmp/tmp9po2la3f/kernel.cu failed
[command: nvcc --cubin -lcublas -lcublas_device -lcudadevrt -arch sm_50 -I/opt/cuda/include -I/opt/cuda/lib64 -I/usr/lib/python3.6/site-packages/pycuda/cuda kernel.cu]
[stderr:
ptxas fatal : Unresolved extern function 'cublasCreate_v2'
]
```

Any ideas how to get that working?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.