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)#
- 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: ObjectCodeFormatType | str,
Link the provided object codes into a single output of the specified target type.
- Parameters:
target_type (ObjectCodeFormatType | 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).
- classmethod which_backend(cls) CompilerBackendType#
Return which linking backend will be used.
Returns
NVJITLINKwhen the nvJitLink library is available and meets the minimum version requirement, otherwiseDRIVER.Note
Prefer letting
Linkerdecide. Querywhich_backend()only when you need to dispatch based on input format (for example: choose PTX vs. LTOIR before constructing aLinker). The returned value names an implementation detail whose support matrix may shift across CTK releases.
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).