cuda.core.experimental.Linker

class cuda.core.experimental.Linker(*object_codes: ObjectCode, options: LinkerOptions = None)

Represent a linking machinery to link one or multiple object codes into ObjectCode with the specified options.

This object provides a unified interface to multiple underlying linker libraries (such as nvJitLink or cuLink* from 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__(*object_codes: ObjectCode, options: LinkerOptions = None)
close()

Destroy this linker.

get_error_log() str

Get the error log generated by the linker.

Returns:

The error log.

Return type:

str

get_info_log() str

Get the info log generated by the linker.

Returns:

The info log.

Return type:

str

Links 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:

The linked object code of the specified target type.

Return type:

ObjectCode

Note

See nvrtc compiler options documnetation to ensure the input object codes are correctly compiled for linking.

Attributes

handle

Return the linker handle object.