-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New fused edge_softmax op (dmlc#3650)
* [feature] edge softmax refact. * delete file * fix backward and cmake version * fix backward * format function * fix setting * refix * refix * refix * refix * refix * refix * refix * refix * refix * refix * refix * refix * add cuda kernel for backward and rename some function * add benchmark for edge_softmax * fix format * remove cuda_backwrd * fix code format and add comment for op on CPU * fix lint Co-authored-by: Jinjing Zhou <[email protected]>
- Loading branch information
1 parent
45ac572
commit bc8f8b0
Showing
7 changed files
with
364 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import time | ||
import dgl | ||
import torch | ||
|
||
from .. import utils | ||
|
||
# The benchmarks for ops edge_softmax | ||
@utils.benchmark('time', timeout=600) | ||
@utils.parametrize('graph', ['ogbn-arxiv', 'reddit', 'cora', 'pubmed']) | ||
@utils.parametrize('num_heads', [1, 4, 8]) | ||
def track_time(graph, num_heads): | ||
device = utils.get_bench_device() | ||
graph = utils.get_graph(graph).to(device) | ||
score = torch.randn((graph.num_edges(),num_heads)).requires_grad_(True).float().to(device) | ||
|
||
# dry run | ||
for i in range(3): | ||
y = dgl.ops.edge_softmax(graph, score) | ||
|
||
# timing | ||
with utils.Timer(device) as t: | ||
for i in range(100): | ||
y = dgl.ops.edge_softmax(graph, score) | ||
|
||
return t.elapsed_secs / 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.