【问题标题】:Running an Nsight Systems report python script independently独立运行 Nsight Systems 报告 python 脚本
【发布时间】:2022-06-14 22:22:54
【问题描述】:

我已经调整了一个 Nsight Systems 报告脚本 (gpukernsum) 的副本,现在我想自己运行它。所以,我写:

./gpukernsum.py report.sqlite

这不起作用;我明白了:

ERROR: Script 'gpukernsum.py' encountered an internal error.

$ ./gpukernsum.py report.sqlite
  File "./gpukernsum.py", line 40
    """
      ^
SyntaxError: invalid syntax

我知道这是因为 f"""whatever""" 是 Python-3 语法,所以我将脚本的 hash-bang 行从:

#!/usr/bin/env python3

到:

#!/usr/bin/env python3

现在我明白了:

$ ./gpukernsum.py report.sqlite
Traceback (most recent call last):
  File "/path/to/./gpukernsum.py", line 7, in <module>
    import nsysstats
ModuleNotFoundError: No module named 'nsysstats'

所以我在查找路径中添加了相关目录:

export PYTHONPATH="$PYTHONPATH:/opt/nvidia/nsight-systems/2022.1.1/host-linux-x64/python/lib"

现在我明白了:

$ ./gpukernsum.py report.sqlite
near "WITH": syntax error

...我被困住了。代码的相关区域是:

    and not a percentage of the application wall or CPU execution time.
"""

    query_stub = """
WITH
    summary AS (
        SELECT
            coalesce({NAME_COL_NAME}, demangledName) AS nameId,

有什么问题?

注意:我的系统有用于python3 的 Python 3.9.1。

【问题讨论】:

  • 你的“hash-bang”从和到行有什么不同?

标签: python python-3.x cuda syntax-error nsight-systems


猜你喜欢
  • 1970-01-01
  • 2019-01-19
  • 2020-03-05
  • 1970-01-01
  • 1970-01-01
  • 2016-08-21
  • 1970-01-01
相关资源
最近更新 更多