TotalSegmentator icon indicating copy to clipboard operation
TotalSegmentator copied to clipboard

Feature Addition: GPU Device Specification

Open hym97 opened this issue 1 year ago • 3 comments

Overview

I've added a new feature to the project that allows users to specify the GPU device using the -d option in the command line interface (CLI). Additionally, users can specify the GPU device in the Python API by passing the device parameter to the totalsegmentator() function.

Details

  • CLI Usage: Users can now specify the GPU device using the -d option followed by an integer representing the device index.

    TotalSegmentator -i input_path -o output_path -d 1
    
  • Python API Usage: Users can specify the GPU device by passing the device parameter to the totalsegmentator() function.

    totalsegmentator(input_path, output_path, device='1')
    

Changes Made

I have implemented the necessary changes to support GPU device specification both in the CLI and the Python API. I also add the necessary documentation to the README.md. The code changes are available for review in cuda_feature_selection.

Testing

I have successfully passed the first two test cases related to the GPU device specification feature. However, I was unable to complete the full testing process due to the lack of Xvfb and limited permissions.

Request for Review

I kindly request the author to review the changes made to the project. Your feedback and suggestions would be greatly appreciated.

Next Steps

Upon your review and approval, I would be happy to submit a pull request to integrate these changes into the main project repository.

Thank you for considering this contribution.

Best regards, Yimeng

hym97 avatar May 25 '24 05:05 hym97

Thanks for your suggestion. This is highly welcome. Since the device can also be cpu or mps, it would be a bit confusing to just put a number and then this relates to gpu. I would suggest to do gpu:1 or gpu:2.... Then we can parse the number out of this string. If only gpu is given, then use the default (gpu 0). Moreover, it does not make sense to create a test for this, since the tests are run on github actions which has only a cpu available. Can you do a PR with these changes?

wasserth avatar May 28 '24 13:05 wasserth

Sure, I can do that. I think I can finish it by the end of this week.

hym97 avatar May 28 '24 16:05 hym97

I corrected the typo in my code. Could you rerun the PR again? Thank you.

hym97 avatar Jun 01 '24 00:06 hym97