ff48ad86ca20562cb9d5f53db8629ad8ba32e426,test/test_mxnet.py,MXTests,test_horovod_allreduce,#MXTests#,48

Before Change


            tensor = tensor.astype(dtype)
            summed = hvd.allreduce(tensor, average=False, name=str(count))
            multiplied = tensor * size
            max_difference = mx.nd.max(mx.nd.subtract(summed, multiplied))
            count += 1

            // Threshold for floating point equality depends on number of
            // ranks, since we"re comparing against precise multiplication.
            if size <= 3 or dtype in ["int32", "int64"]:
                threshold = 0
            elif size < 10:
                threshold = 1e-4
            elif size < 15:
                threshold = 5e-4
            else:
                break

            if max_difference > threshold:
                print("allreduce", count, dtype, dim, max_difference,
                      threshold)
                print("tensor", hvd.rank(), tensor)
                print("summed", hvd.rank(), summed)
                print("multiplied", hvd.rank(), multiplied)
            assert max_difference <= threshold, "hvd.allreduce produces \
                                                 incorrect results"

    def test_horovod_allreduce_average(self):
        Test that the allreduce correctly sums 1D, 2D, 3D tensors.
        hvd.init()

After Change


            else:
                break

            assert almost_equal(summed.asnumpy(), multiplied.asnumpy(), atol=threshold), \
                f"hvd.allreduce produces incorrect results: {hvd.rank()} {count} {dtype} {dim}"

    def test_horovod_allreduce_average(self):
        Test that the allreduce correctly sums 1D, 2D, 3D tensors.
        hvd.init()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 16

Instances


Project Name: horovod/horovod
Commit Name: ff48ad86ca20562cb9d5f53db8629ad8ba32e426
Time: 2020-07-17
Author: taddair@uber.com
File Name: test/test_mxnet.py
Class Name: MXTests
Method Name: test_horovod_allreduce


Project Name: horovod/horovod
Commit Name: ff48ad86ca20562cb9d5f53db8629ad8ba32e426
Time: 2020-07-17
Author: taddair@uber.com
File Name: test/test_mxnet.py
Class Name: MXTests
Method Name: test_horovod_allreduce


Project Name: horovod/horovod
Commit Name: ff48ad86ca20562cb9d5f53db8629ad8ba32e426
Time: 2020-07-17
Author: taddair@uber.com
File Name: test/test_mxnet.py
Class Name: MXTests
Method Name: test_horovod_allreduce_inplace


Project Name: horovod/horovod
Commit Name: ff48ad86ca20562cb9d5f53db8629ad8ba32e426
Time: 2020-07-17
Author: taddair@uber.com
File Name: test/test_mxnet.py
Class Name: MXTests
Method Name: test_horovod_allreduce_average