Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
FastMoE
Commits
254ad118
Commit
254ad118
authored
Dec 30, 2020
by
Rick Ho
Browse files
test support for fused fw and bw
parent
35addec6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
pytorch/cuda/moe_test.py
pytorch/cuda/moe_test.py
+5
-5
No files found.
pytorch/cuda/moe_test.py
View file @
254ad118
...
...
@@ -6,14 +6,14 @@ import sys
def
perf
():
batch_size
=
int
(
sys
.
argv
[
1
])
i
n
_feat
=
int
(
sys
.
argv
[
2
])
out
_feat
=
int
(
sys
.
argv
[
3
])
i
o
_feat
=
int
(
sys
.
argv
[
2
])
hidden
_feat
=
int
(
sys
.
argv
[
3
])
num_expert
=
int
(
sys
.
argv
[
4
])
inp
=
torch
.
rand
(
batch_size
,
i
n
_feat
).
cuda
()
inp
=
torch
.
rand
(
batch_size
,
i
o
_feat
).
cuda
()
gate
=
torch
.
randint
(
low
=
0
,
high
=
num_expert
,
size
=
(
batch_size
,
),
requires_grad
=
False
).
int
().
cuda
()
moe
=
MOELayer
(
num_expert
,
in_feat
,
o
ut
_feat
).
cuda
()
moe
=
MOELayer
(
num_expert
,
i
o_feat
,
hidde
n_feat
,
i
o_feat
).
cuda
()
o
=
moe
(
inp
,
gate
)
o
=
moe
(
inp
,
gate
)
...
...
@@ -35,7 +35,7 @@ def perf():
sqtot
+=
(
te
-
ts
)
**
2
maxt
=
max
(
maxt
,
te
-
ts
)
gflops
=
2e-9
*
n_runs
*
i
n
_feat
*
out
_feat
*
batch_size
/
tott
gflops
=
2e-9
*
n_runs
*
i
o
_feat
*
hidden
_feat
*
2
*
batch_size
/
tott
print
(
'Time mean/max/stdev {:.3f} {:.3f} {:.3f} ms, {:.3f} GFLOPs'
.
format
(
tott
*
1e3
/
n_runs
,
maxt
*
1e3
,
(
sqtot
/
n_runs
-
(
tott
/
n_runs
)
**
2
)
*
1e3
/
n_runs
,
gflops
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment