From 8258b4364a21a4da2572cb644d0926080c3268da Mon Sep 17 00:00:00 2001 From: Max Ryabinin Date: Fri, 1 Jul 2022 17:16:10 +0300 Subject: Add a CPU-only build option --- bitsandbytes/cextension.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 bitsandbytes/cextension.py (limited to 'bitsandbytes/cextension.py') diff --git a/bitsandbytes/cextension.py b/bitsandbytes/cextension.py new file mode 100644 index 0000000..63d627e --- /dev/null +++ b/bitsandbytes/cextension.py @@ -0,0 +1,13 @@ +import ctypes as ct +import os +from warnings import warn + +lib = ct.cdll.LoadLibrary(os.path.dirname(__file__) + '/libbitsandbytes.so') + +try: + lib.cadam32bit_g32 + COMPILED_WITH_CUDA = True +except AttributeError: + warn("The installed version of bitsandbytes was compiled without GPU support. " + "8-bit optimizers and GPU quantization are unavailable.") + COMPILED_WITH_CUDA = False -- cgit v1.2.3