TargetInfo#

class rbc.targetinfo.TargetInfo(*args, **kwargs)#

Holds target device information.

The information within a TargetInfo instance can be accessed only when the instance has been activated as a context manager:

target_info = TargetInfo(<name>)
# construct target_info
...

with target_info:
    '''
    TargetInfo instance target_info is made available globally
    and it can be acquired from any Python module function, for
    example:

      from rbc.targetinfo import TargetInfo

      def foo():
          ti = TargetInfo()
          # here `ti` is the same object as `target_info`
    '''
    ...

# target_info is now disabled globally and when a Python module
# function tries to access it as `TargetInfo()`, a RuntimeError
# exception will be raised.

Attributes

TargetInfo.arch

Return architecture string of target device.

TargetInfo.bits

Return target device address bit-size as int value (32, 64, ...).

TargetInfo.datalayout

Return LLVM datalayout of target device.

TargetInfo.device_features

Return a comma-separated string of CPU target features.

TargetInfo.device_name

Return the name of target device.

TargetInfo.driver

Return device driver name and version numbers as int tuple. For instance::.

TargetInfo.gpu_cc

Return compute capabilities (major, minor) of CUDA device target.

TargetInfo.has_cpython

Check if target supports Python C/API symbols

TargetInfo.has_libdevice

Check if target has libdevice (CUDA math library) available

TargetInfo.has_numba

Check if target supports numba symbols

TargetInfo.has_numpy

Check if target supports numpy symbols

TargetInfo.is_cpu

Return True if the target device is CPU.

TargetInfo.is_gpu

Return True if the target device is GPU.

TargetInfo.llvm_version

Return target system LLVM versions tuple.

TargetInfo.null_values

Return the null values for scalar types serialized as integers.

TargetInfo.software

Return remote software name and version number as int tuple.

TargetInfo.triple

Return target triple as a string.

Methods

TargetInfo.__init__()

TargetInfo.add_external(*names)

TargetInfo.add_library(lib)

TargetInfo.check_enabled(desired_devices)

Check if target supports desired devices

TargetInfo.dummy()

Returns dummy target info instance.

TargetInfo.fromdict(data)

TargetInfo.fromjson(data)

TargetInfo.get_compile_target()

Return target function name being compiled.

TargetInfo.host([name, strict])

Return target info for host CPU.

TargetInfo.set(prop, value)

Set a target device property to given value.

TargetInfo.set_compile_target(target_name)

Set target function name being compiled.

TargetInfo.sizeof(t)

Return the sizeof(t) value for given target device.

TargetInfo.supports(name)

Return True if the target system defines symbol name.

TargetInfo.todict()

TargetInfo.tojson()

TargetInfo.update(data)

Update target info using other target info data.