如何在Linux中配置PyCuda代码? [英] How to profile PyCuda code in Linux?

查看:381
本文介绍了如何在Linux中配置PyCuda代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的(测试)pycuda应用程序,我试图配置它。我试过NVidia的Compute Visual Profiler,它运行程序11次,然后发出以下错误:

I have a simple (tested) pycuda app and am trying to profile it. I've tried NVidia's Compute Visual Profiler, which runs the program 11 times, then emits this error:

NV_Warning: Ignoring the invalid profiler config option: fb0_subp0_read_sectors
Error : Profiler data file '/home/jguy/proj/gpu/tdbp/pyArch/temp_compute_profiler_0_0.csv' does not contain profiler output.This can happen when:
a) Profiling is disabled during the entire run of the application.
b) The application does not invoke any kernel launches or memory transfers.
c) The application does not release resources (contexts, events, etc.). The program needs to be modified to properly free up all resources before termination.

我也试过运行CUDA_PROFILE python scriptname.py arg1。它创建了一个包含以下内容的文件:

I also tried running "CUDA_PROFILE python scriptname.py arg1". It created a file containing:

NV_Warning: Ignoring the invalid profiler config option: instructions
# CUDA_PROFILE_LOG_VERSION 2.0
# CUDA_DEVICE 0 GeForce GTX 560 Ti
# CUDA_PROFILE_CSV 1
# TIMESTAMPFACTOR fffff7003e38fec8
gpustarttimestamp,method,gputime,cputime,occupancy

如果它有用,我也有这些环境vars设置:

In case it's useful, I also have these environment vars set:

CUDA_PROFILE_CONFIG=temp_cuda_profiler.conf
CUDA_PROFILE_CSV=1
CUDA_PROFILE_LOG=profile.csv
CUDA_PROFILE=1

和temp_cuda_profiler.conf包含

and temp_cuda_profiler.conf contains

gpustarttimestamp
instructions

googling一个小时左右。没有运气。

Been googling for an hour or so. No luck. Thanks for any insights you can provide!

推荐答案

使用import pycuda.autoinit时,重要的是要有pycuda.autoinit.context .detach()在程序结束时。这解决了问题。

When using import pycuda.autoinit, it is important to have pycuda.autoinit.context.detach() at the end of the program. This fixed the problem.

这篇关于如何在Linux中配置PyCuda代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆