-
Notifications
You must be signed in to change notification settings - Fork 6.8k
#14199: catch subprocess.CalledProcessError in get_gpus() #14212
Conversation
@frankfliu thanks for the contribution, could you also change here: I believe that's all the usage of get_gpus() |
@mxnet-label-bot add[Example, Exception Handling, pr-awaiting-review] |
Couldn't we replace that with the native version? |
I changed implemenation to use MXGetGPUCount |
3112cd8
to
ae9119c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a question.
Is it continuous for valid GPU ids?
Yes, the GPU ids are continuous, and start from 0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
LGTM : )
Could you please retrigger the CI?
@frankfliu could you re-trigger CI? This PR can be merged once CI passes. |
1. Added get_gpus() and get_gpu_memory() API to python binding. 2. Update example script to use proper API for getting gpu numbers.
The PR has been merged. |
…he#14212) * Fixes apache#14199: use proper API get number of gpus. 1. Added get_gpus() and get_gpu_memory() API to python binding. 2. Update example script to use proper API for getting gpu numbers. * retrigger CI
…he#14212) * Fixes apache#14199: use proper API get number of gpus. 1. Added get_gpus() and get_gpu_memory() API to python binding. 2. Update example script to use proper API for getting gpu numbers. * retrigger CI
Description
fixes: #14199
Calling subprocess may fail with non-zero code. Catching subprocess.CalledProcessError to avoid get_gpus() crash.
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.