mxnet-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anirudh Subramanian (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MXNET-323) Broadcasting ops are slow
Date Wed, 02 May 2018 21:16:00 GMT

    [ https://issues.apache.org/jira/browse/MXNET-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16461630#comment-16461630
] 

Anirudh Subramanian commented on MXNET-323:
-------------------------------------------

Ran the script provided in the github issue:
{quote}
 import mxnet as mx
 import time

a = mx.sym.var('a')
 b = mx.sym.var('b')

a_ = mx.nd.ones((2**20,))
 b1 = mx.nd.ones((2**20,))
 b2 = mx.nd.ones((1,))

func2 = mx.sym.broadcast_add(a, b).bind(mx.cpu(),

{'a': a_, 'b': b2}

)
 for i in range(1000):
 func2.forward()[0].wait_to_read()

func1 = (a + b).bind(mx.cpu(),

{'a': a_, 'b': b1}

)
 func2 = mx.sym.broadcast_add(a, b).bind(mx.cpu(),

{'a': a_, 'b': b2}

)
 func3 = (a + 1.).bind(mx.cpu(),

{'a': a_}

)

for x in range(4):
 print("PASS: {}...", x)
 # array + array
 start = time.time()
 for i in range(1000):
 func1.forward()[0].wait_to_read()
 print("func1: {}".format(time.time() - start))

 # boadcast_add(scalar, array)
 start = time.time()
 for i in range(1000):
 func2.forward()[0].wait_to_read()
 print("func2: {}".format(time.time() - start))

 # array + scalar
 start = time.time()
 for i in range(1000):
 func3.forward()[0].wait_to_read()
 print("func3: {}".format(time.time() - start))

print(" ")
{quote}

> Broadcasting ops are slow
> -------------------------
>
>                 Key: MXNET-323
>                 URL: https://issues.apache.org/jira/browse/MXNET-323
>             Project: Apache MXNet
>          Issue Type: Improvement
>            Reporter: Lai Wei
>            Assignee: Anirudh Subramanian
>            Priority: Major
>
> https://github.com/apache/incubator-mxnet/issues/8219



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


Mime
View raw message