You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/04/03 12:01:49 UTC
[GitHub] [incubator-mxnet] wkcn commented on issue #14610: [Feature Request]
Disable lazy evaluation
wkcn commented on issue #14610: [Feature Request] Disable lazy evaluation
URL: https://github.com/apache/incubator-mxnet/issues/14610#issuecomment-479459608
I wrote a test case:
```python
import mxnet as mx
import time
N = 4000
a = mx.nd.zeros((N, N))
b = mx.nd.zeros((N, N))
while 1:
tic = time.time()
c = mx.nd.dot(a, b)
# time.sleep(5)
tic2 = time.time()
c.wait_to_read()
print("wait_to_read", time.time() - tic2)
print(time.time() - tic)
```
The output is as follow:
```
('wait_to_read', 2.236266851425171)
2.23689508438
('wait_to_read', 2.1589441299438477)
2.15961289406
('wait_to_read', 2.1335580348968506)
2.13375878334
```
It takes about 2 seconds to execute all operators.
However, after uncommenting `time.sleep(5)`, there is the output:
```
('wait_to_read', 6.985664367675781e-05)
5.00382494926
('wait_to_read', 2.384185791015625e-05)
5.00761890411
('wait_to_read', 2.5987625122070312e-05)
5.0087518692
```
It shows that `wait_to_read` spent `2e-5` seconds.
When does the operators execute?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services