问题描述
当我运行这个 pycuda 示例时,它的内核部分可以在 C 解释器中正确运行:
import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
mod = SourceModule("""
#include<stdio.h>
__global__ void say_hi(){
printf("I am %dth thread in : \
threadIdx.x:%d,threadIdx.y:%d,\
blockIdx.x:%d,blockIdx.y:%d,\
blockDim.x:%d,blockDim.y:%d.\n",(threadIdx.x+threadIdx.y*blockDim.x+ \
(blockIdx.x*blockDim.x*blockDim.y)+ \
(blockIdx.y*blockDim.x*blockDim.y)),threadIdx.x,threadIdx.y,blockIdx.x,blockIdx.y,blockDim.x,blockDim.y);
}
""")
func = mod.get_function("say_hi")
func(block=(4,4,4),grid=(2,2,1))
但出现错误:
pycuda.driver.CompileError: nvcc compilation of C:\xxx\Local\Temp\tmpqfqdmr3f\kernel.cu Failed
[command: nvcc --cubin -arch sm_75 -m64 -Id:\xxx\anaconda\envs\tensorflow\lib\site-packages\pycuda\cuda kernel.cu]
[stdout:
kernel.cu(6): error: missing closing quote
kernel.cu(7): error: missing closing quote
2 errors detected in the compilation of "kernel.cu".
kernel.cu
]
是不是我的编译器有问题? 如果有人有想法,请帮忙(对不起,问题太长)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)