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:

str

get_info_log(self) str#

Get the info log generated by the linker.

Returns:

The info log.

Return type:

str

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