cuda.bindings._v2.driver.library_load_data#

cuda.bindings._v2.driver.library_load_data(
code,
jit_options,
jit_options_values,
library_options,
library_option_values,
) → intptr_t#

Load a library with specified code and options.

Takes a pointer code and loads the corresponding library library based on the application defined library loading mode:.

  • If module loading is set to EAGER, via the environment variables described in “Module loading”, library is loaded eagerly into all contexts at the time of the call and future contexts at the time of creation until the library is unloaded with library_unload().

  • If the environment variables are set to LAZY, library is not immediately loaded onto all existent contexts and will only be loaded when a function is needed for that context, such as a kernel launch.

These environment variables are described in the CUDA programming guide under the “CUDA environment variables” section. The code may be a cubin or fatbin as output by nvcc, or a NULL-terminated PTX, either as output by nvcc or hand-written, or Tile IR data. A fatbin should also contain relocatable code when doing separate compilation. Options are passed as an array via jit_options and any corresponding parameters are passed in jit_optionsValues. The number of total JIT options is supplied via len(jit_options). Any outputs will be returned via jit_optionsValues. Library load options are passed as an array via library_options and any corresponding parameters are passed in library_option_values. The number of total library load options is supplied via len(library_options).

Parameters:
  • code (bytes) – Code to load.

  • jit_options (object) –

    Options for JIT. It must be:

    • a Python sequence of JitOption, or

    • None for NULL.

  • jit_options_values (object) –

    Option values for JIT. It must be:

    • a Python sequence of ints (as pointer addresses), or

    • None for NULL.

  • library_options (object) – Options for loading. It must be a Python sequence of LibraryOption, or None (NULL) if library_option_values is also None.

  • library_option_values (object) –

    Option values for loading. It must be:

    • a Python sequence of ints (as pointer addresses), or

    • None for NULL.

Returns:

Returned library.

Return type:

intptr_t

Note

If the library contains managed variables and no device in the system supports managed variables this call is expected to return CUDA_ERROR_NOT_SUPPORTED.

See also

cuLibraryLoadData