diff options
author | Dmitry Baranchuk <dmitrybaranchuk@gmail.com> | 2022-09-10 19:33:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-10 19:33:21 -0700 |
commit | 843ad0631c65eabc7f64e80906ecf5482cc1a036 (patch) | |
tree | 07ab541ec59ab3474a711c155daa118fc0ae6864 /bitsandbytes/functional.py | |
parent | 8d34d36f150b0fd4914cdb56d4e3bda34c029ccc (diff) | |
parent | 2e630b55f51d454f3bd723dffda68a07ef93190c (diff) |
Merge pull request #1 from TimDettmers/main
Update main branch
Diffstat (limited to 'bitsandbytes/functional.py')
-rw-r--r-- | bitsandbytes/functional.py | 42 |
1 files changed, 2 insertions, 40 deletions
diff --git a/bitsandbytes/functional.py b/bitsandbytes/functional.py index 6637554..22200f2 100644 --- a/bitsandbytes/functional.py +++ b/bitsandbytes/functional.py @@ -5,7 +5,6 @@ import ctypes as ct import operator import random -import math import torch from typing import Tuple @@ -185,14 +184,9 @@ def create_dynamic_map(signed=True, n=7): def get_special_format_str(): + if not torch.cuda.is_available(): return 'col_turing' major, minor = torch.cuda.get_device_capability() - if major < 7: - print( - f"Device with CUDA capability of {major} not supported for 8-bit matmul. Device has no tensor cores!" - ) - assert major >= 7 - - if major == 7: + if major <= 7: return "col_turing" elif major == 8: return "col_ampere" @@ -248,23 +242,6 @@ def get_transform_func(dtype, orderA, orderOut, transpose=False): return getattr(lib, name) -class GlobalData(object): - _instance = None - - def __init__(self): - raise RuntimeError("Call get_instance() instead") - - def initialize(self): - self.data = {} - - @classmethod - def get_instance(cls): - if cls._instance is None: - cls._instance = cls.__new__(cls) - cls._instance.initialize() - return cls._instance - - def get_transform_buffer( shape, dtype, device, to_order, from_order="row", transpose=False ): @@ -1685,21 +1662,6 @@ def double_quant( return out_row, out_col, row_stats, col_stats, coo_tensor -def get_special_format_str(): - major, minor = torch.cuda.get_device_capability() - if major < 7: - print( - f"Device with CUDA capability of {major} not supported for 8-bit matmul. Device has no tensor cores!" - ) - assert major >= 7 - - if major == 7: return 'col_turing' - elif major == 8: return 'col_ampere' - else: return 'col_turing' - - - - def transform(A, to_order, from_order='row', out=None, transpose=False, state=None, ld=None): prev_device = pre_call(A.device) if state is None: state = (A.shape, from_order) |