Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lzy17/gpu specs #51

Open
wants to merge 10 commits into
base: rocm_enabled_multi_backend
Choose a base branch
from
Open

Lzy17/gpu specs #51

wants to merge 10 commits into from

Conversation

Lzy17
Copy link

@Lzy17 Lzy17 commented Nov 4, 2024

Replace the cuda specs with a more general gpu specs that supports both rocm and cuda

@Lzy17 Lzy17 changed the base branch from main to rocm_enabled_multi_backend November 4, 2024 15:43
@Lzy17 Lzy17 requested review from lcskrishna and pnunna93 November 8, 2024 20:22
bitsandbytes/gpu_specs.py Outdated Show resolved Hide resolved
tests/test_cuda_setup_evaluator.py Outdated Show resolved Hide resolved
@@ -24,7 +24,7 @@

from .base import Backend

if lib and lib.compiled_with_cuda:
if lib and lib.compiled_with_gpu:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are only for cuda and rocm as of now, may be use BNB_BACKEND from cextension instead?

Get the disk path to the CUDA BNB native library specified by the
given CUDA specs, taking into account the `BNB_CUDA_VERSION` override environment variable.
Get the disk path to the GPU BNB native library specified by the
given GPU specs, taking into account the `BNB_GPU_VERSION` override environment variable.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave env var as BNB_CUDA_VERSION and mention 'for cuda'

library_name = f"{library_name}{DYNAMIC_LIBRARY_SUFFIX}"

# Do I need to change it to BNB_GPU_VERSION here? IGNORE FOR NOW!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this comment

library_name = f"{library_name}{DYNAMIC_LIBRARY_SUFFIX}"

# Do I need to change it to BNB_GPU_VERSION here? IGNORE FOR NOW!
override_value = os.environ.get("BNB_CUDA_VERSION")
if override_value:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add condition for cuda backend

@@ -85,7 +85,7 @@ def get_potentially_lib_path_containing_env_vars() -> Dict[str, str]:
return {env_var: value for env_var, value in os.environ.items() if is_relevant_candidate_env_var(env_var, value)}


def find_cudart_libraries() -> Iterator[Path]:
def find_gpu_rt_libraries() -> Iterator[Path]:
"""
Searches for a cuda installations, in the following order of priority:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this comment generic for gpu backend

@@ -50,20 +50,20 @@ def main():
print_header("")

print_header("OTHER")
cuda_specs = get_cuda_specs()
gpu_specs = get_gpu_specs()
if HIP_ENVIRONMENT:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor the code to print gpu specs directly

@@ -25,7 +25,7 @@ def prod(iterable):

name2qmap = {}

if lib and lib.compiled_with_cuda:
if lib and lib.compiled_with_gpu:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to BNB_BACKEND cuda and rocm

@@ -2,27 +2,44 @@
import logging
import re
import subprocess
from typing import List, Optional, Tuple
from typing import Optional, Tuple, Union
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove Union if its not used anymore?

cuda_version_string="120",
def cuda120_spec() -> GPUSpecs:
return GPUSpecs(
backend_version_string="120",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set gpu_backend here

return CUDASpecs(
cuda_version_string="111",
def cuda111_noblas_spec() -> GPUSpecs:
return GPUSpecs(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set gpu_backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants