[GitHub] haojin2 commented on issue #10208: [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr
haojin2 commented on issue #10208: [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr URL: https://github.com/apache/incubator-mxnet/pull/10208#issuecomment-379527460 Update on 4/8: A small benchmark for this operator is added to compare the new implementation with the fallback implementation ``` import mxnet as mx import scipy import numpy as np import time def measure_cost(repeat, f, *args, **kwargs): # start bench start = time.time() results = [] for i in range(repeat): results.append(f(*args, **kwargs)) for result in results: result.wait_to_read() end = time.time() diff = end - start return diff / repeat def main(): shape_lhs = (256, 100) vec = np.random.uniform(size=(256, 1)) mx_vec = mx.nd.array(vec) for density in [0.01, 0.005, 0.001]: csr = scipy.sparse.random(256, 100, density=density, format = 'csr', dtype=np.float32) mx_csr = mx.nd.sparse.csr_matrix((csr.data, csr.indices, csr.indptr), shape=shape_lhs, ctx=mx.cpu()) mx_dns = mx_csr.tostype('default') sparse_cost = 0.0 dns_cost = 0.0 for i in range(10): sparse_cost += measure_cost(100, mx.nd.broadcast_mul, mx_csr, mx_vec) dns_cost += measure_cost(100, mx.nd.broadcast_mul, mx_dns, mx_vec) print("%.2f %%" % (density*100), dns_cost / sparse_cost) if __name__ == "__main__": main() ``` Results on p2.8xlarge instance with commit(2ae0bd598b83f4d51481cd8f19ea241da31c16bb): (density speedup) (1.00% 9.453656599452351) (0.50% 18.406541290116778) (0.10% 53.18159853487238) This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] haojin2 commented on issue #10208: [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr
haojin2 commented on issue #10208: [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr URL: https://github.com/apache/incubator-mxnet/pull/10208#issuecomment-379527460 Update on 4/8: A small benchmark for this operator is added to compare the new implementation with the fallback implementation ``` import mxnet as mx import scipy import numpy as np import time def measure_cost(repeat, f, *args, **kwargs): # start bench start = time.time() results = [] for i in range(repeat): results.append(f(*args, **kwargs)) for result in results: result.wait_to_read() end = time.time() diff = end - start return diff / repeat def main(): shape_lhs = (256, 100) vec = np.random.uniform(size=(256, 1)) mx_vec = mx.nd.array(vec) for density in [0.01, 0.005, 0.001]: csr = scipy.sparse.random(256, 100, density=density, format = 'csr', dtype=np.float32) mx_csr = mx.nd.sparse.csr_matrix((csr.data, csr.indices, csr.indptr), shape=shape_lhs, ctx=mx.cpu()) mx_dns = mx_csr.tostype('default') sparse_cost = 0.0 dns_cost = 0.0 for i in range(10): sparse_cost += measure_cost(100, mx.nd.broadcast_mul, mx_csr, mx_vec) dns_cost += measure_cost(100, mx.nd.broadcast_mul, mx_dns, mx_vec) print("%.2f %%" % (density*100), dns_cost / sparse_cost) if __name__ == "__main__": main() ``` Results on p2.8xlarge instance: (density speedup) (1.00% 9.453656599452351) (0.50% 18.406541290116778) (0.10% 53.18159853487238) This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] haojin2 commented on issue #10208: [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr
haojin2 commented on issue #10208: [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr URL: https://github.com/apache/incubator-mxnet/pull/10208#issuecomment-379527460 Update on 4/8: A small benchmark for this operator is added to compare the new implementation with the fallback implementation ``` import mxnet as mx import scipy import numpy as np import time def measure_cost(repeat, f, *args, **kwargs): # start bench start = time.time() results = [] for i in range(repeat): results.append(f(*args, **kwargs)) for result in results: result.wait_to_read() end = time.time() diff = end - start return diff / repeat def main(): shape_lhs = (256, 100) vec = np.random.uniform(size=(256, 1)) mx_vec = mx.nd.array(vec) for density in [0.01, 0.005, 0.001]: csr = scipy.sparse.random(256, 100, density=density, format = 'csr', dtype=np.float32) mx_csr = mx.nd.sparse.csr_matrix((csr.data, csr.indices, csr.indptr), shape=shape_lhs, ctx=mx.cpu()) mx_dns = mx_csr.tostype('default') sparse_cost = 0.0 dns_cost = 0.0 for i in range(10): sparse_cost += measure_cost(100, mx.nd.broadcast_mul, mx_csr, mx_vec) dns_cost += measure_cost(100, mx.nd.broadcast_mul, mx_dns, mx_vec) print("%.2f %%" % (density*100), dns_cost / sparse_cost) if __name__ == "__main__": main() ``` Results: (density speedup) (1.00% 9.453656599452351) (0.50% 18.406541290116778) (0.10% 53.18159853487238) This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] haojin2 commented on issue #10208: [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr
haojin2 commented on issue #10208: [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr URL: https://github.com/apache/incubator-mxnet/pull/10208#issuecomment-377393994 @sergeykolychev Thank you very much! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] haojin2 commented on issue #10208: [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr
haojin2 commented on issue #10208: [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr URL: https://github.com/apache/incubator-mxnet/pull/10208#issuecomment-376564403 Sure, please take your time! Thanks a lot for your help! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] haojin2 commented on issue #10208: [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr
haojin2 commented on issue #10208: [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr URL: https://github.com/apache/incubator-mxnet/pull/10208#issuecomment-376363351 @sergeykolychev Probably by the end of this month would be a hard deadline for me, since it would be good check this in for the next release. I guess all what we need are some minor changes to the interface similar to my changes to sparse.py in this PR on the Perl side, so I think any help at your earliest convenience is appreciated, thanks for your response and enjoy your vacation! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] haojin2 commented on issue #10208: [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr
haojin2 commented on issue #10208: [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr URL: https://github.com/apache/incubator-mxnet/pull/10208#issuecomment-376314422 @sergeykolychev Hi, my PR is failing some tests because I've changed some interface in Python but I'm not familiar with Perl so I'm not able to make the same changes in Perl. I wonder if you could please give some help on how to make corresponding changes in Perl so that my builds could pass? Thanks! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services