MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / _split_cuda_version

Function _split_cuda_version

bitsandbytes/cextension.py:127–136  ·  view source on GitHub ↗

Split a compact CUDA/ROCm version string from a library filename into (major, minor). CUDA: major is always 2 digits (11, 12, 13...), e.g. '118' -> (11, 8), '132' -> (13, 2). ROCm: major is always 1 digit for now (6, 7...), e.g. '72' -> (7, 2), '713' -> (7, 13). Note: revisit if ROCm ma

(compact: str, is_hip: bool)

Source from the content-addressed store, hash-verified

125
126
127def _split_cuda_version(compact: str, is_hip: bool) -> tuple[int, int]:
128 """Split a compact CUDA/ROCm version string from a library filename into (major, minor).
129
130 CUDA: major is always 2 digits (11, 12, 13...), e.g. '118' -> (11, 8), '132' -> (13, 2).
131 ROCm: major is always 1 digit for now (6, 7...), e.g. '72' -> (7, 2), '713' -> (7, 13).
132 Note: revisit if ROCm major reaches 10.
133 """
134 if is_hip:
135 return int(compact[:1]), int(compact[1:])
136 return int(compact[:2]), int(compact[2:])
137
138
139def _find_cuda_libs(prefix: str, is_hip: bool) -> dict[tuple[int, int], Path]:

Callers 2

_find_cuda_libsFunction · 0.85
parse_cuda_versionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected