Skip to content

Enhance/gpu support - #203

Merged
drcege merged 10 commits into
mainfrom
enhance/gpu
Feb 22, 2024
Merged

Enhance/gpu support#203
drcege merged 10 commits into
mainfrom
enhance/gpu

Conversation

@drcege

@drcege drcege commented Jan 30, 2024

Copy link
Copy Markdown
Collaborator

GPU Model Loading

  • Models are now loaded onto GPUs where possible to maximize efficiency.
    • Currently, this feature is exclusive to Hugging Face models.
    • Adherence to the CUDA_VISIBLE_DEVICES setting ensures only designated GPUs are utilized.
    • The num_proc parameter is intelligently adjusted for optimal performance with mixed CPU/GPU operations.

Multiprocessing Strategy

  • Will automatically determine the most effective multiprocessing start method.
    • On GPU setups, forkserver is the default choice, switching to spawn if necessary.
    • For CPU-bound execution, fork provides the best compatibility and performance.
  • Users retain control over multiprocessing behavior via the MP_START_METHOD environment variable, with permissible values including auto, fork, forkserver, and spawn.

New Operator Development

  • When developing GPU-accelerated operators:
    • Declare GPU usage with self._accelerator = 'cuda'.
    • Both compute_stats and process methods should now include an optional rank parameter (rank=None) to support multi-GPU setups.

@drcege drcege added enhancement New feature or request dj:multimodal issues/PRs about multimodal data processing labels Jan 30, 2024
@drcege drcege added this to the Basic Multimodal Support milestone Jan 30, 2024
@drcege drcege self-assigned this Jan 30, 2024
@drcege drcege linked an issue Jan 30, 2024 that may be closed by this pull request
Comment thread data_juicer/__init__.py Outdated
@HYLcool

HYLcool commented Feb 8, 2024

Copy link
Copy Markdown
Collaborator

New Operator Development

  • When developing GPU-accelerated operators:

    • Declare GPU usage with self._accelerator = 'cuda'.
    • Both compute_stats and process methods should now include an optional rank parameter (rank=None) to support multi-GPU setups.

How about adding these instructions to the DeveloperGuide docs as well?

@drcege

drcege commented Feb 20, 2024

Copy link
Copy Markdown
Collaborator Author

Added GPU development guide.

@drcege
drcege requested a review from HYLcool February 21, 2024 08:28

@HYLcool HYLcool left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 馃帀

@drcege
drcege merged commit 092b3da into main Feb 22, 2024
@HYLcool
HYLcool deleted the enhance/gpu branch March 7, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dj:multimodal issues/PRs about multimodal data processing enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MM] speed up OPs using hf models (clip, ...)

2 participants