Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Sparse Tensor: request for reviews #7082

Merged
merged 87 commits into from
Aug 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
c5f6648
[WIP] Sparse Tensor (#5800)
eric-haibin-lin Jun 26, 2017
db65770
move storage type vector from nnvm to mxnet (#7054)
eric-haibin-lin Jul 15, 2017
e2607da
fix failed tests. add back 64bit support for dot
eric-haibin-lin Jul 17, 2017
978748e
Improve copy sparse tensors (#7003)
reminisce Jul 15, 2017
ce0fec8
bug fix for IdentityComputeRsp
eric-haibin-lin Jul 18, 2017
a2b3d3e
fix lint
eric-haibin-lin Jul 18, 2017
27c9ac0
add data partition for libsvm iter (#7027)
eric-haibin-lin Jul 21, 2017
3a394ea
fix ndarray namespace
eric-haibin-lin Jul 22, 2017
cf61a9e
remove sparse embedding (#7165)
eric-haibin-lin Jul 23, 2017
fe62976
remove untested gpu operators (#7172)
eric-haibin-lin Jul 24, 2017
4de0fdd
Fix ndarray aux data issue (#7098)
reminisce Jul 25, 2017
a472b61
Support K-dimensional row-sparse tensor (#7179)
eric-haibin-lin Jul 25, 2017
6a01b6e
Improve sparse ndarray error message (#7181)
eric-haibin-lin Jul 25, 2017
05ddf38
construct row_sparse ndarray for dist-async
eric-haibin-lin Jun 26, 2017
f57fc3c
Merge remote-tracking branch 'upstream/master' into dmlc-sparse-squash
eric-haibin-lin Jul 26, 2017
0ed14d1
fix DotCsrRspRspImpl error message (#7191)
stefanhenneking Jul 26, 2017
f0af872
GPU implementation of cast_storage (dense to csr) (#7081)
stefanhenneking Jul 27, 2017
6f0719f
Sparse square sum (#7206)
reminisce Jul 27, 2017
ec2c4bf
Modify and Add documentation for mx.nd.zeros (#7197)
anirudh2290 Jul 27, 2017
88eaac6
Merge remote-tracking branch 'upstream/master' into dmlc-sparse-squash
eric-haibin-lin Jul 27, 2017
3b94a3c
Expose kWriteInplace for imperative execution (fcompute_ex and fstate…
eric-haibin-lin Jul 28, 2017
55e4763
Operator add_n for row sparse ndarrays (#7244)
reminisce Aug 1, 2017
7e1647c
GPU implementation of cast_storage (dense to rsp) (#7223)
stefanhenneking Aug 1, 2017
5905ddc
merge with dmlc/master
eric-haibin-lin Aug 2, 2017
d8a9aba
resolve merge conflict in ndarray.load
eric-haibin-lin Aug 2, 2017
f686174
Improve StatefulOp/FCompute storage fallback (#134)
eric-haibin-lin Aug 2, 2017
d0579c4
update sparse ndarray api (#139)
eric-haibin-lin Aug 3, 2017
56b5a63
Merge remote-tracking branch 'upstream/master' into sparse
eric-haibin-lin Aug 3, 2017
325f4db
Handle ograd_stype='row_sparse' for square_sum backward (#143)
reminisce Aug 3, 2017
5866b2b
Sparse retain improvement (#138)
reminisce Aug 5, 2017
9298bfa
ignoring variables in SimpleBind that is used on python's sparse bran…
sergeykolychev Aug 5, 2017
1f07771
add bias term to fm test (#145)
eric-haibin-lin Aug 5, 2017
d511938
merge with upstream/master. resolve conflict in c_api_ndarray.cc
eric-haibin-lin Aug 5, 2017
6956431
update ndarray.nd, remove `invoke` from excluded members (#137)
eric-haibin-lin Aug 6, 2017
6c9a350
Merge remote-tracking branch 'upstream/master' into sparse
eric-haibin-lin Aug 6, 2017
66b7b8a
support storage fallback with mutable inputs (#147)
eric-haibin-lin Aug 6, 2017
cf8ddcf
Merge branch 'sparse' of https://github.com/eric-haibin-lin/mxnet int…
eric-haibin-lin Aug 6, 2017
0396c9a
Merge remote-tracking branch 'upstream/master' into sparse
eric-haibin-lin Aug 7, 2017
2dc7dc9
Code changes based on reviews (#144)
eric-haibin-lin Aug 8, 2017
f318c9d
small edits according to reviews (#151)
eric-haibin-lin Aug 8, 2017
85cbc60
Merge remote-tracking branch 'upstream/master' into sparse
eric-haibin-lin Aug 8, 2017
fc1aa6e
fix lint (#152)
eric-haibin-lin Aug 8, 2017
9ba96b9
resolve conflict in ndarray.py and capi
eric-haibin-lin Aug 8, 2017
6cbdf98
resolve conflicts in license header
eric-haibin-lin Aug 8, 2017
253ae57
add license to all new files in sparse brnach (#154)
eric-haibin-lin Aug 9, 2017
b2ad302
Allocate temp data on the fly for some casting operations (#149)
cjolivier01 Aug 9, 2017
129148c
Merge remote-tracking branch 'upstream/master' into sparse
eric-haibin-lin Aug 9, 2017
d6f987d
fix utf8 encoding in sparse ndarray
eric-haibin-lin Aug 9, 2017
955e97f
Merge branch 'sparse' of https://github.com/eric-haibin-lin/mxnet int…
eric-haibin-lin Aug 9, 2017
bc33101
Extending the GPU dot operator (#7226)
stefanhenneking Aug 9, 2017
8040953
Merge remote-tracking branch 'upstream/master' into sparse
eric-haibin-lin Aug 9, 2017
2d93d72
Add get_synthetic_dataset function to util (#146)
anirudh2290 Aug 10, 2017
80a590d
temporary fix for batch norm storage fallback (#156)
eric-haibin-lin Aug 10, 2017
92f54d2
support random_uniform/normal/gamma with row_sparse output (#155)
eric-haibin-lin Aug 10, 2017
17bfa4e
Merge remote-tracking branch 'upstream/master' into sparse
eric-haibin-lin Aug 10, 2017
ef3b442
Merge remote-tracking branch 'upstream/master' into sparse
eric-haibin-lin Aug 10, 2017
a44afed
Square sum backward support one more case (#161)
reminisce Aug 10, 2017
ceca9b6
Add documentation for sparse ops (#148)
eric-haibin-lin Aug 11, 2017
1c60a05
A few fixes (#163)
eric-haibin-lin Aug 11, 2017
04e9129
Merge branch 'sparse' of https://github.com/eric-haibin-lin/mxnet int…
eric-haibin-lin Aug 12, 2017
8ebc012
merge with upstream/master
eric-haibin-lin Aug 12, 2017
889a09e
Minor fixes sparse ops (#160)
stefanhenneking Aug 14, 2017
6b0cac1
sparse Adam optimizer (#164)
eric-haibin-lin Aug 14, 2017
eeff444
kvstore.row_sparse_pull for GPU and end-to-end benchmark: CPU vs. mul…
reminisce Aug 15, 2017
54f698b
fix bug in adam update (#167)
eric-haibin-lin Aug 15, 2017
6fa078e
change sparse example from regression to classification (#165)
eric-haibin-lin Aug 15, 2017
8cae272
fix python import (#166)
eric-haibin-lin Aug 16, 2017
bed002b
Add waitall to sparse_end2end.py (#169)
reminisce Aug 16, 2017
1682b0b
resolve conflict in dist_kvstore and attach_exec_ops
eric-haibin-lin Aug 16, 2017
f2a0852
Dot script changes (#159)
anirudh2290 Aug 16, 2017
45045ac
Transpose only if trans_lhs (#171)
anirudh2290 Aug 16, 2017
53e94c6
fix default val for distribution (#172)
eric-haibin-lin Aug 17, 2017
356c9ef
fix lint (#175)
eric-haibin-lin Aug 18, 2017
73a1ac5
Merge remote-tracking branch 'upstream/master' into sparse
eric-haibin-lin Aug 18, 2017
f9fc789
avoid cast_storage in dist-kvstore-server (#174)
eric-haibin-lin Aug 18, 2017
b208b01
Add sparse namespace to ndarray and symbol (#177)
reminisce Aug 21, 2017
7241bee
changes based on code reviews (#176)
eric-haibin-lin Aug 21, 2017
e6c775b
Merge remote-tracking branch 'upstream/master' into sparse
eric-haibin-lin Aug 21, 2017
a90bf26
temp fix to ndarray.md (#178)
eric-haibin-lin Aug 21, 2017
1d8dce7
Fix sparse namespace pylint (#179)
reminisce Aug 21, 2017
bce8d4e
Merge remote-tracking branch 'origin/sparse' into sparse
eric-haibin-lin Aug 21, 2017
be74e64
add comments and error msg (#181)
eric-haibin-lin Aug 21, 2017
d3c176c
add clarification for csr (#182)
eric-haibin-lin Aug 21, 2017
08435ed
revert change in test util (#183)
eric-haibin-lin Aug 22, 2017
7d525f8
Merge remote-tracking branch 'upstream/master' into sparse
eric-haibin-lin Aug 22, 2017
aa04cd2
fix amalgamation (#184)
eric-haibin-lin Aug 22, 2017
c228a0d
fix lint
eric-haibin-lin Aug 22, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions benchmark/python/sparse/cast_storage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

import ctypes

from mxnet.test_utils import *
import os
import time
import argparse

from mxnet.base import check_call, _LIB

parser = argparse.ArgumentParser(description="Benchmark cast storage operators",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--num-omp-threads', type=int, default=1, help='number of omp threads to set in MXNet')
args = parser.parse_args()

def measure_cost(repeat, f, *args, **kwargs):
start = time.time()
results = []
for i in range(repeat):
(f(*args, **kwargs)).wait_to_read()
end = time.time()
diff = end - start
return diff / repeat


def run_cast_storage_synthetic():
def dense_to_sparse(m, n, density, ctx, repeat, stype):
set_default_context(ctx)
data_shape = (m, n)
dns_data = rand_ndarray(data_shape, stype, density).tostype('default')
dns_data.wait_to_read()

# do one warm up run, verify correctness
assert same(mx.nd.cast_storage(dns_data, stype).asnumpy(), dns_data.asnumpy())

# start benchmarking
cost = measure_cost(repeat, mx.nd.cast_storage, dns_data, stype)
results = '{:10.1f} {:>10} {:8d} {:8d} {:10.2f}'.format(density*100, str(ctx), m, n, cost*1000)
print(results)

check_call(_LIB.MXSetNumOMPThreads(ctypes.c_int(args.num_omp_threads)))

# params
# m number of rows
# n number of columns
# density density of the matrix
# num_repeat number of benchmark runs to average over
# contexts mx.cpu(), mx.gpu()
# note: benchmark different contexts separately; to benchmark cpu, compile without CUDA
# benchmarks dns_to_csr, dns_to_rsp
m = [ 512, 512]
n = [50000, 100000]
density = [1.00, 0.80, 0.60, 0.40, 0.20, 0.10, 0.05, 0.02, 0.01]
num_repeat = 10
contexts = [mx.gpu()]
benchmarks = ["dns_to_csr", "dns_to_rsp"]

# run benchmark
for b in benchmarks:
stype = ''
print("==================================================")
if b is "dns_to_csr":
stype = 'csr'
print(" cast_storage benchmark: dense to csr, size m x n ")
elif b is "dns_to_rsp":
stype = 'row_sparse'
print(" cast_storage benchmark: dense to rsp, size m x n ")
else:
print("invalid benchmark: %s" %b)
continue
print("==================================================")
headline = '{:>10} {:>10} {:>8} {:>8} {:>10}'.format('density(%)', 'context', 'm', 'n', 'time(ms)')
print(headline)
for i in range(len(n)):
for ctx in contexts:
for den in density:
dense_to_sparse(m[i], n[i], den, ctx, num_repeat, stype)
print("")
print("")


if __name__ == "__main__":
run_cast_storage_synthetic()
Loading