Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions smdebug/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,29 @@ class FRAMEWORK(Enum):
except (ImportError, ModuleNotFoundError):
_torch_dist_imported = None


logger = get_logger()
try:
import horovod.torch as hvd

# This redundant import is necessary because horovod does not raise an ImportError if the library is not present
import torch # noqa
#make sure the library is correctly imported
hvd.init()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know if this could interfer with other distribution strategies? I'm worried running init on horovod might cause a problem if the user is running SMDDP or DDP.


_hvd_imported = hvd
except AttributeError:
_hvd_imported = None
logger.error("horovod.torch is not correctly imported.")
raise
except (ModuleNotFoundError, ImportError):
try:
import horovod.tensorflow as hvd

_hvd_imported = hvd
except (ModuleNotFoundError, ImportError):
_hvd_imported = None
raise


logger = get_logger()
error_handling_agent = (
ErrorHandlingAgent.get_error_handling_agent()
) # set up error handler to wrap smdebug functions
Expand Down