cuda.bindings._v2.driver.library_load_from_file#

cuda.bindings._v2.driver.library_load_from_file(
file_name,
intptr_t jit_options,
intptr_t jit_options_values,
unsigned int num_jit_options,
intptr_t library_options,
intptr_t library_option_values,
unsigned int num_library_options,
) → 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 num_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 num_library_options.

Parameters:
  • file_name (bytes) – File to load from.

  • jit_options (intptr_t) – Options for JIT.

  • jit_options_values (intptr_t) – Option values for JIT.

  • num_jit_options (unsigned int) – Number of options.

  • library_options (intptr_t) – Options for loading.

  • library_option_values (intptr_t) – Option values for loading.

  • num_library_options (unsigned int) – Number of options for loading.

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