Skip to content

Commit

Permalink
extend Horovod/MPI demo further
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz committed Jun 8, 2020
1 parent 56c311e commit 1969b4e
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions demos/demo-horovod-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,31 @@
print()

if os.environ.get("PE_HOSTFILE", ""):
with open(os.environ["PE_HOSTFILE"], "r") as f:
try:
print("PE_HOSTFILE, %s:" % os.environ["PE_HOSTFILE"])
print(f.read())
with open(os.environ["PE_HOSTFILE"], "r") as f:
print(f.read())
except FileNotFoundError as exc:
print(exc)

if os.environ.get("SGE_JOB_SPOOL_DIR", ""):
print("SGE_JOB_SPOOL_DIR, %s:" % os.environ["SGE_JOB_SPOOL_DIR"])
for name in os.listdir(os.environ["SGE_JOB_SPOOL_DIR"]):
print(name)
print()

if os.environ.get("OMPI_FILE_LOCATION", ""):
print("OMPI_FILE_LOCATION, %s:" % os.environ["OMPI_FILE_LOCATION"])
d = os.path.dirname(os.path.dirname(os.environ["OMPI_FILE_LOCATION"]))
print("dir:", d)
for name in os.listdir(d):
print(name)
print()
print("contact.txt:")
with open("%s/contact.txt" % d, "r") as f:
print(f.read())
print()

# https://github.com/horovod/horovod/issues/1123
try:
import ctypes
Expand All @@ -40,9 +55,12 @@
i += 1
print()

print("Import TF now...")
import tensorflow as tf
print("TF version:", tf.__version__)

import horovod
print("Horovod version:", horovod.__version__)
import horovod.tensorflow as hvd

# Initialize Horovod
Expand Down

0 comments on commit 1969b4e

Please sign in to comment.