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
c584482f
Commit
c584482f
authored
Oct 26, 2022
by
Tom Aarsen
Browse files
Resolve cases of CUDASetup.get_instance not being called when used
parent
a371be30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
bitsandbytes/cuda_setup/main.py
bitsandbytes/cuda_setup/main.py
+2
-2
bitsandbytes/cuda_setup/paths.py
bitsandbytes/cuda_setup/paths.py
+2
-2
No files found.
bitsandbytes/cuda_setup/main.py
View file @
c584482f
...
@@ -27,14 +27,14 @@ def check_cuda_result(cuda, result_val):
...
@@ -27,14 +27,14 @@ def check_cuda_result(cuda, result_val):
if
result_val
!=
0
:
if
result_val
!=
0
:
error_str
=
ctypes
.
c_char_p
()
error_str
=
ctypes
.
c_char_p
()
cuda
.
cuGetErrorString
(
result_val
,
ctypes
.
byref
(
error_str
))
cuda
.
cuGetErrorString
(
result_val
,
ctypes
.
byref
(
error_str
))
CUDASetup
.
get_instance
.
add_log_entry
(
f
"CUDA exception! Error code:
{
error_str
.
value
.
decode
()
}
"
)
CUDASetup
.
get_instance
()
.
add_log_entry
(
f
"CUDA exception! Error code:
{
error_str
.
value
.
decode
()
}
"
)
def
get_cuda_version
(
cuda
,
cudart_path
):
def
get_cuda_version
(
cuda
,
cudart_path
):
# https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART____VERSION.html#group__CUDART____VERSION
# https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART____VERSION.html#group__CUDART____VERSION
try
:
try
:
cudart
=
ctypes
.
CDLL
(
cudart_path
)
cudart
=
ctypes
.
CDLL
(
cudart_path
)
except
OSError
:
except
OSError
:
CUDASetup
.
get_instance
.
add_log_entry
(
f
'ERROR: libcudart.so could not be read from path:
{
cudart_path
}
!'
)
CUDASetup
.
get_instance
()
.
add_log_entry
(
f
'ERROR: libcudart.so could not be read from path:
{
cudart_path
}
!'
)
return
None
return
None
version
=
ctypes
.
c_int
()
version
=
ctypes
.
c_int
()
...
...
bitsandbytes/cuda_setup/paths.py
View file @
c584482f
...
@@ -61,7 +61,7 @@ def warn_in_case_of_duplicates(results_paths: Set[Path]) -> None:
...
@@ -61,7 +61,7 @@ def warn_in_case_of_duplicates(results_paths: Set[Path]) -> None:
"If you get `CUDA error: invalid device function` errors, the above "
"If you get `CUDA error: invalid device function` errors, the above "
"might be the cause and the solution is to make sure only one "
"might be the cause and the solution is to make sure only one "
f
"
{
CUDA_RUNTIME_LIB
}
in the paths that we search based on your env."
)
f
"
{
CUDA_RUNTIME_LIB
}
in the paths that we search based on your env."
)
CUDASetup
.
get_instance
.
add_log_entry
(
warning_msg
,
is_warning
=
True
)
CUDASetup
.
get_instance
()
.
add_log_entry
(
warning_msg
,
is_warning
=
True
)
def
determine_cuda_runtime_lib_path
()
->
Union
[
Path
,
None
]:
def
determine_cuda_runtime_lib_path
()
->
Union
[
Path
,
None
]:
...
@@ -87,7 +87,7 @@ def determine_cuda_runtime_lib_path() -> Union[Path, None]:
...
@@ -87,7 +87,7 @@ def determine_cuda_runtime_lib_path() -> Union[Path, None]:
if
conda_cuda_libs
:
if
conda_cuda_libs
:
return
next
(
iter
(
conda_cuda_libs
))
return
next
(
iter
(
conda_cuda_libs
))
CUDASetup
.
get_instance
.
add_log_entry
(
f
'
{
candidate_env_vars
[
"CONDA_PREFIX"
]
}
did not contain '
CUDASetup
.
get_instance
()
.
add_log_entry
(
f
'
{
candidate_env_vars
[
"CONDA_PREFIX"
]
}
did not contain '
f
'
{
CUDA_RUNTIME_LIB
}
as expected! Searching further paths...'
,
is_warning
=
True
)
f
'
{
CUDA_RUNTIME_LIB
}
as expected! Searching further paths...'
,
is_warning
=
True
)
if
"LD_LIBRARY_PATH"
in
candidate_env_vars
:
if
"LD_LIBRARY_PATH"
in
candidate_env_vars
:
...
...
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