Skip to content

Commit

Permalink
Replace custom CUDA bindings previously provided by RMM with official…
Browse files Browse the repository at this point in the history
… CUDA Python bindings (#10008)

This PR replaces custom CUDA bindings that are provided by RMM, with official CUDA Python bindings. This PR should be merged after the RMM PR  rapidsai/rmm#930

Authors:
  - Ashwin Srinath (https://github.com/shwina)

Approvers:
  - Jordan Jacobelli (https://github.com/Ethyling)
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Bradley Dice (https://github.com/bdice)

URL: #10008
  • Loading branch information
shwina authored Jan 20, 2022
1 parent 8fd7dd2 commit f041034
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
1 change: 1 addition & 0 deletions conda/environments/cudf_dev_cuda11.5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies:
- ipython
- pandoc=<2.0.0
- cudatoolkit=11.5
- cuda-python >=11.5,<12.0
- pip
- flake8=3.8.3
- black=19.10
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cudf/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ requirements:
- packaging
- cachetools
- ptxcompiler # [linux64] # CUDA enhanced compatibility. See https://github.com/rapidsai/ptxcompiler

- cuda-python >=11.5,<12.0
test: # [linux64]
requires: # [linux64]
- cudatoolkit {{ cuda_version }}.* # [linux64]
Expand Down
42 changes: 20 additions & 22 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 cudaDeviceAttr, 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(),
cudaError.cudaErrorUnknown,
cudaError.cudaErrorApiFailureBase,
cudaError_t.cudaErrorUnknown,
cudaError_t.cudaErrorApiFailureBase,
}

try:
Expand All @@ -68,8 +68,6 @@ 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
)
Expand Down

0 comments on commit f041034

Please sign in to comment.