cuda.bindings.utils.get_ptx_ver#

cuda.bindings.utils.get_ptx_ver(ptx: str) str#
Extract the PTX ISA version string from PTX source code.

:param ptx: The PTX assembly source code as a string.
:type ptx: str

:returns: The PTX ISA version string, e.g., "8.8".
:rtype: str

:raises ValueError: If the .version directive is not found in the PTX source.

.. rubric:: Examples

>>> ptx = r'''
... .version 8.8
... .target sm_86
... .address_size 64
...
... .visible .entry test_kernel()
... {
...     ret;
... }
... '''
>>> get_ptx_ver(ptx)
'8.8'