Skip to content
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

cufile.log file in the current directory #6020

Closed
wyli opened this issue Feb 17, 2023 · 10 comments · Fixed by #6106
Closed

cufile.log file in the current directory #6020

wyli opened this issue Feb 17, 2023 · 10 comments · Fixed by #6106
Assignees
Labels
bug Something isn't working

Comments

@wyli
Copy link
Contributor

wyli commented Feb 17, 2023

Describe the bug
running

import monai

will create a cufile.log in the current directory.

to replicate:

docker run --gpus all -ti --rm  projectmonai/monai:latest bash -c "python -c 'import monai'; ls cufile.log"

expected behaviour:

No such file or directory

docker run --gpus all -ti --rm  projectmonai/monai:latest bash -c "ls cufile.log"
@wyli
Copy link
Contributor Author

wyli commented Feb 17, 2023

may I assign this to you @mingxin-zheng? this will affect all the containers I think.

@wyli wyli added the bug Something isn't working label Feb 17, 2023
@mingxin-zheng mingxin-zheng self-assigned this Feb 17, 2023
@mingxin-zheng
Copy link
Contributor

Sure. Just took a stab on it. The file appeared in PyTorch 22.11 but not 22.09.

@mingxin-zheng
Copy link
Contributor

Hi @wyli , is there any component in MONAI using GPUDirect Storage?

@wyli
Copy link
Contributor Author

wyli commented Feb 17, 2023

looks like it's from cucim... rapidsai/cucim#514

@mingxin-zheng
Copy link
Contributor

Yes. If we use pip uninstall cucim in the container, the cufile log will be gone.

@wyli wyli added this to MONAI v1.2 Feb 21, 2023
@mingxin-zheng
Copy link
Contributor

mingxin-zheng commented Mar 1, 2023

It seems we need to set logging:dir in the /etc/cufile.json

 "logging": {
                // log directory, if not enabled will create log file under current working directory
                //"dir": "/home/<xxxx>",

                // NOTICE|ERROR|WARN|INFO|DEBUG|TRACE (in decreasing order of severity)
                "level": "ERROR"
},

@wyli
Copy link
Contributor Author

wyli commented Mar 1, 2023

so for the pip install monai users, how to address this issue? I think in this case we should delay 'import cucim' so that we don't create this log file.

@mingxin-zheng
Copy link
Contributor

I just checked that pip install would cause the same issue on a freshly-created conda environment on my linux.

I cannot think of another way to get rid of this file for pip install users. But I am quite confused now because the cucim version wasn't changed since 1.0.0 release. I would first test it on more systems.

@wyli
Copy link
Contributor Author

wyli commented Mar 6, 2023

Hi @mingxin-zheng, I've created a workaround to remove unnecessary cucim imports... #6106 I feel it makes sense for now that the log file is only created when the user triggers some cucim functions.

@mingxin-zheng
Copy link
Contributor

mingxin-zheng commented Mar 7, 2023

Hi @wyli , I test this on another system with virtualvenv on another machine with pip install. And this time the cuFile.log did not appear. So I am still confused how this is triggered.

I think delaying the imports seems a reasonable solution for MONAI 1.2 and later versions. But the fix wouldn't affect the previous versions. Should we specify the location of this file in existing container building process (e.g. MONAI 1.0.1 + PyTorch 23.02 in Toolkit), or just leave it in the working directory? cc @Nic-Ma .

@wyli wyli closed this as completed in #6106 Mar 7, 2023
wyli added a commit that referenced this issue Mar 7, 2023
Fixes #6020

### Description

```
pip install cucim
python -c "import cucim"
```
may create a `cufile.log` file in the current working directory (please
see rapidsai/cucim#514)

this PR delays the cucim imports to when the modules are really needed. 

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Wenqi Li <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants