Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
bitsandbytes
Commits
97b2567a
Commit
97b2567a
authored
Apr 25, 2023
by
rapsealk
Browse files
fix: Replace libcudart with pytorch api
parent
659a7dfc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
24 deletions
+3
-24
bitsandbytes/cuda_setup/main.py
bitsandbytes/cuda_setup/main.py
+3
-24
No files found.
bitsandbytes/cuda_setup/main.py
View file @
97b2567a
...
@@ -326,31 +326,10 @@ def get_cuda_lib_handle():
...
@@ -326,31 +326,10 @@ def get_cuda_lib_handle():
def
get_compute_capabilities
(
cuda
):
def
get_compute_capabilities
(
cuda
):
"""
1. find libcuda.so library (GPU driver) (/usr/lib)
init_device -> init variables -> call function by reference
2. call extern C function to determine CC
(https://docs.nvidia.com/cuda/cuda-driver-api/group__CUDA__DEVICE__DEPRECATED.html)
3. Check for CUDA errors
https://stackoverflow.com/questions/14038589/what-is-the-canonical-way-to-check-for-errors-using-the-cuda-runtime-api
# bits taken from https://gist.github.com/f0k/63a664160d016a491b2cbea15913d549
"""
nGpus
=
ct
.
c_int
()
cc_major
=
ct
.
c_int
()
cc_minor
=
ct
.
c_int
()
device
=
ct
.
c_int
()
check_cuda_result
(
cuda
,
cuda
.
cuDeviceGetCount
(
ct
.
byref
(
nGpus
)))
ccs
=
[]
ccs
=
[]
for
i
in
range
(
nGpus
.
value
):
# for i in range(torch.cuda.device_count()):
check_cuda_result
(
cuda
,
cuda
.
cuDeviceGet
(
ct
.
byref
(
device
),
i
))
# device = torch.cuda.device(i)
ref_major
=
ct
.
byref
(
cc_major
)
ccs
.
append
(
torch
.
version
.
cuda
)
ref_minor
=
ct
.
byref
(
cc_minor
)
# 2. call extern C function to determine CC
check_cuda_result
(
cuda
,
cuda
.
cuDeviceComputeCapability
(
ref_major
,
ref_minor
,
device
))
ccs
.
append
(
f
"
{
cc_major
.
value
}
.
{
cc_minor
.
value
}
"
)
return
ccs
return
ccs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment