Skip to main content

cuLibraryLoadFromFile

Function cuLibraryLoadFromFile 

Source
pub unsafe extern "C" fn cuLibraryLoadFromFile(
    library: *mut CUlibrary,
    fileName: *const c_char,
    jitOptions: *mut CUjit_option,
    jitOptionsValues: *mut *mut c_void,
    numJitOptions: c_uint,
    libraryOptions: *mut CUlibraryOption,
    libraryOptionValues: *mut *mut c_void,
    numLibraryOptions: c_uint,
) -> CUresult
Expand description

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 cuLibraryUnload.
  • 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 jitOptions and any corresponding parameters are passed in jitOptionsValues. The number of total options is supplied via numJitOptions. Any outputs will be returned via jitOptionsValues.

Library load options are passed as an array via libraryOptions and any corresponding parameters are passed in libraryOptionValues. The number of total library load options is supplied via numLibraryOptions.

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

§Parameters

  • library: Returned library.
  • fileName: File to load from.
  • jitOptions: Options for JIT.
  • jitOptionsValues: Option values for JIT.
  • numJitOptions: Number of options.
  • libraryOptions: Options for loading.
  • libraryOptionValues: Option values for loading.
  • numLibraryOptions: Number of options for loading.

§Return value

See also: cuLibraryLoadData, cuLibraryUnload, cuModuleLoad, cuModuleLoadData, cuModuleLoadDataEx.