-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
update itk requirement to >= 5.2 #1629
Comments
itk 5.2.0 has been released, it is causing some issue: docker run --gpus all --rm -ti --ipc=host --net=host -v ~/Documents/MONAI:/opt/monai nvcr.io/nvidia/pytorch:20.03-py3
# within the docker container run:
cd /opt/monai
python -m pip install --upgrade pip wheel
python -m pip uninstall -y torch torchvision
python -m pip install torch==1.7.1 torchvision==0.8.2
python -m pip install -r requirements-dev.txt
python -m tests.test_distributed_sampler # run tests/test_distributed_sampler.py outcome:
example log: https://github.com/Project-MONAI/MONAI/runs/2266945686?check_suite_focus=true I had a quick look, the same code works fine with itk 5.1.2. so I suspect it's an issue in the way MONAI using itk any idea @thewtex ? |
a smaller example to reproduce (python3 + linux + pytorch 1.7/1.8): from torch import multiprocessing
try:
multiprocessing.set_start_method("spawn")
except RuntimeError:
pass
import itk
import torch
if __name__ == "__main__":
for d in torch.utils.data.DataLoader([torch.tensor(i) for i in range(10)], num_workers=4):
pass this works fine with itk 5.1.2 but has the warnings with itk5.2.0 perhaps this global RLock is causing the issue https://github.com/InsightSoftwareConsortium/ITK/blob/6dfbc9f0314b5fd64d4b2ae392ae3cc6dda17677/Wrapping/Generators/Python/itk/support/lazy.py#L29 cc @hjmjohnson |
This addresses: > /opt/conda/lib/python3.6/multiprocessing/semaphore_tracker.py:143: UserWarning: semaphore_tracker: There appear to be 1 leaked semaphores to clean up at shutdown len(cache)) Reported in Project-MONAI/MONAI#1629 Here we adopt the approach in tqdm: tqdm/tqdm#617 to address the similar issues with PyTorch: tqdm/tqdm#611 but for our use case. A global set of locks is added to the class on first use. We also add a threading lock in addition to a multiprocessing lock.
@wyli thanks for the detailed, reproducible report 🥇 I verified that this patch addresses the issue: |
This addresses: > /opt/conda/lib/python3.6/multiprocessing/semaphore_tracker.py:143: UserWarning: semaphore_tracker: There appear to be 1 leaked semaphores to clean up at shutdown len(cache)) Reported in Project-MONAI/MONAI#1629 Here we adopt the approach in tqdm: tqdm/tqdm#617 to address the similar issues with PyTorch: tqdm/tqdm#611 but for our use case. A global set of locks is added to the class on first use. We also add a threading lock in addition to a multiprocessing lock.
This addresses: > /opt/conda/lib/python3.6/multiprocessing/semaphore_tracker.py:143: UserWarning: semaphore_tracker: There appear to be 1 leaked semaphores to clean up at shutdown len(cache)) Reported in Project-MONAI/MONAI#1629 Here we adopt the approach in tqdm: tqdm/tqdm#617 to address the similar issues with PyTorch: tqdm/tqdm#611 but for our use case. A global set of locks is added to the class on first use. We also add a threading lock in addition to a multiprocessing lock.
This addresses: > /opt/conda/lib/python3.6/multiprocessing/semaphore_tracker.py:143: UserWarning: semaphore_tracker: There appear to be 1 leaked semaphores to clean up at shutdown len(cache)) Reported in Project-MONAI/MONAI#1629 Here we adopt the approach in tqdm: tqdm/tqdm#617 to address the similar issues with PyTorch: tqdm/tqdm#611 but for our use case. A global set of locks is added to the class on first use.
This addresses: > /opt/conda/lib/python3.6/multiprocessing/semaphore_tracker.py:143: UserWarning: semaphore_tracker: There appear to be 1 leaked semaphores to clean up at shutdown len(cache)) Reported in Project-MONAI/MONAI#1629 Here we adopt the approach in tqdm: tqdm/tqdm#617 to address the similar issues with PyTorch: tqdm/tqdm#611 but for our use case. A global set of locks is added to the class on first use.
@wyli this has been addressed in I will help with the remaining issues based on this package in the coming month. |
thanks @thewtex! |
Signed-off-by: Wenqi Li <[email protected]>
it still gives the warning:
https://github.com/Project-MONAI/MONAI/runs/2728004520?check_suite_focus=true#step:7:2534 |
@wyli thanks for the report. We will keep pushing on this! Tracked in InsightSoftwareConsortium/ITK#2603 |
Signed-off-by: Wenqi Li <[email protected]>
Following-up: |
once itk 5.2 is released, requirements.txt needs to be updated and the warning message removed.
this is a follow up of
see also:
https://github.com/InsightSoftwareConsortium/ITK/tags
The text was updated successfully, but these errors were encountered: