[API] Add cudnn_available() function to check DNN library availability#77880
Open
YqGe585 wants to merge 2 commits intoPaddlePaddle:developfrom
Open
[API] Add cudnn_available() function to check DNN library availability#77880YqGe585 wants to merge 2 commits intoPaddlePaddle:developfrom
YqGe585 wants to merge 2 commits intoPaddlePaddle:developfrom
Conversation
Add a new Python API `paddle.device.cudnn_available()` to check whether cuDNN or equivalent DNN library is available. This simplifies the code that previously used `get_cudnn_version()` just for availability checks. Changes: - Add CudnnAvailable() function in pybind.cc for CUDA/HIP and custom devices - Add cudnn_available() Python function in paddle/device/__init__.py - Replace get_cudnn_version() usage in conv.py files with cudnn_available() Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
你的PR提交成功,感谢你对开源项目的贡献! |
When cudnn_version is None (e.g., on custom devices), also check cudnn_available() to enable cuDNN usage if DNN library is available. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Member
Author
|
/re-run all-failed |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #77880 +/- ##
==========================================
Coverage ? 92.30%
==========================================
Files ? 4
Lines ? 13
Branches ? 0
==========================================
Hits ? 12
Misses ? 1
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
Author
|
/re-run all-failed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Custom Device
PR Types
Bug fixes
Description
Add a new Python API
paddle.device.cudnn_available()to check whether cuDNN or equivalent DNN library is available. This simplifies the code that previously usedget_cudnn_version()just for availability checks.Changes:
C++ Layer (
paddle/fluid/pybind/pybind.cc):CudnnAvailable()function that:platform::DnnVersion() > 0for CUDA/HIP buildsphi::DeviceManager::IsDnnAvailable(place)for custom device buildsfalseotherwisem.def("cudnn_available", CudnnAvailable);Python Layer (
python/paddle/device/__init__.py):cudnn_available()function that callscore.cudnn_available()__all__listFunctional Conv (
python/paddle/nn/functional/conv.py):get_cudnn_version()usages withcudnn_available()in:conv1d,conv2d,conv1d_transpose,conv2d_transpose,conv3d,conv3d_transposeLayer Conv (
python/paddle/nn/layer/conv.py):get_cudnn_version()usage in_ConvNdclass initializationBenefits:
use_cudnn = cudnn_available()instead of multi-line version checksis_custom_devicevariable inconv1d_transpose是否引起精度变化
否