cuda.bindings._v2.driver.library_load_from_file#

cuda.bindings._v2.driver.library_load_from_file(
file_name,
jit_options,
jit_options_values,
library_options,
library_option_values,
) → intptr_t#

Load a library with specified file 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 file should be a cubin file as output by nvcc, or a PTX file either as output by nvcc or handwritten, or a fatbin file as output by nvcc or hand-written, or Tile IR file. 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 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:
  • file_name (bytes) – File to load from.

  • 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

cuLibraryLoadFromFile