I am trying to run the following program on NVIDIA AGX Orin, Ubuntu 20.04:
import NumPy
import pycuda.autoinit
import pycuda.driver as drive
from pycuda.compiler import SourceModule
SourceModule compiles C code for CUDA
mod = SourceModule(“”"
global void multiply_them(float *dest, float *a, float *b)
{
const int i = threadIdx.x; dest[i] = a[i] * b[i];
}
“”")
multiply_them = mod.get_function(“multiply_them”)
a = numpy.random.randn(400).astype(numpy.float32)
b = numpy.random.randn(400).astype(numpy.float32)
dest = numpy.zeros_like(a)
Perform the computation
multiply_them( drive.Out(dest), drive.In(a), drive.In(b), block=(400,1,1), grid=(1,1))
print(dest-a*b)
However, I am getting an error as shown below:
Hi,
How do you install pyCUDA?
Do you use pip3 install pycuda --user?
Thanks.
Yes, I used pip3 install pycuda --user
Hi,
Could you share a reproducible source and steps so we can give it a try?
More, does the same app work on other environments like an x86 desktop?
Thanks.
Thank you for your reply.
I was trying to run the attached Python script, using the following command:
python3 myGPUTest.py
myGPUTest.txt (630 Bytes)
I didn’t test on x86 desktop.
I have connected the NVIDIA AGX Orin directly to a monitor, and trying to run this pyCUDA program.
Hi,
Could you help to check the format of the reproducible source?
We tried to run the source but failed in some format error rather than reproducing the issue.
...
pycuda.driver.CompileError: nvcc compilation of /tmp/tmpvqci04d2/kernel.cu failed
[command: nvcc --cubin -arch sm_87 -I/home/nvidia/.local/lib/python3.8/site-packages/pycuda/cuda kernel.cu]
[stderr:
kernel.cu(3): error: this declaration has no storage class or type specifier
kernel.cu(3): error: expected a ";"
kernel.cu(8): warning: parsing restarts here after previous syntax error
2 errors detected in the compilation of "kernel.cu".
]
Thanks.