Project-MONAI / Project-MONAI/MONAI

Make Monai (Random) Transforms work in a multi-threaded environment

Open
#7,582 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Feature request
Dominant language
Python
Stars
8.7k
Forks
1.6k
Avg merge
5d 1h
Merged PRs (30d)
20

Description

With PEP 703 being accepted and implementation of it underway https://github.com/python/cpython/issues/108219 I think it would be great to prepare the Monai transforms early for execution on multiple threads. Especially with the large tensor sizes and the advantages of running transforms on GPU, I'm hoping for free-threading to have a big benefit in (3D) medical imaging AI.

I think the biggest issue here would be the Randomizable transforms, which currently can't be executed inside a threaded environment.

AFAIK, the free-threading is pushed by Meta, and I'm therefore expecting pytorch to be compatible with it relatively early, since one of the talks on no-gil python talked about testing it with a pytorch DL project internally at Meta.

This might be a great opportunity to work on https://github.com/Project-MONAI/MONAI/issues/6854 as well, which might eventually require breaking changes in the Randomizable API as well.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading MONAI's Randomizable transforms and the related issue #6854, then review the PEP 703 free-threading context linked here. The issue names no files or tests, so first establish the required thread-safety changes and whether the Randomizable API needs breaking changes. Done requires an agreed implementation that supports Randomizable transforms in a multi-threaded environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-vision, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.