当我创建一个新会话并告诉 Visual Profiler 启动我的 python/pycuda 脚本时,我收到以下错误消息:Execution run #1 of program '' failed, exit code: 255
When I create a new session and tell the Visual Profiler to launch my python/pycuda scripts I get following error message: Execution run #1 of program '' failed, exit code: 255
这些是我的偏好:
python "/pathtopycudafile/mysuperkernel.py""/pathtopycudafile/mysuperkernel.py"[empty]我在 Ubuntu 10.10 下使用 CUDA 4.0.64位.分析编译的示例工作.
I use CUDA 4.0 under Ubuntu 10.10. 64Bit. Profiling compiled examples works.
附言我知道 SO 问题 如何在 Linux 中分析 PyCuda 代码?,但似乎是一个不相关的问题.
p.s. I am aware of SO question How to profile PyCuda code in Linux?, but seems to be an unrelated problem.
小例子
pycudaexample.py:
pycudaexample.py:
import pycuda.autoinit
import pycuda.driver as drv
import numpy
from pycuda.compiler import SourceModule
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)
multiply_them(
drv.Out(dest), drv.In(a), drv.In(b),
block=(400,1,1), grid=(1,1))
pycuda.autoinit.context.detach()
示例设置
错误信息
您为计算分析器指定可执行文件的方式有问题.如果我在您发布的代码的顶部放了一条井号线:
There is something wrong with the way you are specifying the executable to the compute profiler. If I put a hash bang line at the top of your posted code:
#!/usr/bin/env python
然后给python文件可执行权限,计算分析器运行代码没有抱怨,我得到这个:
and then give the python file executable permissions, the compute profiler runs the code without complaint and I get this:
这篇关于如何使用 Visual Profiler 分析 PyCuda 代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
使用 python 解析非常大的 xml 文件时出现问题Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件时出现问题)
使用 Python 2 在 XML 中按属性查找所有节点Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按属性查找所有节点)
Python - 如何解析 xml 响应并将元素值存储在变量中Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 响应并将元素值存储在变量中?)
如何在 Python 中获取 XML 标记值How to get XML tag value in Python(如何在 Python 中获取 XML 标记值)
如何使用 ElementTree 正确解析 utf-8 xml?How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正确解析 utf-8 xml?)
将 XML 从 URL 解析为 python 对象Parse XML from URL into python object(将 XML 从 URL 解析为 python 对象)