cuda.core.Linker#
- class cuda.core.Linker(options: 'LinkerOptions' = None, *object_codes: ObjectCode)#
Represent a linking machinery to link one or more object codes into
ObjectCode.This object provides a unified interface to multiple underlying linker libraries (such as nvJitLink or cuLink* from the CUDA driver).
- Parameters:
object_codes (
ObjectCode) – One or more ObjectCode objects to be linked.options (
LinkerOptions, optional) – Options for the linker. If not provided, default options will be used.
Methods
- __init__(*args, **kwargs)#
- classmethod backend(cls) str#
Return which linking backend will be used.
Returns
"nvJitLink"when the nvJitLink library is available and meets the minimum version requirement, otherwise"driver".Note
Prefer letting
Linkerdecide. Querybackend()only when you need to dispatch based on input format (for example: choose PTX vs. LTOIR before constructing aLinker). The returned string names an implementation detail whose support matrix may shift across CTK releases.
- close(self)#
Destroy this linker.
- get_error_log(self) str#
Get the error log generated by the linker.
- Returns:
The error log.
- Return type:
- get_info_log(self) str#
Get the info log generated by the linker.
- Returns:
The info log.
- Return type:
- link(self, target_type) ObjectCode#
Link the provided object codes into a single output of the specified target type.
- Parameters:
target_type (str) – The type of the target output. Must be either “cubin” or “ptx”.
- Returns:
ObjectCode– The linked object code of the specified target type... note:: – Ensure that input object codes were compiled with appropriate flags for linking (e.g., relocatable device code enabled).
Attributes
- handle#
Return the underlying handle object.
Note
The type of the returned object depends on the backend.
Caution
This handle is a Python object. To get the memory address of the underlying C handle, call
int(Linker.handle).