Skip to content

Commit

Permalink
chore(api/libcuda): use 8 * sizeof(void *) for arch bit detection
Browse files Browse the repository at this point in the history
  • Loading branch information
XuehaiPan committed Jan 16, 2025
1 parent 27c3143 commit c276d5d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
- id: debug-statements
- id: double-quote-string-fixer
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.1
rev: v0.9.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
2 changes: 1 addition & 1 deletion nvitop/api/libcuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def __LoadCudaLibrary() -> None:
_itertools.chain.from_iterable((f'{lib}.1', lib) for lib in lib_filenames),
)
elif system == 'Windows':
bits = _platform.architecture()[0].replace('bit', '') # e.g., '64' or '32'
bits = 8 * _ctypes.sizeof(_ctypes.c_void_p) # 64 or 32
lib_filenames = [f'nvcuda{bits}.dll', 'nvcuda.dll']
# Open library
for lib_filename in lib_filenames:
Expand Down
2 changes: 1 addition & 1 deletion nvitop/api/libcudart.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def __LoadCudaLibrary() -> None: # pylint: disable=too-many-branches
if __cudaLib is None: # pylint: disable=too-many-nested-blocks
# Platform specific libcudart location
system = _platform.system()
bits = _platform.architecture()[0].replace('bit', '')
bits = 8 * _ctypes.sizeof(_ctypes.c_void_p) # 64 or 32
if system == 'Darwin':
lib_filenames = ['libcudart.dylib']
elif system == 'Linux':
Expand Down

0 comments on commit c276d5d

Please sign in to comment.