cuda.pathfinder.optional_cuda_import#

cuda.pathfinder.optional_cuda_import(
fully_qualified_modname: str,
*,
probe_function: Callable[[ModuleType], object] | None = None,
) ModuleType | None#

Import an optional CUDA module without masking unrelated import bugs.

Returns:

The imported module if available and the optional probe succeeds, otherwise None when the requested module is unavailable.

Raises:
  • ModuleNotFoundError – If the import fails because a dependency of the target module is missing (instead of the target module itself).

  • Exception – Any exception raised by probe_function except DynamicLibNotFoundError, which is treated as “unavailable”.