Improve assertion failure message (#14813)
authorPieter Noordhuis <pcnoordhuis@gmail.com>
Thu, 6 Dec 2018 01:18:06 +0000 (17:18 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 6 Dec 2018 01:20:25 +0000 (17:20 -0800)
Summary:
See #14554.

I can't figure out how the reported issue can happen. The best next
thing is have more information when this happens again.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14813

Differential Revision: D13351908

Pulled By: pietern

fbshipit-source-id: 61b30fcae2e34da54329d0893ca4921b6ad60f0d

test/test_distributed.py

index 8df327b..637336b 100644 (file)
@@ -1009,7 +1009,11 @@ class _DistTestBase(object):
             else:
                 dist.broadcast(expected_time, dest, group_id)
                 dist.barrier(group_id)
-                self.assertGreaterEqual(time.time(), expected_time[0])
+                self.assertGreaterEqual(
+                    float(time.time()),
+                    float(expected_time[0]),
+                    "destination rank: %d, my rank: %d" % (dest, rank) +
+                    " (if you see this failure, please report in #14554)")
 
         # Use higher timeout for the instance where the test runs
         # against a subgroup and uses a CUDA tensor for expected time.