- 
  Notifications
 You must be signed in to change notification settings 
- Fork 536
reimplementation of gpu_count #3718
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
reimplementation of gpu_count #3718
Conversation
222ebd5 to
 154f3c7  
 Compare
 
 | Codecov ReportAttention: Patch coverage is  
 
 Additional details and impacted files@@ Coverage Diff @@ ## master #3718 +/- ## ========================================== - Coverage 73.07% 73.05% -0.03% ========================================== Files 1278 1279 +1 Lines 59406 59414 +8 ========================================== - Hits 43411 43404 -7 - Misses 15995 16010 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
 | 
154f3c7 to
 4dfbbbe  
 Compare
 
 We need to remove gputil from the dependencies.
I'm not terribly worried about Windows, as there are many years of development since last time anybody tried to get nipype working on Windows.
We need to remove gputil from the dependencies.
Done
I'm not terribly worried about Windows, as there are many years of development since last time anybody tried to get nipype working on Windows.
I meant that I don't have a computer without a nvidia GPU to test if this code fix the error reported, I assumed it was on Windows. So even a test on other OS may be useful.
 
 
 nipype/utils/gpu_count.py
 
 Outdated
 
 
 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.
If the goal is to keep it as close to the source as possible, that's fine. Here are some cleanups for your consideration:
- Use shutil.which()unconditionally. We can detect aFileNotFoundErrorbefore calling the process and simply return 0.
- Use subprocess.run, which is the recommended API. By using text mode, we don't have to handle decoding or newline normalization.
- Use targeted errors. FileNotFoundErrorandPermissionError(bothOSErrors) should catch failures to run.UnicodeDecodeErrorwill catch bad output.
- Use p.output.splitlines()to get content-full lines. A trailing newline does not produce an empty string at the end of the list.
1.10.0 (March 19, 2025) New feature release in the 1.10.x series. This release adds GPUs to multiprocess resource management. In general, no changes to existing code should be required if the GPU-enabled interface has a ``use_gpu`` input. The ``n_gpu_procs`` can be used to set the number of GPU processes that may be run in parallel, which will override the default of GPUs identified by ``nvidia-smi``, or 1 if no GPUs are detected. * FIX: Reimplement ``gpu_count()`` (#3718) * FIX: Avoid 0D array in ``algorithms.misc.merge_rois`` (#3713) * FIX: Allow nipype.sphinx.ext.apidoc Config to work with Sphinx 8.2.1+ (#3716) * FIX: Resolve crashes when running workflows with updatehash=True (#3709) * ENH: Support for gpu queue (#3642) * ENH: Update to .wci.yml (#3708) * ENH: Add Workflow Community Initiative (WCI) descriptor (#3608)
fix #3717
I tried to write a simpler implementation of
getGPUsfrom gputil package.I used a separate file to include their license.
This need to be tested under windows with Python 3.12+ and I don't have such system, so it's untested for now.