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

Replace custom CUDA bindings previously provided by RMM with official CUDA Python bindings #10008

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 22 additions & 28 deletions python/cudf/cudf/utils/gpu_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ def validate_setup():

import warnings

from cuda.cudart import cudaError_t

from rmm._cuda.gpu import (
CUDARuntimeError,
cudaDeviceAttr,
cudaError,
deviceGetName,
driverGetVersion,
getDeviceAttribute,
Expand All @@ -30,30 +30,30 @@ def _try_get_old_or_new_symbols():
try:
# CUDA 10.2+ symbols
return [
cudaError.cudaErrorDeviceUninitialized,
cudaError.cudaErrorTimeout,
cudaError_t.cudaErrorDeviceUninitialized,
cudaError_t.cudaErrorTimeout,
]
except AttributeError:
# CUDA 10.1 symbols
return [cudaError.cudaErrorDeviceUninitilialized]
return [cudaError_t.cudaErrorDeviceUninitilialized]

notify_caller_errors = {
cudaError.cudaErrorInitializationError,
cudaError.cudaErrorInsufficientDriver,
cudaError.cudaErrorInvalidDeviceFunction,
cudaError.cudaErrorInvalidDevice,
cudaError.cudaErrorStartupFailure,
cudaError.cudaErrorInvalidKernelImage,
cudaError.cudaErrorAlreadyAcquired,
cudaError.cudaErrorOperatingSystem,
cudaError.cudaErrorNotPermitted,
cudaError.cudaErrorNotSupported,
cudaError.cudaErrorSystemNotReady,
cudaError.cudaErrorSystemDriverMismatch,
cudaError.cudaErrorCompatNotSupportedOnDevice,
cudaError_t.cudaErrorInitializationError,
cudaError_t.cudaErrorInsufficientDriver,
cudaError_t.cudaErrorInvalidDeviceFunction,
cudaError_t.cudaErrorInvalidDevice,
cudaError_t.cudaErrorStartupFailure,
cudaError_t.cudaErrorInvalidKernelImage,
cudaError_t.cudaErrorAlreadyAcquired,
cudaError_t.cudaErrorOperatingSystem,
cudaError_t.cudaErrorNotPermitted,
cudaError_t.cudaErrorNotSupported,
cudaError_t.cudaErrorSystemNotReady,
cudaError_t.cudaErrorSystemDriverMismatch,
cudaError_t.cudaErrorCompatNotSupportedOnDevice,
*_try_get_old_or_new_symbols(),
vyasr marked this conversation as resolved.
Show resolved Hide resolved
cudaError.cudaErrorUnknown,
cudaError.cudaErrorApiFailureBase,
cudaError_t.cudaErrorUnknown,
cudaError_t.cudaErrorApiFailureBase,
}

try:
Expand All @@ -68,11 +68,7 @@ def _try_get_old_or_new_symbols():
# Cupy throws RunTimeException to get GPU count,
# hence obtaining GPU count by in-house cpp api above

# 75 - Indicates to get "cudaDevAttrComputeCapabilityMajor" attribute
# 0 - Get GPU 0
major_version = getDeviceAttribute(
cudaDeviceAttr.cudaDevAttrComputeCapabilityMajor, 0
)
major_version = getDeviceAttribute("ComputeCapabilityMajor", 0)

if major_version >= 6:
# You have a GPU with NVIDIA Pascal™ architecture or better
Expand All @@ -86,9 +82,7 @@ def _try_get_old_or_new_symbols():
pass
else:
device_name = deviceGetName(0)
minor_version = getDeviceAttribute(
cudaDeviceAttr.cudaDevAttrComputeCapabilityMinor, 0
)
minor_version = getDeviceAttribute("ComputeCapabilityMinor", 0)
warnings.warn(
f"You will need a GPU with NVIDIA Pascal™ or "
f"newer architecture"
Expand Down