Closed akshaysubr closed 1 month ago
One of the reasons this is happening is because the initialization check in the DistributedManager
is based on checking the size of DistributedManager._shared_state
: https://github.com/NVIDIA/modulus/blob/main/modulus/distributed/manager.py#L194-L197
This silent initialization can be caught by having an explicit _is_initialized
member in the Borg class and only setting that to True
in the initialize
method.
@tge25 @dallasfoster Would this be a better way to prevent accidental usage of the DistributedManager
before it is initialized?
In [1]: from modulus.distributed import DistributedManager
In [2]: DistributedManager.is_initialized()
Out[2]: False
In [3]: manager = DistributedManager()
---------------------------------------------------------------------------
ModulusUninitializedDistributedManagerWarningTraceback (most recent call last)
Cell In[3], line 1
----> 1 manager = DistributedManager()
File /code/modulus-core/modulus/distributed/manager.py:115, in DistributedManager.__init__(self)
113 def __init__(self):
114 if not self._is_initialized:
--> 115 raise ModulusUninitializedDistributedManagerWarning()
116 super().__init__()
ModulusUninitializedDistributedManagerWarning: Instantiating DistributedManager before calling DistributedManager.initialize is not recommended
Version
main
On which installation method(s) does this occur?
Source
Describe the issue
This works as expected:
but this does not:
Minimum reproducible example
Relevant log output
No response
Environment details
No response